; Patch for LHVW 1.1 to respond to DU:/DIR: under Z33/Z34/Z3PLUS/BGii ; 6/18/91 Bruce Morgen ; Assemble with Z80ASM, ZMAC, or ZAS to HEXfile, overlay with MLOAD, ; MYLOAD, or a debugger. LHVW can now be used with LUSH 1.2. This ; patch will be overwritten by LHVW data, so do NOT re-run a patched ; LHVW with GO or JUMP (the program wasn't re-entrant to begin with)! org 100h ; jp patch ; Divert LHVW to patch org 3f00h ; patch: ld a,l ; Quick 'n dirty Z3 tests or h ; (room for improvement, for sure) jr z,done ; Can't have environment at 0000h ld a,(hl) cp 0c3h ; Test for leading jump jr nz,done ; Gotta have it or it's not Z3 ld de,3 ; Offset to "Z3ENV" string add hl,de ; Add it in ld a,(hl) ; Get the byte there cp 'Z' ; Test for a "Z" jr nz,done ; Gotta have it or it's not Z3 ld a,(69h) ; Z3-parsed user code ld e,a ; To E for DOS ld c,32 ; Set user code function # call 5 ; Call it in ld a,(5ch) ; Possible drive selection ld e,a ; Into E dec e ; Adjust to zero-based ld c,14 ; Select disk function # or a ; Test for zero call nz,5 ; Call it in if not zero ld hl,80h ; Point to tail character count ld c,(hl) ; Into C ld b,h ; Now in BC inc hl ; Bump pointer inc bc ; and count ld a,':' ; Scan for colon cpir ; Z80-style jr nz,done ; Scan failure if NZ ld a,c ; Count to A ld de,82h ; Eliminate DU:/DIR: from tail ldir ld (80h),a ; Poke new count done: ld hl,200eh ; Start of LHVW code ld (101h),hl ; Assure usual failure of GO/JUMP jp (hl) ; Rejoin LHVW code end