home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Oakland CPM Archive
/
oakcpm.iso
/
cpm
/
kaypro
/
dskdrv13.lbr
/
ENQUIRE.ZQ0
/
ENQUIRE.Z80
Wrap
Text File
|
1985-06-05
|
2KB
|
145 lines
title 'ENQUIRE RSX residency (85/01/26)'
;
; Usage: ENQURE nn (where nn is RSX number. prints response in a)
; quicky test mechanism for RSX's. Can be very DANGEROUS.
; Ex: "ENQUIRE 1" will show hex value of next key struck.
; "ENQUIRE 64 FFFF" will inactivate RSX #100
; "ENQUIRE 63" will show if RSX #99 is presently active
; "ENQUIRE C" will show CPM version number.
; "ENQUIRE 2 45" will print hex 45, i.e "E"
;
bdos equ 5
cout equ 2
pstrg equ 9
fcb1 equ 05ch; find rsx # here
fcb2 equ 06ch; find argument here, if any
;
cr equ 13
lf equ 10
;
ld hl,0
add hl,sp
ld sp,stack
push hl
ld hl,fcb1
call getnum
jp c,help; invalid enquiry
ld c,e
ld hl,fcb2
call getnum; ignore failure, use 0 default
call bdos
or a
jp nz,live
ld de,none
exitm: call tstr
exit: pop hl
ld sp,hl
ret
;
hlpmsg: db 'Usage: ENQUIRE nn [arg]',cr,lf
db ' nn is bdos call #, values in hex',cr,lf
db ' DANGEROUS - can execute any BDOS function$'
none: db 'No such RSX now active (or function returns 0)$'
;
help: ld de,hlpmsg
jp exitm
;
; output string de
tstr: ld c,pstrg
jp bdos
;
; getnumber from hl^ up. 1st byte should be zero. Carry if invalid
; or initial space.
getnum: ld de,0
ld a,(hl)
inc hl
or a
stc
ret nz
ld a,(hl)
call qhex
ret c; no 1st digit
and 0fh
ld e,a
gnum1: inc hl
ld a,(hl)
call qhex
jp c,gnumx
and 0fh
ex de,hl
add hl,hl
add hl,hl
add hl,hl
add hl,hl
add l
ld l,a
ex de,hl
jp gnum1
gnumx: cp ' '
ret z
scf
ret
;
; carry for non-hex char, else correct A thru F
qhex cp '0'
ret c
cp 'F'+1
ccf
ret c
cp '9'+1
ccf
ret nc; '0'..'9'
cp 'A'
ret c; '9'+1 thru 'A'-1
sub 7; convert
ret
;
livmsg: db cr,lf,'live RSX, response(a, hl)=$'
;
live: push af
push hl
ld de,livmsg
call tstr
pop hl
pop af
call t2hx
ld a,' '
call couta
call t4hx
jp exit
;
t4hx: ld a,h
call t2hx
ld a,l
; " "
t2hx: push af
rrca
rrca
rrca
rrca
and 0fh
call t1hx
pop af
; " "
t1hx: and 0fh
add a,090h
daa
adc a,040h
daa
; " "
couta: push bc
push de
push hl
ld e,a
ld c,cout
call bdos
pop hl
pop de
pop bc
ret
;
ds 32
stack: ds 0
;
end