home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG041.ARC
/
MWBKEY.MAC
< prev
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
65 lines
; Program associated with LANGUAGE TRANSLATORS, INTERPRETERS, MICROWORLD BASIC,
; SWAPPING OF CONTROL-A AND CONTROL-S document.
; G. Irlam - 26 January 1986
; A macro-80 program.
.Z80
keypt EQU 000C2h
ctrlS EQU 19d
ctrlA EQU 1d
CSEG
init: PUSH HL ; why not
LD HL, (keypt)
LD (trueat), HL ; save old address
LD HL, fake
LD (keypt), HL ; store fake address
POP HL
RET
deinit: PUSH HL
LD HL, (trueat)
LD (keypt), HL ; restore real address
POP HL
RET
fake: PUSH HL ; store HL - can usse HL without fear
LD HL, cont
PUSH HL ; return from following call will be at cont
LD HL, (trueat)
JP (HL)
cont: JP NZ, nokey ; no key was pressed
CP ctrlS
JP NZ, notctS
LD A, ctrlA ; convert ^S to ^A
JP retkey
notctS: CP ctrlA
JP NZ, retkey
LD A, ctrlS ; convert ^A to ^S
retkey: LD L, A ; save key - can't push as flags also pushed,
LD A, 0d ; but they have to be altered below
CP 0d ; set Z flag as a key was pressed
LD A, L ; restore key
JP return
nokey: LD L, A ; save "no key"
LD A, 0d
CP 1d ; reset Z flag
LD A, L ; restore "no key"
return: POP HL
RET
DSEG
trueat: DW
END