Автор: Roger Valentine
Языки:
Английский
Формат:
TAP лента
Требования:
ZX Spectrum 48K
Ссылки:
Страница на ZXArt
Страница на Spectrum Computing
Языки:
Формат:
Требования:
Ссылки:
Case Swap / Mem Used
by Roger Valentine
from Popular Computing Weekly 19th August 1982
The case for a capital transfer code
Roger Valentine explains how to swap from upper to lower
case and back again.
This machine code utility routine provides three extra toolkit
functions for the ZX Spectrum: USR 65270 reads through a BASIC
program, converting all lower case letters to upper case; USR 65290
converts upper case to lower case; USR 65200 gives the number of bytes
used by the BASIC program.
These addresses assume that the code is loaded at address 65200 on a
48K Spectrum. The minor changes necessary to relocate for 16K are
given at the end of this article.
The program length section is a useful facility in its own right, both
for checking total program length and for testing the relative lengths
of alternative lines.
The routine is written in three separate modules. The program length
module merely subtracts the system variable PROG from the system
variable VARS. The difference, i.e. length of the program, is given in
BC. If that is all you want, you can omit PUSH BC and POP HL, which
puts PROG into HL for use in module two.
The BASIC program doubles as a loader and a demonstration of the case
swap routine. Line 10 reserves ample memory by lowering RAMTOP.
When you RUN the program, the STOP statement in line 90 will be
encountered as soon as the machine code has been loaded. At this
point, enter CONT to list in upper case, CONT again to list in lower
case, and CONT a third time to print the program length.
Line 9000 saves the Loader program, which is definitely to be
recommended before running. Once the routine is working correctly, you
can enter NEW and save the routine without the loader:
SAVE "CASE SWAP" CODE 65200,104
16K conversion
The routine can be relocated in a 16K Spectrum with the minimum of
difficulty. The only bytes which must be altered are where module
three calls module two and module two calls module one.
These bytes have been underlined in the listing. The routine occupies
104 bytes, so a suitable location in 16K would be 32000 (CLEAR 31999).
by Roger Valentine
from Popular Computing Weekly 19th August 1982
The case for a capital transfer code
Roger Valentine explains how to swap from upper to lower
case and back again.
This machine code utility routine provides three extra toolkit
functions for the ZX Spectrum: USR 65270 reads through a BASIC
program, converting all lower case letters to upper case; USR 65290
converts upper case to lower case; USR 65200 gives the number of bytes
used by the BASIC program.
These addresses assume that the code is loaded at address 65200 on a
48K Spectrum. The minor changes necessary to relocate for 16K are
given at the end of this article.
The program length section is a useful facility in its own right, both
for checking total program length and for testing the relative lengths
of alternative lines.
The routine is written in three separate modules. The program length
module merely subtracts the system variable PROG from the system
variable VARS. The difference, i.e. length of the program, is given in
BC. If that is all you want, you can omit PUSH BC and POP HL, which
puts PROG into HL for use in module two.
The BASIC program doubles as a loader and a demonstration of the case
swap routine. Line 10 reserves ample memory by lowering RAMTOP.
When you RUN the program, the STOP statement in line 90 will be
encountered as soon as the machine code has been loaded. At this
point, enter CONT to list in upper case, CONT again to list in lower
case, and CONT a third time to print the program length.
Line 9000 saves the Loader program, which is definitely to be
recommended before running. Once the routine is working correctly, you
can enter NEW and save the routine without the loader:
SAVE "CASE SWAP" CODE 65200,104
16K conversion
The routine can be relocated in a 16K Spectrum with the minimum of
difficulty. The only bytes which must be altered are where module
three calls module two and module two calls module one.
These bytes have been underlined in the listing. The routine occupies
104 bytes, so a suitable location in 16K would be 32000 (CLEAR 31999).