Listing 1. The modified NZCOM BIOS source code that protects¨ the Z80 alternate and index registers and that checks the¨ ENV drive vector when selecting a disk. -------------------------------------------------- ; Program: ZSNZBIO ; Author: Joe Wright / Cameron W. Cotrill ; Version: 1.2 ; Date: 26 January 1989 ; Derivation: NZBIO.Z80 version 1.5 ; This version has been modified to check the drive vector ; in the disk select routine. ; ... copyright notice and comments NAME ('BIOZ12') ; NZCOM needs 'BIO' as first ; ..three characters COMMON /_ENV_/ Z3ENV: ; Address of ENV module CCP EQU Z3ENV+3FH ; Where CCP address stored DOS EQU Z3ENV+42H ; Where DOS address stored DRVEC EQU Z3ENV+34H ; Drive vector address COMMON /_CBIO_/ CBIOS: ; Address of real BIOS CSEG ; ... section with equates omitted ; Beginning of NZBIO. The header structure is absolutely ; crucial to the correct operation of NZ-COM. ; ---> DO NOT CHANGE IT <--- START: JP BOOT ; Cold boot WBOOTE: JP WBOOT ; Warm boot JP CONST ; Console status JP CONIN ; Console input ;... rest of jump table JP IWRITE ; Write JP LISTST ; List status JP ISECTR ; Sector translation DS (30-17)*3 ; Room for 13 extra jumps SIGN: DB 'NZ-COM' ; ID for NZCOM BIOS USER: DB 0 ; User area for CCP file ZCFCB: DB 1,'NZCOM CCP',0,0,0,0 DS 17 ; ...auxillary jumps for IOP (omitted) ; END OF HEADER ; The following code is free-form and may be moved around ; ... coldboot code (omitted) ; Warm Boot Entry WBOOT: ;... some of code omitted LD DE,(USER) ; Log into user area where LD C,GSUSR ; NZCOM.CCP is kept CALL NZDOS XOR A LD (ZCFCB+32),A ; Clear current record LD C,OPENF CALL NZFIL ; Open NZCOM.CCP LD HL,(CCP) ; Load it at CCP ; Read NZCOM.CCP to (CCP) until end of file (code omitted) ; ... BDOS service routines (omitted) ; The following calls build a shell around BIOS calls and ; preserve the IX, IY, and alternate registers as required ; by ZSDOS and ZDDOS (and common sense). ICONST: LD A,6 JR DOBIOS ICONIN: LD A,9 JR DOBIOS ; ... similar code for other functions omitted ISECTR: LD A,48 DOBIOS: LD HL,CBIOS ADD A,L LD L,A ; Never a carry from this EXX ; Swap to alternate reg's LD (HLP),HL ; Save alternate registers LD (DEP),DE LD (BCP),BC LD (IXREG),IX ; Save index registers LD (IYREG),IY EXX ; Swap back EX AF,AF' ; Save alternate PSW also PUSH AF EX AF,AF' CALL JPHL ; Do BIOS call EXX ; Swap to alternates LD HL,(HLP) ; Restore them LD DE,(DEP) LD BC,(BCP) LD IX,(IXREG) ; Restore index registers LD IY,(IYREG) EXX EX AF,AF' POP AF ; Restore alternate PSW EX AF,AF' RET ; Return to caller ; Special routines are coded here. ISELDK: LD HL,(DRVEC) ; Get drive vector LD A,16 ; Get 16-drive into B SUB C LD B,A ISELDSK1: ADD HL,HL DJNZ ISELDSK1 LD HL,0 ; Value for invalid drive RET NC ; Return if invalid drive LD A,27 ; Otherwise, use CBIOS JR DOBIOS ; ... area for saving register contents (not shown) ; End of NZBIO