in others the page 0 location may simply hold an extended address-
ing JP to another memory area. If all of the above is worth the trou-
ble, typical RSTs would appear as follows.
ORG 0
LD (HL), A STORE A
INC HL INCREMENT
RET
ORG 08H
LD A, (HL) LOAD A
INC HL INCREMENT
RET
ORG 10H
RLCA ROTATE A 4 LEFT
RLCA
RLCA
RLCA
RET
c
STRING EQU 0
LDINC EQU 08H
R04LF EQU 10H
RST LDINC LOAD BYTE 1
RST STRING STORE
RST LDINC LOAD BYTE 2
RST STRING STORE
RST LDINC LOAD BYTE 3
RST R04LF ROTATE 4
ANL) A, FH STRIP BCD DIGIT
The three routines at locations 0, 08H, and 10H are typical of the
commonly used routines that could be placed in page 0. The call is
made to the proper page 0 location by the RST with an argument
previously equated to the page 0 location. RST LDINC would be
identical to RST 0, for example.
REENTRANCY
The subroutine calls, returns, and stack instructions facilitate the
writing of reentrant code. Reentrancy in a portion of code means
that the code may be reentered due to interrupt processing. Reen-
trancy is no problem if the environment is saved when the interrupt
is received and if in the routine that is reentered, no common mem-
ory locations are altered. If common memory is altered, then reen-
trancy may destroy the results or partial results of the previous users
of the reentered routine.
216
Need help?
Do you have a question about the Z80 and is the answer not in the manual?
Questions and answers