'Initialising ... please wait' Now you
don't have to! Les Howarth has an instant solution
The great majority of programs use custom character sets but when a
character set is created in BASIC there is usually an annoying long
wait while the data is transferred and read into the new character
base accompanied on screen by those famous words: "Initialising ....
Please Wait"
Most programmers use the long winded loop FOR I =0
TO 1023 to construct the new set. It works but sometimes seems to
take forever. There are two ways to speed up the process. Disk drive
owners can create a character set as a file on disk and have it load
into the program quite fast using an IOCB block but the second
method is something quite different.
Suppose the entire character set was stored in a
string? The set would then be instantly available because of the
Atari's super fast string handing. Sounds good but there are
problems. Unfortunately the Character Base register (address 756)
requires the character set to begin on an even number of pages, that
is the address of the string would have to be absolutely divisible
by 256, otherwise the characters would be all wrong. The Atari
stores strings in a 'dynamic' form so that the actual address of
each string changes as your program is developed so this method
cannot be used, or can it? Supposing the address of the character
string was changed to point to a reserved part of memory, (with an
even number of pages)?. It would then remain at that position
because the program being written would not affect any protected
memory. We could POKE the address of the reserved memory into CHBAS
and it would work! The character set would truly be instantly set
up.
HOW TO DO IT
Believe it or not you don't have to work all the
details out for yourself. The accompanying program can be used
without having to understand the workings of it. All you need to do
is alter the data in CC$ for your own custom set.
Each line from LINE 31000 contains 10 characters
so it should be fairly easy to work out the position of whichever
character you want to alter. Remember that all the upper case
characters are stored first then the Graphic and lower case letters.
The first character is CHR$(32)- a space, so line
31000 stores the 10 characters from CHR$(32) to CHR$(41). Line 31010
stores from CHR$(42) to CHR$(51) and so on.
One word of WARNING. It is vital that CC$ is the
first variable that the program sees, therefore make sure you type
line 10 before anything else. The ATARI stores variable names in the
order that you type them in so if you add this routine to an
existing program it will not work, as CC$ will be added to the end
of the variable name table. To overcome this little problem, add the
routine then list the entire program to tape or disk using LIST "C"
or LIST "D:FILE". Then type
NEW and re-enter the file using ENTER "C" or ENTER "D:FILE". The
name table should then be correct. This procedure must be followed
if you use TYPO to check the listing.
HOW DOES IT WORK?
The computer's memory is first lowered by 8 pages.
This could be any number but you should never lower memory by less
than five pages for a character set. The reason for this restriction
is that when a 'clear screen' (CHR$(125)) instruction is
encountered, ATARI BASIC tends to wipe out some of the memory above
the screen and above RAMTOP which would of course wipe out some of
your characters if they started immediately above the screen memory.
The Address of Strings and other variables is
stored in a table. Address 134 and 135 (VVTP) points to the start of
the variables, each one being allocated 8 bytes in this table. For
strings the third and fourth bytes in VVTP gives a reference address
for the string. This is not the actual address but an OFFSET number
of bytes from the beginning of STARP (locations 140 and 141). These
are the two bytes which need to be altered in order to redirect the
string to your reserved memory.
In line 29030, 'D' is the address of the first
variable in STARP, and 'R' is the address of VVTP. So R + 2 and R +
3 are the two bytes to change. In line 29040 'Q' finds the necessary
OFFSET number of bytes which will direct the string to 4 pages above
the screen. 'Q' is then divided into high and low bytes and these
are POKEd into VVTP in line 29050.
The final instruction, which is placed at the end
of all the new character data, is to POKE the string address into
CHBAS – POKE 756,MEMTOP
That's it. I hope that this technique will prove
useful to you and speed up those agonising initialisation sequences
in your programs. If you have any difficult understanding the
program, a read through the COMPUTE! book REVISED MAPPING THE ATARI
should help. It's a book that should be at every programmer's side.
|
|
|
top