Автор: B.J. Kamphuis
Год: 1987
Издатели: ZX Computing
Языки:
Английский
Формат:
TZX лента
Требования:
ZX Spectrum 16K,
ZX Spectrum 48K
Ссылки:
Страница на ZXArt
Страница на World Of Spectrum
Страница на Spectrum Computing
Скриншоты:
Год: 1987
Издатели: ZX Computing
Языки:
Формат:
Требования:
Ссылки:
Скриншоты:
The UDG Bank
84 UDGs must be enough for anyone.
B.J. Kamphuis shows us how to achieve
this on a Spectrum.
User Defined Graphics are a valuable and relatively easy
means of producing arcade action, background pictures or
business graphic details. Although twenty one are easily
obtainable, it is surprising how often you find you could
do with a few more.
There are many ways of getting an increased number of
UDGs and B.J. has adopted the method of storing four banks
which are transferred to and from the set UDG area of
memory as required. Now if 168 bytes have to be moved by
BASIC a noticable delay is introduced so a short machine
code routine is used to keep the program moving smoothly.
The UDGs are stored in four banks named, not surprisingly,
bank1, bank2, bank3 and bank4. Every bank can be trans-
ferred to the 'active' or normal UDG set and back.
To define a bank all you need to do is set them up as
ordinary UDGs from BASIC as normal, then use this program
to store the characters in the memory reserved for that
bank. To move a bank of UDGs to the storage area all you
have to do is use the command, either from a BASIC program
or as a direct command: RANDOMIZE USR address: REM W1
Now 'address' is either 64000 or 31232 depending on
whether you have a 16K or 48K Spectrum, and the 'W' after
the REM tells the machine code routine to write from the
normal UDG area to store, and the '1' tells it which bank
to use. Therefore when setting up your UDG banks you will
use W1, W2, W3 and W4 depending on which bank you are
working on.
The opposite effect, that of loading the normal UDG
area with the characters in a bank, is achieved by using
RANDOMIZE USR address: REM L1 - note 'L' instead of 'W'.
Once the banks have been set up then save the whole four
sets plus the machine code with the command SAVE "udgs"CODE
address, 1535 and to use in a program include after the
program has loaded the commands CLEAR address - 1:
LOAD ""CODE.
[ The TZX contains, for each memory size, the program from
the article which loads the code, followed by the machine
code plus four sample UDG banks as a CODE file. (The UDGs
are identical for both versions. Providing eight different
sets would be a bit much even for me.)
Mind you, why you would go to all this trouble instead of
simply poking the System Var UDG (23675/6), I don't know. ]
84 UDGs must be enough for anyone.
B.J. Kamphuis shows us how to achieve
this on a Spectrum.
User Defined Graphics are a valuable and relatively easy
means of producing arcade action, background pictures or
business graphic details. Although twenty one are easily
obtainable, it is surprising how often you find you could
do with a few more.
There are many ways of getting an increased number of
UDGs and B.J. has adopted the method of storing four banks
which are transferred to and from the set UDG area of
memory as required. Now if 168 bytes have to be moved by
BASIC a noticable delay is introduced so a short machine
code routine is used to keep the program moving smoothly.
The UDGs are stored in four banks named, not surprisingly,
bank1, bank2, bank3 and bank4. Every bank can be trans-
ferred to the 'active' or normal UDG set and back.
To define a bank all you need to do is set them up as
ordinary UDGs from BASIC as normal, then use this program
to store the characters in the memory reserved for that
bank. To move a bank of UDGs to the storage area all you
have to do is use the command, either from a BASIC program
or as a direct command: RANDOMIZE USR address: REM W1
Now 'address' is either 64000 or 31232 depending on
whether you have a 16K or 48K Spectrum, and the 'W' after
the REM tells the machine code routine to write from the
normal UDG area to store, and the '1' tells it which bank
to use. Therefore when setting up your UDG banks you will
use W1, W2, W3 and W4 depending on which bank you are
working on.
The opposite effect, that of loading the normal UDG
area with the characters in a bank, is achieved by using
RANDOMIZE USR address: REM L1 - note 'L' instead of 'W'.
Once the banks have been set up then save the whole four
sets plus the machine code with the command SAVE "udgs"CODE
address, 1535 and to use in a program include after the
program has loaded the commands CLEAR address - 1:
LOAD ""CODE.
[ The TZX contains, for each memory size, the program from
the article which loads the code, followed by the machine
code plus four sample UDG banks as a CODE file. (The UDGs
are identical for both versions. Providing eight different
sets would be a bit much even for me.)
Mind you, why you would go to all this trouble instead of
simply poking the System Var UDG (23675/6), I don't know. ]