home *** CD-ROM | disk | FTP | other *** search
- ;
- ; usage: SETPATH pathstring
- ;
- ; DOS+ utility. For run-time configuration of DOS+.
- ;
- ; 1.1 87/01/10 Reduced messages so passworded version is smaller.
- ;
- @flags equ 018h; BDOS offset to flags byte, base page
- @path equ 014h; BDOS offset to path address
- ;
- ; DOS+/CPM calls
- tstr equ 9
- cpmver equ 12
- getinfo equ 210; e = 0 returns BDOS base address
- ;
- bdos equ 5
- defdma equ 080h
- ;
- cr equ 0dh
- lf equ 0ah
- dol equ '$'+80h; So passes thru wrtstring
- ;
- jmp bgn
- ;
- ; This message also defines the acceptable words. ']' terminates lists.
- hlpmsg: db 'usage: SETPATH string',cr,lf
- db ' ex: SETPATH a0b1b2c',dol,cr,lf
- db 'to search A & C on user 0, B & C on users 1 & 2,'
- db ' C on all users.',cr,lf
- db ' SETPATH ', dol, dol, ' (resets path)',cr,lf
- db 'Not protected against over-long input strings'
- db ' (installation dependant)$'
- ;
- badpth: db 'Invalid path string$'
- badver: db 'Needs DOS+ 2.4 up$'
- nopath: db 'No path location configured$'
- ;
- ; Start here
- bgn: lxi h,0
- dad sp
- lxi sp,stack
- push h
- lda defdma
- ora a
- jz help; empty command line, help
- mvi c,cpmver; Make sure running DOS+ 2.4 up
- call bdos
- lxi d,badver
- inr h
- dcr h
- jnz msgxit; not MPM etc
- cpi 22h
- jc msgxit; < 2.2, cant be compatible mode
- cpi 30h
- jnc msgxit; Can't use CPM 3
- cpi 24h
- jnc bgn2; ok, 2.4 thru 2.f
- call getbas; of DOS+, if running
- mov a,h; DOS+ returns base pointer
- ora a; CPM returns 0
- jz msgxit; not in compatible mode
- ; " "
- ; DOS+ running, check parameters and execute
- bgn2: call getbas; of DOS+
- mvi l,@path; point to configured path location
- mov a,m
- inx h
- mov h,m
- mov l,a
- ora h
- lxi d,nopath
- jz msgxit; no path configured
- xchg; path pointer to de
- lxi h,defdma
- mov a,m; length of command line
- inx h
- push h
- add l
- mov l,a
- adc h
- sub l
- mov h,a; point to end of string
- mvi m,0; and mark it
- pop h;
- call skipbk; initial empty line leaves old path
- jc exit; end of input string
- mov a,m
- cpi '?'
- jz help
- bgn3: cpi '$'
- jz bgn4; '$' ok, used to clear path only
- ani 05fh; upshift to get drive idd
- cpi 'A'
- jc badstg
- cpi 'P'+1; max possible drive
- jnc badstg
- bgn4: mov b,a
- inx h
- mov a,m
- cpi '$'
- cnz getnum
- jc badstg; faulty input string
- inx h
- mov c,a; b is drive, c is user
- mov a,b
- stax d
- inx d
- mov a,c
- stax d
- inx d
- xra a
- stax d; tentative line end marker
- mov a,m
- ora a
- jnz bgn3; get next pair
- ; " "
- ; restore sp and exit
- exit: pop h
- sphl
- ret
- ;
- ; Bad string message and exit
- badstg: lxi d,badpth
- jmp msgxit
- ;
- ; Help message and exit
- help: lxi d,hlpmsg
- ; " "
- ; Message de^ to console
- msgxit: mvi c,tstr
- call bdos
- jmp exit
- ;
- ; skip blanks, string hl^
- skipbk: mov a,m
- cpi ' '
- rnz; carry for control, end marker
- inx h
- jmp skipbk
- ;
- ; get number (1 or 2 decimal digits) from input string hl^
- ; exit with hl pointing to last digit. Cy for invalid number
- getnum: mov a,m
- call qnum; exit error if non-digit
- rc
- ani 0fh
- mov c,a
- inx h
- mov a,m; possible 2nd digit
- call qnum
- dcx h; in case 1 digit only
- cmc
- mov a,c
- rnc ; no 2nd digit
- add a
- add a; 4*
- add c; 5*
- add a; 10*
- mov c,a
- inx h
- mov a,m
- ani 0fh
- add c
- ret
- ;
- ; check (a) is decimal digit (ascii). Carry if not
- ; f
- qnum: cpi '0'
- rc
- cpi '9'+1
- cmc
- ret
- ;
- ; Get BDOS base page, on DOS+. CPM returns 0
- ; a,f,h,l
- getbas: push b
- push d
- mvi c,getinfo
- mvi e,0
- call bdos; get BDOS base page
- pop d
- pop b
- ret
-
- ds 48
- stack:
- end
- ░)