CODINGLISTINGS ★ AFTER ALL THIS TIME|COMPUTING WITH THE AMSTRAD) ★

After All This Time (Computing with the Amstrad)Coding Listings
★ 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 ★ 

THIS month we'll be taking a look at one way of using the Amstrad's four delay timers. These allow a program to be getting on with one task and then, after a specified delay, performing another. When this is done, it gets on with the job it was doing beforehand.

  • 10,20 The usual REMs. giving a hint as to what the program does and who was responsible for it.
  • 30 Selects Mode 2. This makes the screen tidier and the text clearer.
  • 40 Sets the numeric variables sum, routine, and flag to zero. This isn't strictly necessary as the Amstrad assumes that they are zero until they're assigned another value. It is. however, good programming practice.
  • 50 This line uses the command AFTER to toll the micro to go and perform the subroutine at line 190. but only after a delay. In the meantime it can be doing something else. The delay is set by the first figure following the AFTER, the units being 1/50th of a second. Here the delay is to be 250 of these units, in other words 5 seconds. The 0 following the 250 tells the Amstrad which of its four timers, numbered 0 to 3. to use.
  • 60 This time the AFTER is followed by the figures 500 and 1. This means that before the subroutine at line 240 is called there will have been a delay of 10 seconds, measured on timer number 1.
  • 70,80 Use timers 2 and 3 to call the subroutines at lines 290 and 340 after delays of 15 and 20 seconds respectively.
  • 90,100 Inform the user of the result of the previous lines. All four timers are set and are ticking away. As each runs out the appropriate subroutine is called. Meanwhile the program carries on.
  • 120-140 Form a WHILE ... WEND loop which carries on cycling until the variable flag, previously set to 0. takes the value 1. This will only happen after the fourth subroutine has been called.
  • 130 Each time round the loop sum is increased in value by 1. The loop keeps on going round, adding 1 to sum while in the background the timers are ticking away, awaiting their moment of glory.
  • 160,170 The program only reaches these lines after the WHILE... WEND loop has stopped cycling. This happens after the fourth timer has called the final subroutine and it has set flag to 1.
  • 180 Stops the program crashing into the subroutines. Try leaving it out and see what happens.
  • 190-230 These form the first subroutine, called when timer 0 has counted out five seconds. When this happens the Amstrad interrupts what it is doing in the WHILE... WEND loop and performs this subroutine. It then takes up the main program from where it left off.
  • 240-390 Make up the subroutines called by timers 1. 2 and 3. Each time the value of routine is increased by 1 and both sum and routine displayed.
  • 380 Sets flag to 1. ending the WHILE .. WEND loop.

CWTA

★ PUBLISHER: Computing With The Amstrad
★ YEARS: 1985 , 1986
★ CONFIG: ???
★ LICENCE: LISTING
★ AUTHOR: Trevor Roberts

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» After  All  This  Time    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-07-20
DL: 7 fois
TYPE: ZIP
SIZE: 4Ko
NOTE: 40 Cyls
.HFE: NON

Je participe au site:
» Newfile(s) upload/Envoye de fichier(s)
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

Lien(s):
» Coding Src's » Reaction Timer (Computing with the Amstrad)
» Coding Src's » Read or write in record time (Computing with the Amstrad)

QUE DIT LA LOI FRANÇAISE:

L'alinéa 8 de l'article L122-5 du Code de la propriété intellectuelle explique que « Lorsque l'œuvre a été divulguée, l'auteur ne peut interdire la reproduction d'une œuvre et sa représentation effectuées à des fins de conservation ou destinées à préserver les conditions de sa consultation à des fins de recherche ou détudes privées par des particuliers, dans les locaux de l'établissement et sur des terminaux dédiés par des bibliothèques accessibles au public, par des musées ou par des services d'archives, sous réserve que ceux-ci ne recherchent aucun avantage économique ou commercial ». Pas de problème donc pour nous!

CPCrulez[Content Management System] v8.7-desktop/cache
Page créée en 793 millisecondes et consultée 53 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.