; Program: ZCPR3 -- Rapid Install Program (Z-RIP) ; Author: Paul Pomerleau ; Version: 1.0 ; Date: June 3, 1986 ; Copyright 1986, Paul Pomerleau ; Version 1.3: fixed FCB init. bug introduced in 1.2 ; Still 1K.... Bruce Morgen, 4/4/91 ; Version 1.2 modifications by Bruce Morgen, 3/19/91 ; Supports Type 4 programs, program types reported by ; number in messages, no file write if program is ; already installed, improved filename display. Z3LIB ; no longer required for linkage. Program still 1K! VERS equ 13 BDOS equ 5 DMA equ 80h public cout extrn codend, pafdc jp START TARGET: db 'Z3ENV',1 Z3ENV: dw 00 START: ld hl,HEADER call PRINTHL ld hl,FCB ld d,h ld e,l inc de ld bc,NEXT-FCB ld (hl),b ; B = 0 ldir ; zero-fill the fcb call FINDZ3 ld de,80h ld c,26 ; DOS set DMA address function call BDOS ld a,(5dh) cp '/' ld hl,HELP jp z,PRINTHL cp ' ' jr z,NOTEMPTY ld hl,5dh ld de,MASK + 1 ld bc,8 ldir NOTEMPTY: call CODEND ld (NEXT),hl ld a,(5ch) ld (MASK),a ld (FCB),a ld a,(6dh) cp '?' jr nz,ONEUSER ld hl,(z3env) ld de,2dh add hl,de ld b,(hl) ; MAXUSER in B inc b LOOP: push bc dec b call SUSER call FIND pop bc djnz LOOP STOP: ld hl,CRLF jp PRINTHL ONEUSER: ld a,(5ch + 13) ld b,a call SUSER call FIND jr STOP SUSER: ld hl,USER call PRINTHL ld a,b call pafdc ld a,':' call COUT ld e,b ld c,32 ; DOS get/set user code function jp BDOS FIND: ld de,MASK ld c,17 ; DOS search first function call BDOS inc a ret z jr FIND2 FINDL: ld de,MASK ld c,18 ; DOS search next function call BDOS inc a jr z,PROCESS FIND2: dec a add a,a add a,a add a,a add a,a add a,a ld hl,DMA + 1 ld e,a ld d,0 add hl,de ld de,(NEXT) ld bc,11 ldir ld (NEXT),de jr FINDL PROCESS: ld hl,(NEXT) ld (hl),a ; If here, A = 0 call CODEND ld (NEXT),hl CLOOP: ld a,(hl) or a ret z ld de,FCB + 1 ld bc,11 ldir push hl ld h,d ld l,e inc de ld (hl),b ; B has a 0 from LDIR above, use ld c,22 ; B = 0, so BC now = 22 ldir ld hl,CHECKSTR call PRINTHL ld hl,FCB + 1 call PRNHL8 ld a,'.' call COUT call PRINTHL ld a,' ' ; Pad with spaces ld b,c ; C has how many from PRNHL8 PRNSPC: call COUT djnz PRNSPC ld de,FCB ld c,15 ; DOS file open function call BDOS inc a jr z,CONTINUE ld c,20 ; DOS sequential read function ld de,FCB call BDOS or a jr nz,CONTINUE ld de,TARGET ld hl,DMA + 3 ld b,5 CHECKL: ld a,(de) inc de cp (hl) inc hl jr nz,CONTINUE djnz CHECKL ld a,(hl) or a jr z,INTENV ; No Type 0 (?) cp 2 jr z,INTENV ; No Type 2 (internal ENV tool) cp 5 jr nc,INTENV ; No Type greater than 4 allowed ld hl,INSSTR ld b,a call PRINTHL ld a,b call pafdc ld hl,(DMA + 9) ld de,(Z3ENV) or a ; Clear carry, preserve A sbc hl,de ; Compare tool's pointer w/ours jr z,CONTINUE ; Don't write if identical ld hl,0 ; Init. HL for record #0 cp 4 ; Can't touch record #0 if Type 4 jr nz,NOTYPE4 ld l,2 ld (FCB + 33),hl ; Specify record #2 ld c,33 ; DOS read random function push hl push de ld de,FCB call BDOS pop de ld hl,(DMA + 9) or a ; Clear carry sbc hl,de ; Compare tool's pointer w/ours pop hl jr z,CONTINUE ; Don't write if identical NOTYPE4: ld (DMA + 9),de ; Install environment pointer ld (FCB + 33),hl ; Specify record #0 or #2 ld c,34 ; DOS write random function ld de,FCB call BDOS CONTINUE: pop hl jp CLOOP INTENV: ld b,a ld hl,INTEMSG call PRINTHL ld a,b call pafdc jr CONTINUE PRINTHL: ld a,(hl) call COUT inc hl ld a,(hl) or a jr nz,PRINTHL ret PRNHL8: ld bc,0801h ; Down count in B, pad count in C PRNHLB: ld a,(hl) and 7fh cp ' ' call nz,cout ; We can do these two 'cuz COUT jr nz,NOTSPC ; preserves AF (including flags!) inc c NOTSPC: inc hl djnz PRNHLB ret COUT: push af push bc push de push hl ld hl,(1) ld de,9 add hl,de and 7fh ld c,a call jphl pop hl pop de pop bc pop af ret JPHL: jp (hl) FINDZ3: ld hl,(1) FLOOP: ld de,103h FLOOP1: inc hl ld a,h or l jr z,NOENV ld a,(de) cp (hl) jr nz,FLOOP1 ld b,4 push hl FLOOP2: inc hl inc de ld a,(de) cp (hl) jr nz,NOMATCH djnz FLOOP2 pop de push de dec de dec de dec de ld hl,1bh add hl,de ld c,(hl) inc hl ld b,(hl) ld a,d cp b jr nz,NOMATCH ld a,e cp c jr nz,NOMATCH pop hl ld (Z3ENV),de ret NOMATCH: pop hl jr FLOOP NOENV: pop hl ld c,9 ld de,INVENV jp 5 HEADER: db 'ZCPR3 -- Rapid Install Program ' db 'v ',vers / 10 + '0','.',vers mod 10 + '0' CRLF: db 13,10,0 INVENV: db 10,'Can''t Find Environment Descriptor.$' HELP: db 10,'Finds and installs ZCPR3 programs on a specified DU or on an entire',13,10 db 'disk with information from the ZCPR3 environment in memory.',13,10 db 'No ".ENV" file is required.',13,10,10 db 'Syntax:',13,10 db ' Z-RIP [DU: or NDR:][AFN]',13,10 db 'or',13,10 db ' Z-RIP D:[AFN] * <-- For whole disk.',0 USER: db 13,10,'User ',0 CHECKSTR: db 13,10,' Checking --> ',0 INSSTR: db ' <-- Installed, Type ',0 INTEMSG: db ' <-- Unsupported ZCPR3 Program Type ',0 MASK: db 0,'????????COM' ds 24,0 dseg FCB: ds 36 NEXT: ds 2 end