TITLE CUSTOMIZED BIOS FOR CPM 2.2 NAME ('CBIOS3') ; VERSION 1.0 4/24/80 ; ; [IOB] IS 80H FOR OVER 56K MEMORY ; AND PARALLEL PRINTER ; ; ; SYSTEM EQUATES ; MSIZE EQU 56 ; #K OF RAM IN SYSTEM NBYTES EQU 128 ; BYTES PER SECTOR BIAS EQU 9100H ; BIAS TO START OF CCP CPMB EQU 0C400H ; BIAS + 3300H = CPMB BDOS EQU CPMB+806H ; START OF BDOS ORGADR EQU CPMB+1600H CPML EQU ORGADR-CPMB ; SIZE OF WARM LOAD NSECTS EQU CPML/NBYTES ; # SECTORS IN WARM LOAD BIOS EQU 0F000H ; ADDRESS OF PROM BIOS LOADER EQU BIOS+2DH ; ADDRESS OF LOADER NREC EQU 45H ; NUMBER OF SECTORS TO LOAD DTYP EQU BIOS+15 ; DISK TYPE ROUTINE IN DDBIOS UNIT EQU 42H ; UNIT BYTE IOB EQU 8 ; ; CP/M LINKAGES TO BIOS ; ORG ORGADR CBIOS: JP BOOT ; ENTER HERE FROM COLD BOOT WBOOTE: JP WBOOT ; WARM BOOT JP CONST ; CONSOLE STATUS JP CI ; CONSOLE INPUT JP CO ; CONSOLE OUTPUT JP LIST ; LISTING OUTPUT JP LIST ; PUNCH OUTPUT JP CI ; READER INPUT HOME: JP BIOS+24 ; RESTORE DRIVE TO TRK00 SELDSK: JP SELD ; SELECT DRIVE SETTRK: JP BIOS+30 ; SET TRACK SETSEC: JP BIOS+33 ; SET SECTOR SETDMA: JP BIOS+36 ; SET DISK TRANSFER ADDRESS READ: JP BIOS+39 ; READ A SECTOR WRITE: JP BIOS+42 ; WRITE A SECTOR JP LSTST ; READ LST DEVICE STATUS JP SECTRAN ; TRANSLATE LOG. TO PHYS. SECTOR PAGE ; ; DISK PARAMETER HEADERS FOR BDOS ; PBASE: DW 0,0 ; DISK A DW 0,0 DW DIRBUF,0 ; 8"-SS/SD DW CSV0,ALV0 DW 0,0 ; DISK B DW 0,0 DW DIRBUF,0 DW CSV1,ALV1 DW 0,0 ; DISK C DW 0,0 DW DIRBUF,0 DW CSV2,ALV2 DW 0,0 ; DISK D DW 0,0 DW DIRBUF,0 DW CSV3,ALV3 ; PAGE ; ; ; DISK PARAMETER BLOCK(S) ; ; 8" SINGLE-SIDED SINGLE DENSITY ; ; UODUB: DW 26 ; SECTORS/TRK DB 3 ; BLOCK SHIFT FACTOR (BSH) DB 7 ; BLOCK MASK (BLM) DB 0 ; EXTENT MASK (EXM) DW 242 ; DISK SIZE-1 (#BLOCKS) (DSM) DW 63 ; MAX DIR ENTRY # (DRM) DW 0C0H ; DIRECTORY ALLOCATION DW 16 ; CHECK SIZE (CKS) DW 2 ; TRACK OFFSET (OFF) ; ; 8" DOUBLE-SIDED SINGLE DENSITY ; U1DUB: DW 52 DB 4,15,1 DW 246,127,0C0H,32,1 ; ; 5" SINGLE-SIDED SINGLE DENSITY ; U2DUB: DW 18 DB 3,7,0 DW 71,53,0C0H,14,3 ; ; 5" DOUBLE-SIDED SINGLE DENSITY ; U3DUB: DW 36 DB 3,7,0 DW 149,53,0C0H,14,2 ; ; 8" SINGLE-SIDED DOUBLE DENSITY ; U4DUB: DW 50 DB 4,15,1 DW 234,127,0C0H,32,2 ; ; 8" DOUBLE-SIDED DOUBLE DENSITY ; U5DUB: DW 100 DB 5,31,3 DW 237,251,0C0H,63,2 ; ; 5" SINGLE-SIDED DOUBLE DENSITY ; U6DUB: DW 29 DB 3,7,0 DW 118,63,0C0H,16,3 ; ; 5" DOUBLE-SIDED DOUBLE DENSITY ; U7DUB: DW 58 DB 4,15,1 DW 122,127,0C0H,32,2 ; ; ; SECTOR TRANSLATION TABLES FOR BDOS ; ; INT8S: DB 1,7,13,19,25,5,11,17,23,3,9,15,21,2,8,14,20,26 DB 6,12,18,24,4,10,16,22,27,33,39,45,51,31,37,43,49 DB 29,35,41,47,28,34,40,46,52,32,38,44,50,30,36 DB 42,48 INT5S: DB 1,5,9,13,17,3,7,11,15,2,6,10,14,18,4,8,12,16,19 DB 23,27,31,35,21,25,29,33,20,24,28,32,36,22,26,30,34 INT8D: DB 1,7,13,19,25,31,37,43,49,5,11,17,23,29,35,41,47 DB 3,9,15,21,27,33,39,45,2,8,14,20,26,32,38,44,50 DB 6,12,18,24,30,36,42,48,4,10,16,22,28,34,40,46,51 DB 57,63,69,75,81,87,93,99,55,61,67,73,79,85,91,97 DB 53,59,65,71,77,83,89,95,52,58,64,70,76,82,88,94 DB 100,56,62,68,74,80,86,92,98,54,60,66,72,78,84,90,96 INT5D: DB 1,5,9,13,17,21,25,29,4,8,12,16,20,24,28,3,7,11,15 DB 19,23,27,2,6,10,14,18,22,26,30,34,38,42,46,50,54 DB 58,33,37,41,45,49,53,57,32,36,40,44,48,52,56,31,35 DB 39,43,47,51,55 PAGE ; ; ; ENTER HERE AFTER COLD BOOT ; THIS OCCURS ONLY WHEN BOOTING ; FOLLOWING A SYSTEM RESET. ; ; BOOT: LD HL,SMSG CALL PRMSG ; PRINT SIGN-ON MESSAGE LD A,80H ; I/O BYTE LD (IOB),A XOR A LD (4),A ; SET DEFAULT DRIVE TO A JP GOCPM ; DTYPE: JP DTYP ; ; ENTER HERE FOR WARM BOOT ; ; WBOOT: LD SP,80H LD BC,CPMB ; SET UP BOOT ADDRESS CALL SETDMA LD A,NSECTS LD (NREC),A ; SET UP # OF SECTORS TO BOOT XOR A LD (LOG),A LD C,0 CALL SELDSK ; SELECT DRIVE A LD C,0 CALL SETTRK ; SELECT TRACK 00 LD C,2 CALL SETSEC ; SELECT SECTOR 2 CALL LOADER ;LOAD IN CP/M LESS CBIOS JP NZ,WERR ; IF ERROR, JUMP ; ; ; GOCPM: LD A,0C3H ; SET UP CP/M SYSTEM LINKS LD (0),A LD HL,WBOOTE LD (1),HL ; WARM BOOT LINK LD (5),A LD HL,BDOS LD (6),HL ; BDOS LINK LD BC,80H CALL SETDMA ; DEFAULT BUFFER ADDRESS LD A,(4) ; GET CURRENT DRIVE NUMBER LD C,A JP CPMB ; JUMP TO CCP ; ; WERR: LD HL,ERMSG CALL PRMSG ; PRINT ERROR MESSAGE HALT ; ; ; PRMSG: LD A,(HL) ; FETCH TEXT OR A RET Z ; END ON NULL LD C,A CALL CO ; PRINT A CHARACTER INC HL ; POINT TO NEXT JP PRMSG ; ; ; THIS TABLE IS USED FOR SIGN-ON MESSAGES ; ; ; SMSG: DB 26H,0DH,0AH DB '56K CP/M VERS 2.2' DB 0DH,0AH,0 ERMSG: DB 'WARM BOOT ERROR, HALT' DB 0DH,0AH,0 ; ; ; NON-DISK I/O DRIVERS ; SRDATA EQU 7CH ; SERIAL DATA PORT SRSTAT EQU 7DH ; SERIAL STATUS PORT CDATA EQU 0 ; CONSOLE DATA PORT CSTAT EQU 1 ; CONSOLE STATUS PORT RXMSK EQU 2 ; SERIAL RX RDY MASK TXMSK EQU 1 ; SERIAL TX RDY MASK SDATA EQU 2 ; SERIAL PRINTER DATA SSTAT EQU 3 ; SERIAL PRINTER STATUS SMASK EQU 1 ; SERIAL PRINTER MASK PSTAT EQU 7FH ; PARALLEL STATUS PDATA EQU 7EH ; PARALLEL DATA PMASK EQU 1 ; PARALLEL MASK ; ; CONST: IN A,(CSTAT) AND RXMSK RET Z LD A,0FFH RET ; CI: CALL CONST JR Z,CI IN A,(CDATA) AND 7FH RET ; CO: IN A,(CSTAT) AND TXMSK JR Z,CO LD A,C OUT (CDATA),A RET ; ; LIST: LD A,(IOB) BIT 6,A JR Z,PARAL LD C,SDATA LD D,SMASK JR SERIAL PARAL: LD E,C LD C,PDATA LD D,PMASK BIT 7,A JR Z,PARAL1 LD B,2 JR PLST PARAL1: LD B,0 PLST: CALL LSTST JR Z,PLST LD A,E OUT (C),A INC C LD A,B OUT (C),A INC A OUT (C),A RET SERIAL: CALL LSTST JR Z,SERIAL LD A,E OUT (C),A RET ; LSTST: INC C IN A,(C) DEC C AND D XOR D JR NZ,NOTOK DEC A RET NOTOK: XOR A RET ; ; SECTRAN: EX DE,HL ; HL=TABLE ADDRESS ADD HL,BC ; ADD LOGICAL SECTOR TO TABLE ADDR LD L,(HL) ; FETCH PHYSICAL SECTOR # LD H,0 ; CLEAR MSB RET PAGE ; ; SELD: CALL BIOS+27 LD B,1 ; SEE IF DISK LOGGED ON INC C DEC: DEC C JR Z,CHK ; BIT SET FOR DRIVE RLC B ; BIT0=A,BIT1=B,BIT2=C,ETC. JR DEC CHK: LD A,(LOG) ; LOCATION OF LOG MAP AND B JR NZ,LOGD ; ALREADY LOGGED LD A,(LOG) OR B LD (LOG),A LD A,(UNIT) PUSH AF ; SAVE NUMBER CALL DTYPE ; IF NOT LOGGED, DO DTYPE LD A,(UNIT) ; NEW UNIT BYTE FROM DTYPE RRCA RRCA RRCA RRCA AND 0FH ; UPPER 4 BITS GIVE TYPE LD B,0 LD C,A LD HL,DUBTBL ADD HL,BC ; POINT TO DUB TABLE ADD HL,BC ADD HL,BC ADD HL,BC LD E,(HL) ; PUT INTERLEAVE INC HL ; ADDRESS INTO DE LD D,(HL) ; REGISTER PAIR POP AF LD C,A PUSH DE ; SAVE INTERLEAVE ADDRESS INC HL LD E,(HL) ; PUT DUB INC HL ; ADDRESS INTO DE LD D,(HL) ; REGISTER PAIR LD HL,UNIT1 ; LOG-ON TABLE ADD HL,BC ; POINT TO CURRENT LD A,(UNIT) ; DRIVE LD (HL),A ; SAVE NEW DRIVE TYPE LD L,C LD H,0 ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL LD BC,PBASE+11 PUSH HL ADD HL,BC LD (HL),D DEC HL LD (HL),E POP HL LD BC,PBASE+1 ADD HL,BC POP DE LD (HL),D DEC HL ; PUT INTERLEAVE TABLE LD (HL),E ; INTO PBASE TABLE RET PAGE ; ; JUMP HERE IF DISK LOGGED IN ; LOGD: LD A,(UNIT) LD C,A INC A LD HL,UNIT1 UN: DEC A JR Z,UN1 INC HL JR UN UN1: LD A,(HL) LD (UNIT),A LD L,C LD H,0 ADD HL,HL ADD HL,HL ADD HL,HL ADD HL,HL LD DE,PBASE ADD HL,DE RET ; ; DUB ADDRESS TABLE ; DUBTBL: DW INT8S,U0DUB,INT8S,U1DUB,INT5S,U2DUB,INT5S,U3DUB DW INT8D,U4DUB,INT8D,U5DUB,INT5D,U6DUB,INT5D,U7DUB ; LOG: DS 1 UNIT1: DS 4 DIRBUF: DS 128 ; DIRECTORY SCRATCH BUFFER ALV0: DS 32 ; DISK ALLOCATION VECTORS ALV1: DS 32 ALV2: DS 32 ALV3: DS 32 CSV0: DS 64 ; CHECK VECTOR SCRATCH PAD CSV1: DS 64 CSV2: DS 64 CSV3: DS 64 END