;.he CHGPRT12.Z80 dependent file for PRT12, PRTCOL --CHR$(13)09JUL86 -#- ; ;Quick-Hack version... not particularly friendly, but quickest to ; get running. ; ;Enter here when there's a flag on the command line. ; ACCESS: ld hl,DFDMA ld de,UPTOP ld bc,80h ldir ;save command tail for later call TADISP ld hl,UPTOP ld de,DFDMA ld bc,80h ldir ret ; ALTRIT: call ILPRT dm CR,1Fh,62,CR,'Value' dm 'to' dm 'alter' dm '(type' dm 'the' dm 'label):' db 0 ld de,LINBUF call LINEUP ld de,LINBUF+1 ld a,(de) ld b,a or a jp z,NOMTCH inc de push bc push de ld hl,DEFTAB jp MATCHR ; NXMTCH: xor a ;loop to the null pop de ;get back start of typed name pop bc ;get its byct NXMTLP: inc hl cp (hl) jp nz,NXMTLP inc hl ;to the variable factor inc hl ;adlo inc hl ;adhi inc hl ;to beginning of next entry dec a ;FF = end of table cp (hl) jp z,NOMTCH push bc push de MATCHR: ld a,(de) ;de points into LINBUF and 7Fh cp 'a' jp c,CMATCH cp 'z'+1 jp nc,CMATCH and 5Fh CMATCH: cp (hl) jp nz,NXMTCH inc hl inc de djnz MATCHR pop af pop af ;flush two cells from stack xor a TONUL: cp (hl) ;and now walk, don't run, to the inc hl ; nearest null. jp nz,TONUL ld a,(hl) ;hl walked past null to variable factor inc hl ld e,(hl) ;adlo inc hl ld d,(hl) ;adhi push af ;a will pop into b, f into c push de ;save variable's address cp 11 jp z,NEWFCB jp nc,NEWSTR ; call ILPRT dm CR,1Fh,4Eh,CR,'New' dm 'HEX' dm 'value:' db 0 ld de,LINBUF call LINEUP call GETVAL jp nc,OKVAL ld a,c or a jp nz,OKVAL pop af pop af jp NOMTCH OKVAL: ex de,hl ;value into de pop hl pop bc ld (hl),e dec b jp z,ALTRED inc hl ld (hl),d jp ALTRED ; ; NEWFCB: call ILPRT dm CR,1Fh,4Eh,CR,'New' dm 'FCB' dm 'entry' dm '(verbatim):' db '___________',8,8,8,8,8,8,8,8,8,8,8,0 ld de,LINBUF call LINEUP ld hl,LINBUF+1 ld a,(hl) ld b,a cp 12 jp nc,HAFBAD inc hl push hl push bc FCBCHK: ld a,(hl) cp '?' jp z,FCBBAD cp '*' jp z,FCBBAD cp ';' jp z,FCBBAD cp '.' jp z,FCBBAD inc hl djnz FCBCHK pop bc pop hl pop de ;variable's address ex de,hl MUVFCB: ld a,(de) cp 'a' jp c,NANDF cp 'z'+1 jp nc,NANDF and 5Fh NANDF: ld (hl),a inc hl inc de djnz MUVFCB pop af ;flush unneeded value jp ALTRED ; FCBBAD: pop af pop af HAFBAD: pop af pop af jp NOMTCH ; NEWSTR: call ILPRT dm CR,1Fh,4Eh,CR,'New' dm 'string' dm '(verbatim):' db 0 ld de,LINBUF call LINEUP ld hl,LINBUF+1 ld a,(hl) ld c,a or a jp z,HAFBAD OKSTR: ld b,0 ;byct is the first byte. pop de inc bc ;and we gotta count it. ldir pop af ;unneeded jp ALTRED ; ; DEFTAB: db 'TABSPC',0,1 dw TABSPC ; db 'LOFSET',0,1 dw LOFSET ; db 'COLPRT',0,1 dw COLPRT ; db 'GUTBYT',0,1 dw GUTBYT ; db 'COLBYT',0,1 dw COLBYT ; ; db 'PAGLEN',0,1 ; dw PAGLEN ; db 'LINES',0,1 dw LINES ; db 'HEDRUM',0,1 dw HEDRUM ; db 'FUTRUM',0,1 dw FUTRUM ; db 'LFEED',0,1 dw LFEED ; ; db 'BSCHAR',0,1 ; dw BSCHAR ; db 'FFDMAP',0,1 dw FFDMAP ; db 'SETUP$',0,0FEh dw SETUP$ ; db 'PDONE$',0,0FEh dw PDONE$ ; db 'FLOPPY',0,1 dw FLOPPY ; db 'HOMDSK',0,1 dw HOMDSK ; db 'HOMUSR',0,1 dw HOMUSR ; db 'HOMNAM',0,11 dw HOMNAM ; db 0FFh ;table termination ; CHANGE: db 0 ; ALTRED: ld a,0FFh ld (CHANGE),a ; NOMTCH: TADISP: call CRLF ld hl,EXPLAN ld (WORDS),hl ld hl,DEFTAB DISPLP: ld a,(hl) inc a jp z,DISPDN ;test for table terminator call HLPRT call ILPRT db ': ',0 ld a,(hl) inc hl ld e,(hl) inc hl ld d,(hl) inc hl push hl cp 11 jp z,NADISP jp nc,STDISP ld a,(de) call PHEX REDISP: push hl ld hl,(WORDS) call HLPRT ld (WORDS),hl pop hl call CRLF pop hl jp DISPLP ; NADISP: push af ld a,(de) inc de call ILPCHR pop af dec a jr nz,NADISP jp REDISP ; STDISP: ld a,(de) inc de STDSLP: push af ld a,(de) inc de call PHEX ld a,' ' call ILPCHR pop af dec a jr nz,STDSLP jp REDISP ; ; DISPDN: call ILPRT dm 1Dh,LF,'Hit' dm '^X' dm 'to' dm 'abort,' dm '' dm 'to' dm 'use' dm 'these' dm 'values,' dm 'any' dm 'other' dm 'key' dm 'to' dm 'alter' dm 'them.' db 0 call FLUSHC ld c,1 call BDOS push af call ILPRT db CR,1Fh,4Eh,CR,0 pop af cp 'X'-40h jp z,EXIT cp CR jp nz,ALTRIT ld a,(CHANGE) or a ret z call ILPRT dm 1Dh,'Write' dm 'these' dm 'values' dm 'to' dm 'disk' dm 'as' dm 'new' dm 'defaults' dm '(Y/N)?' db 0 call FLUSHC ld c,1 call BDOS and 1Fh cp 'Y'-40h ret nz ; ld hl,HOMNAM ld de,PR1FCB+1 ld bc,11 ldir ; ld a,(FLOPPY) ld c,0Dh ;reset drives or a call nz,BDOS ; ld a,(HOMDSK) ld e,a ld c,0Eh ;select disk call BDOS ; ld a,(HOMUSR) ld e,a ld c,20h ;set user call BDOS ; ld de,PR1FCB ld c,0Fh ;open file call BDOS ; inc a jp nz,MOPNOK call ILPRT dm 1Dh,1Fh,8,7,'++' dm 'Can''t' dm 'find' dm 'my' dm 'home' dm 'file' dm 'to' dm 'store' dm 'new' dm 'defaults' db '++',1Dh,0 ret ; MOPNOK: ld hl,PR1FCB ld de,PR2FCB ld bc,33 ldir ;make sneaky copy ; ld de,PR1FCB ld c,14h ;dummy read sequential call BDOS or a jp nz,NOTSME ld de,PR1FCB ld c,14h ;read in second record call BDOS or a jp nz,NOTSME ; ;Now compare the two versions of bytes 180h-1FFh. ; ld hl,DFDMA ld de,180h ld b,80h CHKME: ld a,(de) cp (hl) jp nz,NOTSME inc hl inc de djnz CHKME jp DOWRIT ; NOTSME: call ILPRT dm 1Dh,1Fh,8,7,'++' dm 'File' dm 'Mismatch:' dm 'That''s' dm 'not' dm 'me' dm 'out' dm 'there!' db '++',1Dh,0 ret ; DOWRIT: ld de,100h ld c,1Ah call BDOS ; ld de,PR2FCB ;still pointing to first record ld c,15h ;write sequential call BDOS ; or a jp z,WROK db 1Dh,1Fh,8,7,'++' dm 'Write' dm 'Error' db '++',1Dh,0 ; WROK: ld de,PR2FCB ld c,10h ;close file call BDOS ; ld de,DFDMA ld c,1Ah ;set DMA call BDOS ; ld a,(CURDSK) ld e,a ld c,0Eh call BDOS ; ld a,(CURUSR) ld e,a ld c,20h call BDOS ; call ILPRT dm 1Dh,1Fh,8,'Defaults' dm 'stored' dm 'for' dm 'next' db 'time.',1Dh,0 ret ; ;;; ; ;Dummy-read all old typed characters. ; FLUSHC: ld c,0Bh call BDOS or a ret z ld c,1 call BDOS jr FLUSHC ; ; ;Mike Goyer's File 770 ;5828 Woodman Ave #2 ;Van Nuys CA 91401 ;5 for $4 ;#59 is a barnburner ; ; ;Tests (hl). Returns with carry flag set if byte is ; 'A'-'Z' or 'a'-'z'. ; ISCHAR: ld a,(hl) and 5Fh cp 'Z'+1 ret nc cp 'A' ccf ret ; ; ; ;The following is a buffered-console routine that doesn't ; use the BDOS call. The buffer it uses must look like ; the one in function 10, though, with: ; CONBUF: db MAX ;where MAX is the maximum ; ;character count the buffer ; ;can hold ; ds 1 ;byte counter ; ds MAX ;call with de-->CONBUF ; LINEUP: push de pop hl ;now hl points there too. ld (STASHW),hl ;save me one. Other user of this is DIV. ld c,(hl) inc hl inc hl ;repoint to first storage byte ld b,0 ;set up the counter LINLUP: call GETCHR ;stack-shielded conin call cp 20h jr c,DCIN RELIN: ld (hl),a inc hl inc b ld a,c cp b jp nz,LINLUP LINDUN: ld hl,(STASHW) ;CONBUF... inc hl ;+1. ld (hl),b ret ; DCIN: cp CR jr z,LINDUN cp LF jr z,LINDUN ; cp 'C'-40h ;commented out. Gemini 15X 17cpi ; jp z,EXIT ;code is ESC,B,3...hope you don't cp 'X'-40h ;need 'SUB'. jp z,EXIT cp 'H'-40h jr nz,FLUSH ;match? backspace. push hl push de push bc call ILPRT db ' ',8,0 ;first bs already echoed by BDOS pop bc pop de pop hl ld a,b or a jr z,FLUSH dec hl ld a,(hl) cp ' ' jr nc,NOTCTL push hl push de push bc call ILPRT db 8,' ',8,0 ;kill ctl-char caret pop bc pop de pop hl NOTCTL: ld (hl),0 ld a,b or a jp z,LINLUP dec b jp LINLUP ; FLUSH: cp 'U'-40h jp nz,RELIN call ILPRT db '#',1Dh,' ',0 jp LINEUP ; GETCHR: push hl push de push bc ;uses direct-console call. GCRL: ld e,FX ld c,6 call BDOS or a jr z,GCRL push af cp 20h jr nc,GCROK cp CR jr z,GCROK cp LF jr z,GCROK cp 'H'-40h jr z,GCROK cp 'U'-40h jr z,GCROK ld e,'^' ld c,6 call BDOS pop af push af add a,40h GCROK: ld e,a ld c,6 call BDOS pop af pop bc pop de pop hl ret ; ; GETVAL: ld hl,LINBUF+1 ld b,(hl) ld c,0 ;usage flag ex de,hl ;de->LINBUF+1 ld hl,0 GVAL: inc de ld a,(de) call STRIP ret c add hl,hl add hl,hl add hl,hl add hl,hl or l ld l,a dec c ;says we got at least one djnz GVAL or a ;reset the carry ret ; STRIP: cp '0' jp c,HEXERR cp '9'+1 jp nc,ISH sub '0' ret ; ISH: and 5Fh cp 'A' jp c,HEXERR cp 'F'+1 jp nc,HEXERR sub 37h ret ; HEXERR: scf ret ; EXPLAN: dm 1Fh,20,';column' dm 'count' dm 'for' dm 'tab' db 'expansion',0 ;tabspc dm 1Fh,20,';left' dm 'margin' dm 'from' dm 'print-head' db 'start',0 ;lofset dm 1Fh,20,';copy' dm 'is' dm 'split' dm 'into' dm 'this' dm 'many' db 'columns',0 ;colprt dm 1Fh,20,';inter-copy' dm 'midpage' dm 'margin' db '(gutter)',0 ;gutbyt dm 1Fh,20,';width' dm 'of' dm 'each' dm 'text' dm 'column' dm 'in' db 'characters',0 ;colbyt dm 1Fh,21,';lines' dm 'of' dm 'multicolumn' dm 'copy' dm 'per' db 'page',0 ;lines dm 1Fh,20,';header-to-copy' dm 'margin' dm 'in' db 'lines',0 ;hedrum dm 1Fh,20,';copy-to-footing' dm 'margin' dm 'in' db 'lines',0 ;futrum dm 1Fh,21,';0',1Fh,4,'=' dm 'no' db 'perfskip.',1Dh dm 1Fh,31,';0FFh' dm '=' dm 'use' dm '^L' dm 'for' db 'TOF.',1Dh dm 1Fh,31,';Else,' dm '=' dm 'PERFSKIP' dm 'in' db 'linefeeds',0 ;lfeed dm 1Fh,20,';^L' dm 'is' dm 'mapped' dm 'to' dm 'this' dm 'char' dm 'for' db 'CON:.',0 ;ffdmap dm 1Fh,19,';printer' dm 'command' dm 'string' dm 'for' dm 'PRTCOL' db 'work',0 dm 1Fh,19,';printer' dm 'command' dm 'string' dm 'for' dm 'normal' db 'work',0 dm 1Fh,20,';If' dm 'false' dm '(zero),' dm 'do' dm 'no' dm 'disk-system' db 'resets',0 dm 1Fh,20,';(A:=0)' dm 'For' dm 'parameter' dm 'storage,' db 'the',0 dm 1Fh,20,';' dm 'program' dm 'needs' dm 'to' dm 'know' dm 'where' dm 'to' db 'find',0 dm 1Fh,11,';' dm 'its' dm 'own' db 'image.',0 ; WORDS: ds 2 ; ; PR1FCB: db 0,'PRT COM',0,0,0,0 dw 0,0,0,0,0,0,0,0 db 0,0,0 PR2FCB: db 0,'PRT COM',0,0,0,0 dw 0,0,0,0,0,0,0,0 db 0,0,0 UPTOP: ds 80h ; ; ;;;