;---------------------------------------------------------- ; DR.COM is a "front end" for DIR.COM 3.0 which allows the ; use of the du: disk/user form to select files for DIR. ; DR's syntax is identical to DIR's except that a ; du: format is permitted when specifing files where ; a d: format would normally be allowed. DR converts the ; du: spec to a d: spec, adds the appropriate USER parameter ; to specify the user area and then chains to DIR. DR ; uses BDOS function 47 and, as such, may only be used ; under CP/M 3.0. ; ; R. Saeks, 2/2/86 ;---------------------------------------------------------- ; bdos equ 5h ;bdos entry point chain equ 2fh ;chain program function call drtail equ 81h ;location of dr cmd line tail defdma equ 80h ;default dma buffer org 100h start: lxi d,dirtail ;beginning of dir cmd line tail lxi h,drtail ;beginning of dr cmd line tail next: mov a,m ;next char from dr tail cpi 0 ;check if end of drtail jz finish cpi ':' ;check for d: or du: form cz dordu stax d ;move byte to dir tail inx d ;increment pointers inx h jmp next ;process next byte finish: stax d ;end of cmd tail delimiter lxi h,dirbuf ;move dirbuf to default dma buf lxi d,defdma movlp: mov a,m ;get and transfer byte stax d cpi 0 ;check if end of dir tail jz chnpgm ;chain if end inx h ;increment pointers inx d jmp movlp ;continue move chnpgm: mvi c,chain ;chain to dir jmp bdos dordu: dcx h ;points to byte before colon mov a,m ;byte before colon in reg a cpi 30h ;check if less than '0' jc nousr cpi 40h ;check if greater than '9' jnc nousr sta usrlow ;store least sig dig of user # dcx h mov a,m ;check for 2 dig user # cpi 31h ;check if less than '0' jnz user sta usrhi ;store two digit user # flag dcx d user: dcx d ;points to colon in dir tail inx h inx h ;points to colon in dr tail mvi a,':' ;restore colon in reg a fnden: stax d ;store byte in dir tail inx h ;set pointers for next byte inx d mov a,m ;get next byte cpi 0 ;no DIR params after filename jz nopar cpi ']' ;DIR params after filename jnz fnden ;fall thru if filename has params param: mvi a,',' ;comma for additional param call inusr ;insert USER= jmp delim ;insert delimiter and return nopar: mvi a,'[' ;opening bracket for dir param call inusr ;insert USER=# inx d mvi a,']' ;closing bracket for dir param stax d delim: inx d ;point to end of file delimiter mov a,m ;get end of file delimiter ret ;return to normal processing nousr: inx h ;points to colon mvi a,':' ;restore ret inusr: stax d ;inserts USER=# in dir cmd tail inx d mvi a,'U' ;insert 'USER=' in tail stax d inx d mvi a,'S' stax d inx d mvi a,'E' stax d inx d mvi a,'R' stax d inx d mvi a,'=' stax d inx d lda usrhi cpi 0 ;skip if one digit user # jz onedig stax d inx d mvi a,0 ;reset usrhi sta usrhi onedig: lda usrlow ;load one digit user # stax d ret usrhi: db 0 ;two digit user # flag usrlow: ds 1 dirbuf: db 'DIR' dirtail: ds 125 end