; Patch: SD301PT.Z80 ; Version: 2, September 4, 1990, fixed bug in clear screen Bruce Morgen ; Author: Bruce Morgen, May 9, 1989 ; For: SDD Version 3.01 as distributed with Dosdisk ; by Bridger Mitchell (aka Plu*Perfect Systems) ; Purpose: Change help and option syntax to Z-System ; conventions, respond to Z-System Named ; Directory specifications, obtain MaxDisk, ; MaxUser, Clear Screen, HiLight On, HiLight ; Off from ZCPR3 ENV/TCAP. ; Notes/Bugs: Z80 CPU and ZCPR 3.3 compatibility (ENV pointer ; must be passed from the CCP) required, only one ; whitespace character permitted before option ; delimiter, no ENV drive vector support. tpa equ 0100h start equ 01d2h patch equ 0e20h org tpa jp patch2 ; Do init. code first. org 181h db '/' ; New delimiter org 189h db '/' ; New help char. org 1c4h db '//' ; Change to "/V" msg. org patch ld a,(de) ; Get FCB drive byte. or a ; Test for current drive. jr nz,notcur ; If not, use as-is. cpl ; Otherwise flip to 0FFh. notcur: ld b,a ; Drive in B push hl ; Save tail pointer ld hl,13 ; Offset to Z3 user code add hl,de ; Add it into HL. ld c,(hl) ; Put user in C. pop hl ; Tail pointer recovered toknlp: ld a,(hl) ; Get char. cp ' '+1 ; Spacey? inc hl ; Bump pointer jr nc,toknlp ; Loop if non-spacey. ret ; Return, "parse" completed. patch2: sub a ; Cheap Z80-equivalency test ret pe ; Give up on 808x holdouts. ld a,(hl) ; Get 1st ENV byte. sub 0c3h ; Must be a JP opcode ret nz ; Otherwise give up. ld de,001bh ; Offset to ENV pointer in ENV ex de,hl ; Swap registers. add hl,de ; Add offset into HL. ld a,(hl) ; Read address into HL. inc hl ld h,(hl) ld l,a sbc hl,de ; Compare to what CCP passed us. ret nz ; Give up if bogus. ld hl,002ch ; Offset to maximum drive byte add hl,de ; Add it in ld b,(hl) ; Into B inc hl ; Point to maximum user byte ld c,(hl) ; Into C ld hl,014eh ; SDD's maximum drive byte ld (hl),b ; Overwrite with ENV's ld b,16 ; Count for SDD's many maxusers muloop: inc hl ; Bump pointer ld (hl),c ; Do one djnz muloop ; Do 'em all ld hl,0097h ; Offset to TCAP CLS string add hl,de ; Add it to ENV pointer ld bc,0136h ; SDD's CLS lives here call vidmov ; Move 'em out ld a,2 ; We must skip two strings. skloop: inc (hl) ; Skip away dec (hl) inc hl jr nz,skloop dec a jr nz,skloop ld c,3eh ; SDD's Start-HiLight (B=1) call vidmov ; Move in ENV stuff. ld c,46h ; SDD's End-HiLight (B=1) call vidmov ; Do that too. jp start ; Rejoin SDD mainline code. vidmov: ld a,(hl) ld (bc),a inc hl inc bc or a jr nz,vidmov ret end