More Programming Tips For The T/S1000

See all articles from T-S Horizons n12
Author(s): Mather White
Publication: T-S Horizons
Pub Details: T-S Horizons n12 (Issue 12)
Date: February/March 1985
Pages: 20-21

UnLISTable REM lines

Leave two extra spaces in the REM line at 16514-5. Then POKE this in:

POKE 16514,118
POKE 16515,118

Now POKE your MC in, starting at 16516. This will cause only the 1 REM part of the line to be seen when the line is LISTed. (I recommend a POKE 16510,0 to prevent deletion of the MC line.)

Tape Unlocker

Prepare recorder to LOAD the auto-RUN program you want to break into. Type:

FAST    and then
RAND USR 836 to LOAD the program.

When the report code c/o appears, the program is in, and you may do whatever you like with it, e.g., make a backup copy. Try this with a program like “Mazogs.” (Special thanks goes to Mike Minutoli for the above two tricks.)

Free MC Storage

If your memory is really cramped for MC or data storage space, e.g., a 1K ZX81, you can use the PRBUFF, which starts at 16444 and runs to 16476 (leave 16476 a 118). Disadvantages of using this area are that it will be erased at the end of a program run and when COPY or LPRINT are used. You could manage it by typing in the program which would POKE in the data. This area could also be used for password protection, since it will be erased if break is pressed. Other free storage space is at 16417 and 16507-8.

T/S 1000 Clock

Did you know your T/S 1000 has a built-in clock? It does, and here’s how to use it. Locations 16436-7 contain the screen frame display count, which counts each 60th of a second. When you want to start the clock, use:

nn  POKE 16436,0
nn POKE 16437,128

If you want to stop the clock, switch into the FAST mode. When you want to start it again, switch back to SLOW. The clock will count up to 9 minutes, 6 7/60 seconds before resetting to zero. To find out what time it is, use:

PRINT (32768-PEEK 16436-256*PEEK 16427)/60;
seconds elapsed
PRINT(32768-PEEK 16436-256*PEEK 16437)/3600;
minutes elapsed

Extra Op Codes for MC programmers

Here are some extra Z80 opcodes that you most likely have not read about. They require a special prefix which takes an H or L instruction and uses it on the 1X or 1Y registers. Hex DD is used to reference the 1X register, and FDH for the 1Y register. For example:

  0FDH  ;special prefix for 1Y
LD C,L ;now moves low byte of 1Y into C

There is another special instruction I called DUBI. It takes the register referred to, doubles it, and then increments it by one. Zilog does not test these opcodes during production of the Z80 CPU, so for a small number of you, some of these instructions may not work. The T/S 1000’s display also restricts the use of the 1X and 1Y registers. The contents of the 1Y register must be 4000H upon RETurn to BASIC, and the 1X register may only be used in the FAST Mode. Here is a summary of the extra opcodes. In the tables, the H and L prefixes refer to the high order byte of the 1X or 1Y register, and the low order byte, respectively.

MNEMONIC    OP CODE      MNEMONIC    OP CODE      MNEMONIC     OP CODE
DUBI A      CB37         LD LIX,A    DD6F         LD A,H1Y     FD7C
DUBI B      CB30         LD LIX,B    DD68         LD B,H1Y     FD44
DUBI C      CB31         LD LIX,C    DD69         LD C,H1Y     FD4C
DUBI D      CB32         LD LIX,D    DD6A         LD D,H1Y     FD54
DUBI E      CB33         LD LIX,E    DD6B         LD E,H1Y     FD5C
DUBI H      CB34
DUBI L      CB35         LD A,HIX    DD7C         LD A,L1Y     FD7D
DUBI(HL)    CB36         LD B,HIX    DD44         LD B,L1Y     FD45
                         LD C,HIX    DD4C         LD C,L1Y     FD4D
LD HIX,A    DD67         LD D,HIX    DD54         LD D,L1Y     FD55
LD HIX,B    DD60         LD E,HIX    DD5C         LD E,L1Y     FD5D
LD HIX,C    DD61
LD HIX,D    DD62         LD A,LIX    DD7D         LD H1X,L1X   DD65
LD HIX,E    DD63         LD B,LIX    DD45         LD L1X,H1X   DD6C
                         LD C,LIX    DD4D         LD H1Y,L1Y   FD65
                         LD D,LIX    DD55         LD L1Y,H1Y   FD6C
                         LD E,LIX    DD5D

MNEMONIC     OP CODE
LD H1Y,nn    FD26nn
LD L1Y,nn    FD2Enn
LD H1X,nn    DD26nn
LD L1X,nn    DD2Enn

ADD A,H1Y    FD84
ADD A, L1Y   FD85
SUB A, H1Y   FD94
SUB A, L1Y   FD95

ADD A,H1X    DD84
ADD A,L1X    dd85
SUB A, H1X   DD94
SUB A, L1X   DD95

INC H1X      DD24
INC L1X      DD2C
INC H1Y      FD24
INC L1Y      FD2C

AND H1X      DDA4
AND L1X      DDA5
AND H1Y      FDA4
AND L1Y      FDA5

XOR HIX      DDAC
XOR L1X      DDAD
XOR H1Y      FDAC
XOR L1Y      FDAD

DEC H1X      DD25
DEC L1X      DD2D
DEC H1Y      FD25
DEC L1X      FD2D

OR H1X       DDB4
OR L1X       DDB5
OR H1Y       FDB4
OR L1Y       FDB5

CP HIX       DDBC
CP L1X       DDBD
CP H1Y       FDBC
CP L1Y       FDBD

ADC A,H1X    DD8C
ADC A,L1X    DD8D
ADC A,H1Y    FD8C
ADC A,L1Y    FD8D

SBC A,H1X    DD9C
SBC A,L1X    DD9D
SBC A,H1Y    FD9C
SBC A,L1Y    FD9D

LD H1Y,A     FD67
LD H1Y,B     FD60
LD H1Y,C     FD61
LD H1Y,D     FD62
LD H1Y,E     FD63

LD L1Y,A     FD6F
LD L1Y,B     FD68
LD L1Y,C     FD69
LD L1Y,D     FD6A
LD L1Y,E     FD6B

TSH