APPLICATIONSDIVERS ★ SCREEN COMPACTER (COMPUTING WITH THE AMSTRAD) ★

Screen Compacter (Computing With the Amstrad)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 ★ 

ROLAND WADDILOVE offers a short machine code routine to speed loading a screen from tape

LOADING programs from tape can take quite a long time, running into several minutes with a lengthy listing. To relieve the boredom arising from this, commercial software often employs the use of an interesting title screen.

However, have you ever tried saving the screen to tape? Takes a long time doesn't it? Plus when you load it back again it seems to take even longer.

To solve the problem, here's a very short machine code routine that will reduce the time, and frustration, by half.

The reason it normally takes so long to load or save is that the screen display requires 16k of RAM. The whole of &C000 to &FFFF is used to store the data.

If we could reduce this in some way, then the process could be speeded up considerably.

Often there are quite large plain areas of colour that have little detail. If you looked at the screen memory, then you would find a lot of similar bytes corresponding to the large plain areas.

What we could do is to get a byte from the screen memory and count how many similar ones there are. Then the byte and the count could be saved. In this way we could save two bytes instead of many.

Then, after saving the first byte and count, the process is repeated with the second, different byte, which may be 100 bytes further on. say.

No doubt some of you will have spotted that if every adjacent byte is different then the screen compact routine will actually expand it to double its normal size.

This is because one byte is required for the data and one for the count.

However the savings with a simple screen are fantastic. It's not unusual to save 8k or more. Obviously it's going to be much quicker to save and load 7 or 8k than 16k.

Program I pokes the machine code to &9000, above HIMEM which is lowered to &9000-1. After storing the code the loader is no longer needed and can be deleted using NEW.

Listing II can be entered if you have an assembler.

To use the code, first draw your picture and set up the screen display, taking care not to scroll the screen.

Scrolling the screen will not do any harm, but when it loads back, unless the screen has been scrolled by exactly the same amount, then it will be a bit skew-whiff.

Call &9000 to save a compacted version of the screen, and Call &9045 to load it back, making sure you're in the same mode. Again it will not do any harm if you're not in the same mode. In fact, it's actually quite interesting.

Incidentally, the routine won't work for disc, unfortunately. It appears to find the end of file earlier than it should. It particularly doesn't like &1A as a screen byte. Can anyone explain why?

Still, with the speed of disc drives you won't need to worry about the size of screen you're saving, will you?

DISASSEMBLED LISTING

  • &9000-&900D Open file for writing.
  • &9013 Get byte.
  • &9016-&9025 Count bytes.
  • &9038-&9044 Write data.
  • &9045-&9052 Open file for reading.
  • &9058-&9065 Get data and poke screen.
  • &906F File name.
  • &9079-&9879 2k input output buffer.

CWTA

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

★ AMSTRAD CPC ★ DOWNLOAD ★

Type-in/Listing:
» Screen  Compacter    (Computing  with  the  Amstrad)    ENGLISHDATE: 2020-07-24
DL: 203
TYPE: ZIP
SiZE: 4Ko
NOTE: 40 Cyls
.HFE: Χ

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
Page créée en 062 millisecondes et consultée 1551 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.