;PUBPTZ10.MAC ; ;PATCHES ZRDOS17 TO IMPLEMENT USE OF BIT 2 OF FILENAME TO DESIGNATE ;THAT FILE AS PUBLIC. ; ;Adapted from PUBPATCH.ASM by Steven Hirsch - 8/29/87 ; ; ;Installation: ; ;Generate a ZRDOS17.BIN file per instructions provided by Echelon. Set ;the BDOSBASE equate in this file to the base-page of your run-time BDOS, ;this should be the same page given to ZRDINS17. Assemble this file to ;HEX with Z80ASM, or any other Z80 assembler which does not fill unused ;address's with '0'. Note that M80 **cannot** by used for the preceeding ;reason! Install the patch: ; ; mload zrdos17.bin,pubpatzr.hex ; ;The patched file is saved out as ZRDOS17.COM. Install it in your system ;file as you would the non-modified .BIN image. ; ;The patch allows a file to be set as PUBlic by setting attribute bit 2 ;of the file name. Once set PUBlic the file can be accessed from any ;user area by other programs. Thus, an overlay file for WordStar can ;be declared as PUBlic so that it can be accessed from another user area. ;Thus, this patch works much like SETDRU. ; ; ; BDOSBASE EQU 0E400H ;patch this for your system ; ;INTERNAL BDOS LOCATIONS ; FINDNXT EQU BDOSBASE+0AFFH ; NXENTRY EQU BDOSBASE+09E5H CKFILPOS EQU BDOSBASE+0A8AH MOREFLS EQU BDOSBASE+09CFH FCB2HL EQU BDOSBASE+09B3H STFILPOS EQU BDOSBASE+09F6H SETSTAT EQU BDOSBASE+010EH SAVEFCB EQU BDOSBASE+27H COUNTER EQU BDOSBASE+26H FILEPOS EQU BDOSBASE+33H STATUS EQU BDOSBASE+0EH FNDSTAT EQU BDOSBASE+16H EXTMSK EQU BDOSBASE+4DH ; ; ; ORG (FINDNXT-BDOSBASE) + 100H ; .PHASE FINDNXT ; ; fnxt0: ld hl,0 ld (pflag),hl ;initialize PUBlic & wildcard flags ld c,h ;0 call nxentry call ckfilpos jr z,nomatch ;if done ld hl,(savefcb) ex de,hl ;de=user-fcb ld a,(de) cp 0e5h ;if getempty fn wants first jr z,fnxt1 ;..deleted file slot in directory push de call morefls pop de jr nc,nomatch ;if no more files ; fnxt1: call fcb2hl ;hl=directory fcb ld a,(counter) ld b,a ;b=count ld c,0 ;c=byte # or a ;counter=0 ==> search fn jr z,matched ;..so match every entry ; fnxt2: ld a,c ;get byte # cp 13 jr z,nxtbyt ;omit s1 byte ld a,(de) ;get user-fcb char cp '?' jr nz,fnxt3 ld (qflag),a ;flag wildcard jr nxtbyt ; fnxt3: ld a,(hl) ;get directory-fcb char cp 0e5h ;check for blank/deleted file ld a,c ;a=byte # jr z,chkext ;if a deleted file, omit user # check or a jr nz,chkext ;or if not user # byte inc hl ;else check for PUBlic file inc hl bit 7,(hl) ;..at attribute bit 2 dec hl dec hl jr z,chkext ;if not PUBlic, match on user # ; ;the file is PUBlic ; -- but is BDOS looking for an empty directory slot? ; ld a,b ;if counter=1, this is a getempty rSETest dec a jr z,fnxt0 ;..so go to next file ld (pflag),a ;else flag the file PUBlic jr nxtbyt ;.. and omit matching user # ; chkext: cp 12 ;(a=byte #) ld a,(de) jr z,tstext ;extent byte(#12) is special case sub a,(hl) ;compare the chars and 07fh ;..excluding attribute bits jr extdone tstext: push bc ;check for same extent ld c,(hl) call samext pop bc extdone: jr nz,fnxt0 ;if mismatch, get next file ; nxtbyt: inc de ;chars match, bump to next byte inc hl inc c ;byte # ++ djnz fnxt2 ;count-- ; ;here if -- counter > 1 and filename match ; ;Test for PUBlic file and wildcard combination: ; pflag EQU $+1 ;flags initially = 0, but qflag EQU $+2 ;= counter-1 if PUBlic ; = '?' (3fh) if '?' in fcb+1... ld hl,$-$ ld a,l ;if file is PUBlic and h ;..and there's a wildcard ;(3fh & 1...n) ==> NZ jr nz,fnxt0 ; ;here if -- ; a) non-PUBlic filenames match, ; b) find-all-files (searchfirst/searchnext functions ; with drive byte = '?') ; c) delete unambiguous PUBlic filename ; matched: ld a,(filepos) and 03h ld (status),a ;save its directory buffer index ld hl,fndstat ; ; ;The original cp/m 2.2 code removed below is erroneous, and causes ;BDOS Erasefile, Renamefile, Setattribute functions to return A=0 ;on success rather than the directory index (0,1,2, or 3) ;specified in the Interface Guide. ; ; ld a,(hl) ; rla ; ret nc ; xor a ; ld (hl),a ;also save it for use ret ;..by Erase, Rename, Set Attribute functs ; ; nomatch: call stfilpos ld a,255 ;0ffh jp setstat ; ; samext: push af ld a,(extmsk) cpl ld b,a ld a,c and b ld c,a pop af and b sub c and 1fh ret ; ; defs (fnxt0+0B4h) - $,0 ; ; .DEPHASE ; ; end