APPLICATIONSDIVERS ★ ANALOGUE AND DIGITAL CLOCK (THE AMSTRAD USER) ★

Analogue and Digital Clock (The Amstrad User)Applications Divers
★ Ce texte vous est présenté dans sa version originale ★ 
 ★ This text is presented to you in its original version ★ 
 ★ Este texto se presenta en su versión original ★ 
 ★ Dieser Text wird in seiner Originalfassung präsentiert ★ 

If you're anything like me, even after all the serious work that can be accomplished on the computer has been finished, there's still more work, sadly enough, that is not in the slightest way computer-orientated. In the past your beloved possession sat there displaying "READY" until you remembered to pull it's plug. Now you can turn your Amstrad into an attractive combined digital/analogue display.

Features

The program is a "no-frills" application so that people can add their own embellishments as they wish. After input of current time, the screen clears, draws a clock face and puts in the hands at the input time. A digital display is also given.

The digital readout is the hours:minutes:seconds type and has a leading zeros format so that times such as 4:05:34, for example, do not become 4: 5:34. The appropriate am or pm suffix is appended.

The clock face is round (corrections have been incorporated allowing for the Amstrad's vertical distortion) with dashes at every 5 minute mark and dots at each minute mark. There are three hands; the seconds hand is updated each second, the other two updating each minute.

Recent amendments to the program include a video reverse function and a dimmer (which can be used to manipulate colour on a colour monitor).

Operation

Three responses are required. To "hours?" type in the time according to a 24 hour clock (this is how am or pm is selected). Then to "Minute?" give the number of minutes after the hour and to "Seconds?" the number of seconds after the minute. It takes some time to set up the screen so allow about four seconds for total accuracy. Default values arc 24 for hours and 0 for minutes and seconds (midnight).

The clock looks best in a darkened room with the brightness and contrast controls turned to a minimum (on a green screen). The background and display colours can be reversed by pressing 'R'. Use the up/down cursor keys to dim or brighten the clock face.

Problems and Program details

Essentially the program loops inside nested WHILE loops. The seconds-counter is incremented by an AFTER 50 interrupt. This is why the loops appear as never-ending which would be the case if there wasn't an interrupt. The minutes counter advances upon the seconds counter reaching 60 (which is reset to 0). In the next time-bracket the same happens for the hours-counter.

Screen preparation is performed by lines 510-610. The hands are drawn in by lines 620-660. Note that XOR ink mode is used (line 630) so that the seconds hand doesn't wipe out the hours and minutes hands in the first revolution. Animation is achieved by drawing over the top of the previous hand position. The first pass draws; the second pass erases.

This method comes with some problems however. Initially the program enters the last subroutine at line 640 (as there is no previous hand to erase). So if the time is 4:33:33 initially, the 33 position is drawn 3 times: once each for seconds and minutes and once more when the second hand advances. This leaves the minute hand "dead". The same problem (but less obvious) occurs when hands pass over each other in the course of the program, but the situation is righted as soon as the faster hand moves ahead.

One other problem was a language fault. BASIC does not support a leading zeros format directly. For this reason bulky IF statements were required to check the length of mins and sees and channel the print out through the required format (initially lines 240-260).

I have kept GOTO statements to a minimum to keep the program reasonably structured, and have indented looped segments (a practice more people should make use of) to improve readability).

Variables

  • j - hand designator (secs, mins, hrs)
  • ln (1 to 3) - hand length
  • inc (1 to 3) - degree increment at each movement
  • ps (1 to 3) - position of hand
  • last - previous position of hand
  • hrs - hours
  • mins - minutes
  • sees - am/pm suffix
  • ct - counter to draw clock face dashes
  • lit - counter to draw dots
  • innerx - inner x co-ord for dashes and dots
  • outerx - outer x co-ord for dashes
  • innery - inner y co-ord for dashes and dots
  • outery - outer y co-ord for dashes

Note: This program was written for a 6128 and will require some small modifications to run on a 464. For example lines 70 and 80 use GRAPHICS - delete this word. Also look a the DRAW command in line 630.

TAU

★ PUBLISHER: The Amstrad User (Australia)
★ YEAR: 1987
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ AUTHOR: Ian Abbott
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Aucun fichier de disponible:
» Vous avez des fichiers que nous ne possédons pas concernent cette page ?
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
Je participe au site:
» Pour ce titre nous ne disposons de fichier executable sur CPC (Dump, Saisie du listing) , alors si vous avez ça dans vos cartons ou vous désirez usé vos petit doigts boudinés sur votre clavier faites le nous savoir.
» Vous avez des infos personnel ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.

CPCrulez[Content Management System] v8.7-desktop/c
Page créée en 217 millisecondes et consultée 1637 fois

L'Amstrad CPC est une machine 8 bits à base d'un Z80 à 4MHz. Le premier de la gamme fut le CPC 464 en 1984, équipé d'un lecteur de cassettes intégré il se plaçait en concurrent  du Commodore C64 beaucoup plus compliqué à utiliser et plus cher. Ce fut un réel succès et sorti cette même années le CPC 664 équipé d'un lecteur de disquettes trois pouces intégré. Sa vie fut de courte durée puisqu'en 1985 il fut remplacé par le CPC 6128 qui était plus compact, plus soigné et surtout qui avait 128Ko de RAM au lieu de 64Ko.