Saving a Headerless File Using a Machine Code Routine

See all articles from Sinc-Link v5 n2
Author(s): George Chambers
Publication: Sinc-Link
Pub Details: Sinc-Link v5 n2 (Volume 5, Issue 2)
Date: March/April 1987
Pages: 7

(TS 2068)

First load the A register with 255. This is to signify that you’re saving a block of data and not a header. Then load IX with the start location of the block of code you intend to save. Now load DE with the number of bytes that you want to save. Then CALL 04C2h, and RET brings you back to Basic.

Here’s an example, if you’re feeling a bit overwhelmed. Say you want to save a screen picture without a header. Then your assembler listing would read something like this:

LDA,255
LD DE,6912d
LD IX,16384d
CALL 04C2h
RET

Now, to reload the screen picture you’ve just saved, the code reads as follows:

SCF
LD A,255d
LD IX,16384d
LD DE,6912d
CALL 0556h
RET

The parameters here are the same as when you’re loading, except for the SCF command which sets the carry flag. If we didn’t set the carry flag, the program would just verify instead of loading. If you want to do a headerless verify, just swap the SCF command for an AND A instruction.

from Your Spectrum June 1985 p11. retyped by G. Chambers


TS2068 TIPS

POKE 23730 & 23731 WITH RAMTOP
**RESETS RAMTOP W/O DESTROYING
VARIABLES THAT ARE NOT DEFINED
IN THE PROGRAM.

1 POKE 23672,0: POKE 23673,0
9999 PRINT INT ((PEEK 23672+256*
PEEK 23673+.5)*100/60.1145+.5)/1
00
**GOTO 9999 TO FIND THE ELAPSED
TIME IN SECONDS THAT PROGRAM
HAS BEEN RUNNING.

POKE 23561,0
**STOPS KEY REPEAT. MAY BE USE-
FUL IN GAMES & UTILITIES.

POKE 23561,1
**USE TO DISABLE KEYBOARD AS
COPYRIGHT PROTECTION.

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.