;**********************************************************************
;
;      Micro Resources bios for CP/M 2.2 Ver.1.0 of 3-12-81
;      These days Mike can be reached at mkaras@carousel-design.com” (March 23, 2009)
;
;**********************************************************************
;
;
; LOAD AS FOLLOWS UTILIZING DDT:
;
;	ICBIOS56.HEX
;	R4580
;
; THIS MODULE CONTAINS ALL THE INPUT/OUTPUT
; ROUTINES FOR THE CP/M SYSTEM, INCLUDING
; THE DISK ROUTINES.
;

TRUE)EQU  0FFFFH	;DEFINE VALUE OF TRUE
FALSE	EQU  NOT TRUE	;DEFINE VALUE OF FALSE


CSTAT	EQU  010H	;CONSOLE STATUS PORT.
CCOM	EQU  010H	;CONSOLE COMMAND PORT.
CDATA	EQU  011H	;CONSOLE DATA PORT.
CKBR	EQU  001H	;KEYBOARD READY BIT
CPTR	EQU  002H	;CONSOLE OUTPUT READY BIT
CNULL	EQU  0		;CONSOLE NULL COUNT.

LSTAT	EQU  042H       ;PRINTER STATUS PORT
LDATA   EQU  043H	;PRINTER DATA PORT
LPTR	EQU  001H	;PRINTER READY BIT

HLAB	EQU  8		;8 FOR HD LD AT BEG OF SEEK.
STPRAT	EQU  2		;RATE 1=6MS, 2=10MS, 3=20MS.
TDISKS	EQU  4		;TOTAL # OF AVAILABLE DISKS

DISK	EQU  0F8H	;DISK BASE ADDRESS.
DCOM	EQU  DISK	;DISK COMMAND PORT.
DSTAT	EQU  DISK	;DISK STATUS PORT.
TRACK	EQU  DISK+1	;DISK TRACK PORT.
SECTP	EQU  DISK+2	;DISK SECTOR PORT.
DDATA	EQU  DISK+3	;DISK DATA PORT.
WAIT	EQU  DISK+4	;DISK WAIT PORT.
DCONT	EQU  DISK+4	;DISK CONTROL PORT.

RTCNT	EQU  10		;RETRY COUNT.

IOBYTE	EQU  3		;ADDRESS OF I/O BYTE.
MSIZE	EQU  48		;MEMORY SIZE IN DECIMAL KILO-BYTES
BIAS	EQU  (MSIZE-20)*1024  ;BIAS FOR LARGER THAN 20K.
CCP	EQU  BIAS+3400H	;START OF CCP 2.0.
BDOS	EQU  CCP+806H	;START OF BDOS 2.0.
CPML	EQU  1600H	;LENGTH OF CPM SYSTEM-BIOS.
NSECTS	EQU  CPML/128	;NUMBER OF SECTORS IN IT.
OFFSET	EQU  2		;NUMBER OF TRACKS USED BY CP/M 2.0


	ORG  CCP+1600H		;START OF BIOS.
;
; I/O JUMP VECTOR
; THIS IS WHERE CPM CALLS WHENEVER IT NEEDS
; TO DO ANY INPUT/OUTPUT OPERATION.
; USER PROGRAMS MAY USE THESE ENTRY POINTS
; ALSO, BUT NOTE THAT THE LOCATION OF THIS
; VECTOR CHANGES WITH THE MEMORY SIZE.
;
	JMP  BOOT	;FROM COLD START LOADER.
WBOOTE:	JMP  WBOOT	;FROM WARM BOOT.
	JMP  CONST	;CHECK CONSOLE KB STATUS.
	JMP  CONIN	;READ CONSOLE CHARACTER.
	JMP  CONOUT	;WRITE CONSOLE CHARACTER.
	JMP  LIST	;WRITE LISTING CHAR.
	JMP  PUNCH	;WRITE PUNCH CHAR.
	JMP  READER	;READ READER CHAR.
	JMP  HOME	;MOVE DISK TO TRACK ZERO.
	JMP  SELDSK	;SELECT DISK DRIVE.
	JMP  SETTRK	;SEEK TO TRACK IN REG A.
	JMP  SETSEC	;SET SECTOR NUMBER.
	JMP  SETDMA	;SET DISK STARTING ADR.
	JMP  READ	;READ SELECTED SECTOR
	JMP  WRITE	;WRITE SELECTED
	JMP  LISTST	;RETURN LIST STATUS
	JMP  SECTRAN	;SECTOR TRANSLATE
;
; FIXED DATA TABLES FOR TWO-DRIVE STANDARD IBM-COMPATIBLE 8" DISKS
;
	MACLIB DISKDEF	;DISK DEFINITION MACRO LIBRARY
	DISKS  4	;TWO DISK SYSTEM
	DISKDEF 0,1,26,6,1024,243,64,64,OFFSET,(0)
	DISKDEF 1,0
	DISKDEF 2,0
	DISKDEF 3,0
;
; THIS SECTION IS EXECUTED WHENEVER RESET AND RUN
; IS PUSHED, AFTER THE COLDSTART LOADER READS IN
; THE CPM SYSTEM.
;
BOOT:	LXI  SP,80H	;SET STACK POINTER.
	MVI  A,003H	;6850 ACIA RESET
	OUT  CCOM	;RESET CONSOLE
	MVI  A,011H	;NO INTERRUPTS,8 DATA BITS,
			; NO PARITY,1 STOP BIT
	OUT  CCOM	;INITIALIZE CONSOLE PARAMETERS

	XRA  A		;CLEAR SCRATCH AREA.
	STA  IOBYTE	;CLEAR I/O BYTE.
	STA  DISKNO	;SET TO DISK 0 (A)
	MVI  C,ENDZ-STARTZ    ;GET LENGTH OF ZERO AREA.
	LXI  H,STARTZ	;GET SCRATCH ADDRESS.
BOOTL:	MOV  M,A	;PUT ZERO IN MEMORY.
	INX  H		;INCREMENT POINTER.
	DCR  C		;DECREMENT COUNTER.
	JNZ  BOOTL	;LOOP TILL DONE.
	XRA  A		;SET LATCH CODE = 00
	STA  LATCH
	CALL SETUP	;SET UP JUMPS.
	LXI  H,SMSG	;PRINT OPENING MESSAGE.
	CALL PMSG
	MVI  A,2	;2 DISK SYSTEM
	STA  NODSKS	;SAVE IT.
GOCPM:	LDA  DISKNO	;GET DISK NUMBER TO
	MOV  C,A	;PASS TO CCP IN C.
	JMP  CCP	;JUMP TO CCP.
;
; SET UP JUMPS INTO CP/M IN LOWER MEMORY.
;
SETUP:	MVI  A,0C3H	;PUT JMP TO WBOOT
	STA  0		;ADR AT ZERO.
	LXI  H,WBOOTE
	SHLD 1
	STA  5
	LXI  H,BDOS	;PUT JUMP TO BDOS
	SHLD 6		;AT ADR 5,6,7.
	LXI  H,80H	;SET DEFAULT DMA ADR.
	SHLD DMAADD
	RET		;RETURN FROM SETUP.

;
; WARM-BOOT:  READ ALL OF CPM BACK IN
; EXCEPT BIOS, THEN JUMP TO CCP.
;
WBOOT:	LXI  SP,80H	;SET STACK POINTER.
	LDA  004H	;SAVE currently logged disk
	STA  TEMP
	MVI  C,0	;SELECT DISK ZERO.
	CALL SELDSK
	CALL HOME	;MOVE TO TRACK ZERO.
	MVI  D,NSECTS	;GET # SECTORS FOR CPM READ.
	LXI  B,2	;TRACK (B)=0, SECTOR (C)=2.
	LXI  H,CCP	;GET STARTING ADDRESS.
RDBLK:	PUSH B		;SAVE B&C.
	MOV  C,B	;GO TO TRACK IN B.
	CALL SETTRK
	POP  B		;RESTORE B&C.
RBLK1:	SHLD DMAADD	;SET STARTING ADDRESS.
	CALL SETSEC	;READ STARTING AT SECTOR IN C.
	CALL READ
	DCR  D		;DECREMENT SECTOR COUNT.
	JZ   ALDON	;ALL DONE WHEN D=0.
	INR  C		;INCREMENT SECTOR NUMBER.
	MOV  A,C	;IF SECTOR NUMBER
	CPI  27		;IS NOT 27,
	JC   RBLK1	;KEEP READING ON THIS TRACK.
	MVI  C,1	;OTHERWISE, RESET SECTOR=1,
	INR  B		;INCREMENT TRACK NUMBER,
	JMP  RDBLK	;AND READ NEXT TRACK.
ALDON:	CALL SETUP	;SETUP THE PAGE ZERO JUMPS
	LDA  TEMP	;RESTORE DISK NUMBER.
	STA  DISKNO
	JMP  GOCPM	;GO BACK TO CPM.
;
; CHECK CONSOLE INPUT STATUS.
;
CONST:	IN   CSTAT	;READ CONSOLE STATUS.
	ANI  CKBR	;LOOK AT KB READY BIT.
	MVI  A,0	;SET A=0 FOR RETURN.
	RZ		;NOT READY WHEN NOT 0.
	CMA		;IF READY A=FF.
	RET		;RETURN FROM CONST.
;
; READ A CHARACTER FROM CONSOLE.
;
CONIN:	IN   CSTAT	;READ CONSOLE STATUS.
	ANI  CKBR	;IF NOT READY,
	JZ   CONIN	;LOOP UNTIL LOW
	IN   CDATA	;READ A CHARACTER.
	ANI  7FH	;MAKE MOST SIG. BIT = 0.
	RET		;RETURN FROM CONIN.
;
; WRITE A CHARACTER TO THE CONSOLE DEVICE.
;
CONOUT:	IN   CSTAT	;READ CONSOLE STATUS.
	ANI  CPTR	;IF NOT READY,
	JZ  CONOUT	;LOOP UNTIL LOW.
	MOV  A,C	;GET CHARACTER.
	OUT  CDATA	;PRINT IT.
	RET		;RETURN.

;
; SELECT DISK NUMBER ACCORDING TO REGISTER C.
;
SELDSK:	LXI  H,DISKNO	;GET ADDRESS OF OLD DISK #
	MOV  A,M	;GET OLD DISK #
	MOV  E,A	;PUT OLD DISK # IN D&E REGS.
	MVI  D,0	;
	LXI  H,TRTAB	;GET ADDRESS OF TRACK TABLE
	DAD  D		;ADD DISK # TO ADDRESS
	IN   TRACK	;READ 1771 TRACK REGISTER
	MOV  M,A	;STUFF INTO TABLE
	MOV  A,C	;GET NEW DISK #
	MOV  E,A	;PUT NEW DISK # INTO D&E REGS.
	LXI  H,TRTAB	;GET ADDRESS OF TRACK TABLE
	DAD  D		;ADD DISK # TO ADDRESS
	MOV  A,M	;GET NEW TRACK #
	OUT  TRACK	;PUT INTO 1771 TRACK REGISTER
	MOV  A,C	;GET NEW DISK NUMBER,AND UPDATE
	STA  DISKNO
	CMA
	ADD  A
	ADD  A
	ADD  A
	ADD  A
	ORI  2
	STA  LATCH	;SAVE NEW LATCH CODE.
	LXI  H,0	;RETURN 0000 IN H&L REGS. IF ERROR
	MOV  A,C	;GET ORIGINAL DISK #
	CPI  TDISKS	;BIGGER THAN # OF DISKS AVAILABLE?
	RNC		;OOPS.....
	MOV  L,C	;L REG.=DISK #
	DAD  H		;*2
	DAD  H		;*4
	DAD  H		;*8
	DAD  H		;*16
	LXI  D,DPBASE	;D&E REGS.=DISK PARAMETER BASE
	DAD  D		;H&L REGS.=BIAS OFFSET INTO TABLE
	XRA  A		;SET A = 0.
	RET		;RETURN FROM SELDSK.
;
; MOVE DISK TO TRACK ZERO.
;
HOME:	MVI  C,0	;SEEK TO TRACK ZERO.
;
; SET TRACK NUMBER TO WHATEVER IS IN REGISTER C.
; ALSO PERFORM MOVE TO THE CORRECT TRACK (SEEK).
;
SETTRK:	PUSH H		;SAVE H&L.
	LHLD LATCH	;GET NEW & OLD LATCH.
	MOV  A,L	;GET NEW LATCH.
	OUT  DCONT	;SELECT DRIVE NOW.
	STA  CLATCH	;REMEMBER CURRENT LATCH.
	CMP  H		;IS NEW SAME AS OLD?
	MVI  A,0FFH	;IF NOT, SET FLAG = FF.
	JNZ  SFLAG
	CMA		;IF NEW = OLD, FLAG = 0.
SFLAG:	STA  HLSF	;SET HEAD-LOAD/SELECT FLAG.
	POP  H		;RESTORE H&L.
	MOV  A,C	;GET NEW TRACK NUMBER.
	STA  TRK	;UPDATE OLD WITH NEW.
;
; MOVE THE HEAD TO THE TRACK IN REGISTER A.
;
SEEK:	PUSH B		;SAVE B&C.
	MOV  B,A	;SAVE DESTINATION TRACK.
	MVI  A,RTCNT	;GET RETRY COUNT.
SRETRY:	STA  SERCNT	;STORE IN ERROR COUNTER.
	IN   TRACK	;READ PRESENT TRACK NO.
	MOV  C,A	;SAVE IN C.
	MOV  A,C	;DELAY.
	CMP  B		;SAME AS NEW TRACK NO.?
	MOV  A,B	;RESTORE A FROM B.
	JNZ  NOTHR	;JUMP IF NOT THERE.
THERE:	POP  B		;RESTORE B&C.
	RET		;RETURN FROM SEEK.
NOTHR:	OUT  DDATA	;TRACK TO DATA REGISTER.
BUSY:	IN   DSTAT	;READ DISK STATUS.
	RRC		;LOOK AT BIT 0.
	JC   BUSY	;WAIT TILL NOT BUSY.
	MVI  A,14H+STPRAT+HLAB  ;GET STEP RATE, DO
	OUT  DCOM	;SEEK WITH VERIFY.
	IN   WAIT	;WAIT FOR INTRQ.
	IN   DSTAT	;READ STATUS.
	ANI  91H	;LOOK AT BITS.
	JZ  THERE	;OK IF ZERO.
	PUSH H		;SAVE H&L.
	LXI  H,SECNT	;GET ADR OF SEEK ERR CTR.
	INR  M		;ONE MORE SEEK ERROR.
	POP  H		;RESTORE H&L.
	LDA  SERCNT	;GET ERROR COUNT.
	DCR  A		;DECREMENT COUNT.
	JNZ  SRETRY	;RETRY SEEK.
	POP  B		;RESTORE B&C.
	IN   DSTAT	;READ DISK STATUS.
	ANI  91H	;LOOK AT ERROR BITS.
	JMP  ERMSG	;DO COMMON ERR MESSAGES.

;
; TRANSLATE THE SECTOR GIVEN BY BC USING THE TRANSLATE TABLE GIVEN BY DE
;
SECTRAN:MVI  B,0	;DOUBLE PRECISION SECTOR NUMBER
	XCHG		;TRANSLATE TABLE ADDRESS TO H&L REGS.
	DAD  B		;TRANSLATE SECTOR ADDRESS
	MOV  A,M	;TRANSLATE SECTOR # TO A REG.
	MOV  L,A	;RETURN SECTOR # IN L REG.
	RET		;RETURN FROM SECTRAN
;
; SET DISK SECTOR NUMBER.
;
SETSEC:  MOV  A,C	;GET SECTOR NUMBER.
         STA  SECT	;PUT AT SECT # ADDRESS.
         RET		;RETURN FROM SETSEC.
;
; SET DISK DMA ADDRESS.
;
SETDMA:  MOV  H,B	;MOVE B&C TO H&L.
         MOV  L,C
         SHLD DMAADD	;PUT AT DMA ADR ADDRESS.
         RET		;RETURN FROM SETDMA.
;
; HDLD - GET HEAD-LOAD BIT IF REQUIRED.
;
HDLD:	LDA  HLSF	;GET HEAD-LOAD FLAG.
	ORA  A		;IS A = ZERO?
	JZ   HDLD1	;HOP IF SO.
	CMA		;SET A = 0.
	STA  HLSF	;SET FLAG = 0 IF NOT.
HDLDY:	MVI  A,4	;SET BIT TO LOAD HEAD.
	RET		;RETURN FROM HDLD.
HDLD1:	IN   DSTAT	;READ 1771 STATUS.
	ANI  20H	;LOOK AT HL BIT.
	JZ   HDLDY	;LOAD IF NOT LOADED.
	XRA  A		;OTHERWISE, A=0.
	RET		;RETURN FROM HDLD.
;
; READ THE SECTOR AT SECT, FROM THE PRESENT TRACK.
; USE STARTING ADDRESS AT DMAADD.
;
READ:	MVI  A,RTCNT	;GET RETRY COUNT.
RRETRY:	STA  ERCNT	;STORE IN ERROR CTR.
	LHLD DMAADD	;GET STARTING ADR.
	MVI  A,0D0H	;CAUSE INTERRUPT.
	OUT  DCOM
	XTHL		;SOME DELAY.
	XTHL
READ3:	LDA  SECT	;GET SECTOR NUMBER.
	OUT  SECTP	;SET SECTOR INTO 1771.
	CALL HDLD	;GET HEAD-LOAD BIT?
	ADI  88H	;ADD CODE FOR READ SECT.
READE:	OUT  DCOM	;SEND COMMAND TO 1771.
RLOOP:	IN   WAIT	;WAIT FOR DRQ OR INTRQ.
	ORA  A		;SET FLAGS.
	JP   RDDONE	;DONE IF INTRQ.
	IN   DDATA	;READ A DATA BYTE FROM DISK.
	MOV  M,A	;PUT BYTE INTO MEMORY.
	INX  H		;INCREMENT MEMORY POINTER.
	JMP  RLOOP	;KEEP READING.
RDDONE:	IN   DSTAT	;READ DISK STATUS.
	ANI  9DH	;LOOK AT ERROR BITS.
	RZ		;RETURN IF NONE.
	CALL ERCHK	;CHECK FOR SEEK ERROR.
	LXI  H,RECNT	;GET RD ERR COUNT ADDR.
	INR  M		;ONE MORE ERROR.
	LDA  ERCNT	;GET ERROR COUNT.
	DCR  A		;DECREMENT COUNT.
	JNZ  RRETRY	;TRY TO READ AGAIN.
ERMSG:	STA  IOERR	;SAVE ERROR STATUS
	LXI  H,IOEMSG	;PRINT "DISK I/O ERROR"
	CALL PMSG
	MVI  A,1	;SET FOR PERM ERR MSG.
	ORA  A		;SET FLAGS.
	RET
;
; ERCHK - CHECK FOR RECORD NOT FOUND ERROR.
;
ERCHK:	MOV  D,A	;SAVE ERROR BITS IN D.
	ANI  10H	;IF RECORD NOT FOUND,
	JNZ  CHKSK	;DO A CHECK ON SEEK.
	MOV  A,D	;OTHERWISE RESTORE BITS
	ORA  A		;SET FLAGS,
	RET		;AND RETURN.
;CHECK FOR SEEK TO CORRECT TRACK,
;AND CHANGE IF NECESSARY.
CHKSK:	MVI  A,0C4H	;SEND COMMAND TO 1771
	OUT  DCOM	;TO READ ADDRESS.
	IN   WAIT	;WAIT FOR DRQ OR INTRQ.
	IN   DDATA	;READ THE TRACK ADDRESS.
	MOV  B,A	;SAVE IN REGISTER B.
CHKS2:	IN   WAIT	;WAIT FOR INTRQ.
	ORA  A		;SET FLAGS.
	JP   CHKS3	;DONE WITH READ ADR OP.
	IN   DDATA	;READ ANOTHER BYTE.
	JMP  CHKS2	;DO IT AGAIN.
CHKS3:	IN   DSTAT	;READ DISK STATUS.
	ORA  A		;SET FLAGS.
	JZ   CHKS4	;READ ADR OK IF 0.
	CALL HOME	;OTHERWISE, HOME FIRST.
	JMP  CHKS5
CHKS4:	MOV  A,B	;UPDATE TRACK REGISTER.
	OUT  TRACK
CHKS5:	LDA  TRK	;GET REQUIRED TRACK NO.
	CALL SEEK	;MOVE THE HEAD TO IT.
	MOV  A,D	;GET ERROR BITS.
	ORA  A		;SET FLAGS.
	RET		;RETURN FROM ERCHK.
;
; WRITE THE SECTOR AT SECT, ON THE PRESENT TRACK.
; USE STARTING ADDRESS AT DMAADD.
;
WRITE:	MVI  A,RTCNT	;GET RETRY COUNT.
WRETRY:	STA  ERCNT	;STORE IN ERROR COUNTER.
	LHLD DMAADD	;GET STARTING ADR.
	MVI  A,0D0H	;STATUS INTERUPT FOR 1771.
	OUT  DCOM	;COMMAND 1771.
	XTHL		;WAIT FOR STATUS.
	XTHL		;CHANGE IT BACK.
WRITE3:	LDA  SECT	;GET SECTOR NUMBER.
	OUT  SECTP	;SET THE SECTOR INTO 1771.
	CALL HDLD	;GET HEAD LOAD BIT?
	ADI  0A8H	;ADD CODE FOR WRITE.
WRITE2:	OUT  DCOM
WLOOP:	IN   WAIT	;WAIT FOR READY.
	ORA  A		;SET FLAGS.
	JP   WDONE	;HOP OUT WHEN DONE.
	MOV  A,M	;GET BYTE FROM MEM.
	OUT  DDATA	;WRITE ONTO DISK.
	INX  H		;INCREMENT MEM PTR.
	JMP  WLOOP	;KEEP WRITING.
WDONE:	IN   DSTAT	;READ DISK STATUS.
	ANI  0FDH	;LOOK AT THESE BITS.
	RZ		;RETURN IF NO ERR.
	CALL ERCHK	;CHECK/CORRECT SEEK ERR.
	LXI  H,WECNT	;GET ADR OF WRITE ERR CTR.
	INR  M		;ONE MORE WRITE ERROR.
	LDA  ERCNT	;GET ERROR COUNT.
	DCR  A		;DECREMENT COUNT.
	JNZ  WRETRY	;TRY TO WRITE AGAIN.
	MOV  A,D	;GET ERROR BITS.
	JMP  ERMSG
;
; PRINT THE MESSAGE AT H&L UNTIL A ZERO.
;
PMSG:    MOV  A,M	;GET A CHARACTER.
         ORA  A		;IF IT'S ZERO,
         RZ		;RETURN.
         MOV  C,A	;OTHERWISE,
         CALL CONOUT	;PRINT IT.
         INX  H		;INCREMENT H&L,
         JMP  PMSG	;AND GET ANOTHER.
;
; CBIOS SIGNON MESSAGE
;
IOEMSG:	DB   0DH,0AH,'Disk I/O Error',0
SMSG:	DB   0DH,0AH,'Micro Resources '
	DB   MSIZE/10+'0',MSIZE MOD 10 + '0'
	DB   'K CP/M Ver. 2.2 of 1/15/82',0
;
; WRITE A CHARACTER ON LISTING DEVICE.
;
LIST:	IN  LSTAT	;GET PRINTER STATUS
	ANI LPTR	;MASK FOR READY
	JZ  LIST	;LOOP TILL READY
	MOV A,C		;SEND CHARACTER
	OUT LDATA
	RET
;
;RETURN LIST STATUS
;
LISTST:	IN  LSTAT	;GET PRINTER STATUS
	ANI LPTR	;MASK FOR READY
	RZ		;RETURN 0 FOR NOT READY
	MVI A,01H	;RETURN 1 IF READY
	RET
;
; PUNCH PAPER TAPE, DEFAULT IS CONSOLE
;
PUNCH:	CALL CONOUT	;SEND PUNCH TO CONSOLE.
	RET		;RETURN FROM PUNCH.
;
;  NORMALLY USED TO READ PAPER TAPE.
; SET UP TO READ FROM CONSOLE IN STANDARD SYSTEM.
;
READER:	CALL CONIN	;READ FROM CONSOLE.
	RET		;RETURN FROM READER.

;NOTE:  AS THERE ARE ONLY SEVEN SECTORS
;AVAILABLE FOR CBIOS ON THE SECOND SYSTEM TRACK (1),
;THE LAST ADDRESS BEFORE THIS POINT SHOULD BE NO
;GREATER THAN THE CBIOS STARTING ADDRESS + 03FF (HEX).

;
; BIOS SCRATCH AREA.
;
TRK:	DS   1		;CURRENT TRACK NUMBER.
SECT:	DS   1		;CURRENT SECTOR NUMBER.
DMAADD:	DS   2		;DISK TRANSFER ADDRESS.
;
; THE NEXT SEVERAL BYTES, BETWEEN STARTZ AND
; ENDZ, ARE SET TO ZERO AT COLD BOOT TIME.
;
STARTZ:			;START OF ZEROED AREA.
DISKNO:	DS   1		;DISK NUMBER (TO CP/M).

;
; ERROR COUNTS.  THESE LOCATIONS KEEP TRACK OF THE
; NUMBER OF ERRRS THAT OCCUR DURING READ, WRITE,
; OR SEEK OPERATIONS.  THEY ARE INITIALIZED ONLY
; WHEN A COLD-START IS PERFORMED BY THE BOOOTSTRAP.
;
IOERR:	DS   1		;DISK I/O ERROR TYPE
RECNT:	DS   1		;READ ERROR COUNT.
WECNT:	DS   1		;WRITE ERROR COUNT.
SECNT:	DS   1		;SEEK ERROR COUNT.
;
; SPECIAL FLAGS.
;
CONOTF:	DS   1		;NO-PRINT FLAG (WHEN FF)
HLSF:	DS   1		;HEAD-LOAD SELECT FLAG.
;
; DISK TRACK TABLE FOR PRESENT POSITION OF 2 DISKS
;
TRTAB:	DS   2
;
ENDZ:			;END OF ZEROED AREA.

NODSKS:	DS   1		;NUMBER OF DISKS.
ERCNT:	DS   1		;ERROR COUNT FOR RETRIES.
SERCNT:	DS   1		;SEEK RETRY COUNTER.
TEMP:	DS   1		;TEMPORARY STORAGE.
LATCH:	DS   1		;NEW CODE FOR LATCH.
CLATCH:	DS   1		;CURRENT CODE IN LATCH.
;
; SCRATCH RAM AREA REQUIRED FOR "BDOS" USE ONLY
;
	ENDEF
;
;
;
         END
;
;
;
;+++...END OF FILE
