Fill routine (Amstrad Computer User)Applications Programmation
★ 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 ★ 

Fill of Machine Code

This program contains a general purpose routine which will fill any enclosed area of the screen in any chosen colour except the current paper colour. It will work in all screen modes and its operation can be aborted at any time before the area is completely filled.

The routine operates by scanning left and right from the starting point, filling in any unpainted pixels, until it meets a vertical boundary. It then stores its current values on a stack and moves up a line from where it calls itself, recursively, and repeats the process until it meets a horizontal boundary. When this happens the program retraces its steps - by retrieving previous values from the stack and continuing from where they left off -moving downwards if necessary, until all stored values have been removed from the stack and all pixels within the boundary have been filled.

This process, however, has the disadvantage of altering some of the values on the stack as it proceeds so that a complete record of all operations is no longer available.

The effect of this is that it is not easy to reverse the process if anything goes wrong; for instance, if the shape to be filled has a small gap in it then the ink will ‘escape' and proceed to fill in the whole screen. For this reason a second stack has been used to store such information as is necessary to enable the process to be aborted at any time and the partly filled area to be returned to normal. This use of two stacks, requires a large amount of memory for storage and in theory this could amount to more than the entire screen itself takes up. In practice though, two stacks of 2K each should be sufficient for all but the most intricate and elaborate shapes.

To see the routine in action type in the BASIC program and run it. If you have made a mistake in entering the data then the program will stop and inform you of the offending line which can then be corrected and the program re-run. Note that you must enter the checksum at the end of each DATA statement.

If all is well the screen will clear to mode 0 and an irregular shape will appear on the screen inside a large square. The program will then proceed to fill the area around the shape and when this is completed it will fill the shape itself, but in a different colour. After a short delay the whole process will be repeated using modes 1 and 2 and will then start all over again with mode 0. Note that in the highest resolution mode both colours will be the same since in this mode only two colours can be present on the screen. Pressing any key will abort the current fill stage and ‘unfill' the painted area before proceeding to the next stage.

When any section is completely filled there is ample time, especially in the higher resolution modes, to decide whether or not to abort. To stop the program completely press [ESC] twice.

The machine code routine can be stored anywhere in memory by changing the value of start in line 70. If you relocate the program in this way and find that it does not function correctly and if it worked before you relocated it then you have almost certainly missed out a ‘3' somewhere in the DATA statements. Note that when relocating the code you must leave at least 4K for the stacks and about 450 bytes for the routine itself so it should not be loaded above about &9900 or 39168 decimal.

The demonstration program can be removed by deleting lines 310 to 440 and 480 to 520 and the remaining lines can be used as part of a larger program. Note that your program must set X and Y to a point inside the shape being filled before calling the routine. Also the required graphics ink must be previously selected by PLOT a,b,n where a,b is an imaginary point off screen - such as 800,800 - and n is the required ink number.

ACU #8503

★ PUBLISHER: Amstrad Computer User
★ YEAR: 1985
★ COLLECTION: Amstrad Computer User 1985
★ AUTHOR(S): ???


» Fill  Routine    (Amstrad  Computer  User)    ENGLISH    LISTINGDATE: 2021-08-17
DL: 8 fois
SIZE: 193Ko
NOTE: 2 pages/PDFlib v1.6

Je participe au site:
» Vous avez des infos personnel, des fichiers que nous ne possédons pas concernent ce programme ?
» Vous avez remarqué une erreur dans ce texte ?
» Aidez-nous à améliorer cette page : en nous contactant via le forum ou par email.
★ AMSTRAD CPC ★ A voir aussi sur CPCrulez , les sujets suivants pourront vous intéresser...

» Applications » Graphic - Fast Screen Filler (CPC Amstrad International)
» Applications » RSX-Fill (Happy Computer)
» Applications » Rutina Fill Colocada (Your Computer)
» Applications » RSX DFILL (Schneider Aktiv)
» Applications » Fill (Computing with the Amstrad)
» Applications » Fast Fill (Computing With the Amstrad)

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