home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CP/M
/
CPM_CDROM.iso
/
beehive
/
utilitys
/
peek22.arc
/
PEEK22.MAC
< prev
next >
Wrap
Text File
|
1992-05-28
|
7KB
|
248 lines
title 'PEEK22.MAC: tpa module for PEEK22 RSX'
;
; Based upon PEEK.ASM, copyright (C) 1983 : Ron Fowler, Fort Atkinson, WI
;
; This version has been modified to work with Jim Lopushinsky's SETRSX
; manager for CP/M 2.2. It has been modified for use with M80, the
; Microsoft 8080/Z80 Macro-assembler. - Mark Howard 09/11/84
;
; This is the TPA module for the PEEK22 rsx. It must be combined with
; PEEKBDOS V2.0 using DDT or ZSID, see the instructions below. Syntax and
; usage information is contained in the companion module, PEEKBDOS.MAC.
; To generate PEEK22.COM, you must know the address of your BDOS. INF,
; CCPLOC, or another similar utility can be used. Also, PEEKBDOS.PRL
; has been provided for those users that don't have LINK.COM.
;
; To compile and link, do the following:
;
; A>M80 =PEEK22 <= To compile this source
; A>M80 =PEEKBDOS <= To compile the RSX
; A>LINK PEEKBDOS[OP] <= Produces PEEKBDOS.PRL
; A>L80 PEEK22,LOADRSX,PEEK22/N,/E <= Produces PEEK22.COM
; A>DDT PEEK22.COM <= Now patch and overlay
; DDT VERS 2.2 <= .COM file with RSX
; NEXT PC
; 0400 0100
; -IPEEKBDOS.PRL <= Load RSX .PRL file
; -R300 <= loads it to 400h
; NEXT PC
; 0780 0100
; -S103 <= Now patch your BDOS addr
; 0103 00 LL <= LL = Lo byte
; 0104 00 HH <= HH = Hi byte
; 0105 50 . <= Period ends
; -G0 <= Warm boot
; A>SAVE 7 PEEK22.COM <= Save with RSX attached
;
;-----------------------------------------------------------------------------
;
; equates
;
bdos equ 5 ;system entry point
printf equ 9 ;print console buffer funct #
retvrs equ 0ch ;return version number
rsxmgr equ 59 ;"CALL RSX MANAGER" system call
rsxf equ 60 ;"CALL RSX" system call
;
dfcb1 equ 5ch ;default file control block 1
dfcb2 equ 6ch ;default file control block 2
tpa equ 100h ;transient program area
;
cr equ 13 ;carriage-return code
lf equ 10 ;linefeed code
;
extrn loadrs
;
aseg
;
org 100h
;
; This is the section of code that constitutes the major modification
; to the original PEEK.ASM module by Ron Fowler. When using CP/M+,
; the PEEKBDOS RSX is bound to the PEEK.COM file using GENCOM, causing
; the PEEKBDOS to be automatically loaded by the CP/M+ CCP if not
; already present when PEEK is executed. In that CP/M 2.2 does not
; support this capability, the RSX must be "manually" loaded by the
; program requiring it's services. This is done via BDOS function 59,
; Call RSX Manager, supported by the RSX manager loaded by SETRSX.
;
jmp start ;jump around the data area
;
bdoslc: db 0 ;patch with BDOS (lo)
bdospg: db 0 ;patch with BDOS (hi)
;
vmsg: db 'PEEK22 v1.0 as of 11-Sept-84','$'
;
;
ds 48 ;local stack
stack equ $
;
; Program begins here
;
start: lxi sp,stack ;use our local stack
mvi c,retvrs ;check for correct version
call bdos ;
ani 0f0h ;isolate major revision
cpi 020h ;2.x ok
jnz badvrs ;
mov a,h ;check for MP/M
ora a ;
jnz badvrs ;
lxi d,vmsg ;print the version message
mvi c,printf ;
call bdos ;
lda bdospg ;check to see if 103H is patched
ora a ;
jz notpat ;if not, message and exit
lxi d,mgrnam ;check to see if RSX manager is loaded
call chkrsx ;
jz nomgr ;if not, message and exit
lxi d,myname ;check to see if our RSX is loaded
call chkrsx ;
jnz proces ;yes, go process a possible command line
lxi h,0400h ;point to the RSX
xra a ;relocation offset
call loadrs ;load it
jz proces ;RSX loaded OK, go process the command line
dcr a ;else check the error code
jz notpb ;either not a page boundary
jmp nomem ;or not enough memory
;
; parse any arguments from
; the command line, and pass them on to the rsx using function 60.
;
proces: lxi h,dfcb1+1 ;get pointer to command line arg
mov a,m ;get optional "-" (for unix people)
cpi '-'
jnz nodash ;jump if not there
inx h ;yep, advance past it
nodash: call parse ;parse first argument
call parse ;parse possible second argument
mov a,m ;shouldn't be a third
cpi ' ' ;(ie, 3rd position should be blank)
jnz synerr ;if bad, jump
sendit: lxi d,rsxpb ;send to rsp
mvi c,rsxf
call bdos
jmp 0 ;all done, warm-boot
;
; parse an argument
;
parse: mov a,m ;fetch argument
inx h ;advance pointer
cpi ' ' ;allow nulls
rz
cpi 'P' ;pause-flag?
jnz npars ;jump if not
mvi a,1 ;pause-flag
sta args+1 ;where it goes
ret
npars: call valid ;validate
sta args
ret
;
valid: cpi 'Q' ;quit...
rz
cpi 'A' ;out to aux
rz
cpi 'C' ;out to con
rz
cpi 'L' ;out to list
jnz synerr ;what then?
ret
;
; syntax error
;
synerr: lxi d,synems ;oops, bomb out
mvi c,printf ;print string function #
call bdos
mvi a,'Q' ;insure removal of rsx
sta args
jmp sendit ;go send, exit
;
synems: db cr,lf,'Command Line Syntax Error',cr,lf,'$'
;
; check for an RSX in memory - nz = found
;
chkrsx: lhld 6 ;get current "BDOS" pointer
ckbdos: lda bdospg ;check vs. known BDOS location
cmp h ;
rz ;return with z set if BDOS reached
mvi l,0eh ;else point to removal flag
mov a,m ;
ora a ;is this RSX active?
jnz gonext ;no - loop to the next
push h ;else save the RSX page pointer
mvi l,10h ;point to the name
mvi b,8 ;characters to check
call match ;check for a match
pop h ;restore pointer
jnz gonext ;no match - loop to next
xra a ;else set NZ for found
dcr a ;
ret ;
gonext: mvi l,0bh ;point to NEXT pointer (hi)
mov h,m ;HL has new page
jmp ckbdos ;go see if we reached BDOS
;
match: push d ;save the used registers
push h ;
inr b ;
mtchlp: dcr b ;decrement count
jz mtchdn ;we're done if 0
ldax d ;get a template byte
ani 07fh ;(ascii)
mov c,a ;save in C
mov a,m ;get a compare byte
ani 07fh ;(ascii)
cmp c ;compare
inx h ;bump pointers
inx d ;
jz mtchlp ;if match, check next
mtchdn: pop h ;quit on first mismatch
pop d ;
ret ;
;
; error exits
;
badvrs: call erxit ;
db 7,'PEEK22 requires CP/M 2.x$'
;
notpat: call erxit ;
db 7,'BDOS address at 0103H is not patched.$'
;
nomgr: call erxit ;
db 7,'RSX manager not loaded.',cr,lf
db 'Use SETRSX to load.$'
;
notpb: call erxit ;
db 7,'RSX not on a page boundary.$'
;
nomem: call erxit ;
db 7,'Insufficient memory.$'
;
erxit: pop d ;get the message address
mvi c,printf ;
call bdos ;
rst 0 ;warm boot
;
; rsx parameter block
;
rsxpb: db 127 ;function # (we ignore)
db 2 ;2 parameters
dw myname ;parm1 = rsx name
dw args ;parm2 = command line arguments
;
; name of rsx
;
myname: db 'PEEKBDOS' ;name of RSX we're calling
args: db 'A',0ffh ;output-device, pause-flag
;
; name of RSX manager
;
mgrnam: db 'RSX ' ;
;
prgend equ $
;
end