CODINGLISTINGS ★ SCROLLER (COMPUTING WITH THE AMSTRAD) ★

Scroller (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 ★ 

SCROLLER is a short, simple program that scrolls a message letter by letter from right to left across the screen, repeating it endlessly in a "wrap around" display.

When you run the program it asks you for the message you want displayed and the line you'd like it to scroll across. The program does the rest, displaying the message until you press a key.

If you want to incorporate Scroller in your own programs it couldn't be easier. The subroutine that does the work (GOSUB 270) can just be renumbered and merged with your programs. All you have to do is to set up the two variables mentioned in its REM statements.

Pete Bibby

SUBROUTINES

  • GOSUB 90 Checks and accepts the message to be displayed, adding a space to it. It also accepts the line the scrolling is to take place on, again trapping erroneous input.
  • GOSUB 270 Does the actual work using two FOR .. NEXT loops. The first loop has the message appearing from the right, growing letter by letter, travelling towards the left. This loop stops when the whole message has completed its journey from right to left and is displayed on the screen.
    The next loop carries on the scrolling, displaying the message in the centre of the line, giving a wrap around effect. This is achieved by taking a letter off the front of the message, adding it to the end of what's left and then overprinting the original with this new string. The delay loops of lines 400 and 480 can be left out if you want to see how fast your micro can work.

VARIABLES

  • message$, submessage$ Hold the string to be scrolled plus a space which separates the messages.
  • aline, subaline Determine the screen line that the display is to use. sublength The length of the message.
  • subdisplay$ At first this is full of spaces, but each time the first loop cycles a space is removed and a letter added in its place until it eventually holds the whole message. The second loop uses it to contain and display the dismembered message as it wraps around.
  • substartposition Holds the position of the left end of the display, which is fixed in line 340 so that it's centred on the line.

ACU

★ PUBLISHER: Computing With The Amstrad
★ YEAR: 1985
★ CONFIG: 64K + AMSDOS
★ LANGUAGE:
★ LiCENCE: LISTING
★ COLLECTION: COMPUTING WITH THE AMSTRAD 1985
★ AUTHOR: PETE BIBBY
 

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» SCROLLER-PETE  BIBBYDATE: 2013-05-06
DL: 312
TYPE: text
SiZE: 2Ko
NOTE:

Je participe au site:
» 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 230 millisecondes et consultée 1467 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.