Download Print this page

ZiLOG Z80 Handbook page 209

Hide thumbs Also See for Z80:

Advertisement

tion for the user. The interrupt processing routine would call the
subroutine with a user number.
LD
A,3
THIS IS USER # 3
CALL
GETCH
LOOK FOR NEXT CHARACTER
OR
A
SET FLAGS
JP
NZ,AVAIL
GO IF CHARACTER AVAILABLE
The subroutine at GETCH would utilize the user number to find
the predefined user area ( or task block) for storage of data and vari-
ables if required.
GETCH PUSH AF SAVE USER #
SLA A
( USER #) * 2
LD C,A
( USER #) * 2 IN BC
LD B,0
LD HL , BUFTB TABLE OF BUFFER ADDRESSES
ADD HL,BC
LD E,(HL)
INC HL
LD D,(HL) GET BUFFER ADDRESS
CALL READK READ KEYBOARD
JP Z,OUT GO IF NONE AVAILABLE
LD (HL,) A STORE CHARACTER
BUFTB DEFW BUFFO TABLE OF BUFFER
DEFW BUFF1 ADDRESSES USERS
DEFW BUFF2 0 THRU 4
DEFW BUFF3
DEFW BUFF4
Other ways to avoid the reentrancy problem are "lock - outs" of
subroutines in use, disabling of interrupts during critical sequences,
and replication of code for each level of user, but the above tech-
niques are probably the most common and the use of stack for tem-
porary storage is the cleanest implementation.
218

Advertisement

loading
Need help?

Need help?

Do you have a question about the Z80 and is the answer not in the manual?

Questions and answers