;
; GENERAL DISK HANDLER
;	REV 01.00 RLR 3/78
;	REV 01.01 RLR 5/78
;	REV 01.02 RLR 7/13/78
;	REV 02.14 KRS 7/80 ATRIB BYTE
;	rev 02.20 krs 7/80 cp/m 2.0 compatibility
;	REV 02.23 KRS 9/80 CP/M JUMP TABLE I/O MADE NATIVE!!!
;	rev 02.35 dew 10/19/81 	macros added
;	rev 02.36 rlr 12/28/81 C3 special error handling
;	rev 02.37 krs 2/82 generalize, subdirs
;	REV 02.39 KRS 5/82 SD TRACKS ON DD DISK - HANDLE!
;	rev 02.40 sbw 8/5/82 Fix bug in READ/WRITE, GENxxx entries
;       rev 02.41 blc 11/02/82 ROMable version.
;
	icl	pdef		;02.39
	icl	df		;02.39
	df.dos			;02.39
	df.cpu			;02.39
	df.sys			;02.39
;
	nam	DVR239
;
C3VER	EQU	0
;
	ENT	dostk			;02.14          ;02.41
	ENT	ASDTE,GTSDT,GTDUCB,CSDTE
;    
;       three lines are removed.                ;02.41
;
        ent     home,seldsk,settrk,setsec       ;02.41
        ent     setdma,read,write,sectrn        ;02.41
;
	EXT	CIN,COUT,DSKBIT,ABIT		;02.37
	EXT	SYABT,URREG,RBOOT		;02.35
	EXT	NEGHL,CMPHL			;02.39
	ext	getfree,brelse,abort				;02.40
    ifc	SYSUCB=SINGLE
	EXT	?UDBF,?UDEV,?UOPT
	ext	?uchr						;02.40
    elsec
	EXT	ADUCB,SVCRG,RDUCB
    endc
;----------------------------------------------------
;	cp/m compatible jump table here!!!!!!
;
        ram                     ;02.41
        ds     80
dostk:	dw     0
;
        rog
;       cp/m compatible jump table is moved
;       to the routine 'IOSRAM'.                        ;02.41
;
SELDSK:	PUSH	B
	ADRUCB	DEV					;02.35
	POP	B
	MOV	M,C	; UCB.MSTR DEV:=DISK
	RET
;
SETTRK:	MOV	A,C
	STA	CPTRK
	MOV	A,B		; 2-BYTE TRACK NOW	;02.23
	STA	CPTRK+1					;02.23
	RET
;
SETSEC:	MOV	A,C
	STA	CPSEC
	RET
;
SETDMA:	MOV	D,B
	MOV	E,C
	JSDEUCB	DBF	; UCB.BUFF:=DMA BUFFER	;02.35
;
HOME:	LXI	H,0				;02.23
	SHLD	CPTRK	; TRK:=0		 02.23
	LHLUCB	DEV				;02.35
	MOV	B,L	; B:=UCB.DISK
	MVI	a,0	; C:=CMD HOME		 02.37
	MOV	C,A				;02.37
	JMP	DSKIO
;
READ:	MVI	A,4
	BR	CPMX				;02.35
;
WRITE:	MVI	A,6
CPMX:	STA	GENCMD					;02.23
	LHLUCB	DBF					;02.35
	SHLD	GENBUF					;02.23
	lhlucb	dev	; Get current disk			;02.40
	mov	b,l	; into B				;02.40
	call	asdte				;02.37
	mvi	l,sdtun	; Get SDT physical unit	;02.37		;02.40
	call	gtsdt				;02.37		;02.40
	mov	b,m				;02.37
	LHLD	CPTRK
	MOV	D,L	;	A=SURFACE (0)		;02.23
	MOV	C,H	;	B=DISK			;02.23
	LDA	CPSEC	;	C=TRK H			;02.23
	MOV	E,A	;	D=TRK L			;02.23
	XRA	A	;	E=SEC			;02.23
	JMP	AFTRWH	; GO DO I/O FUNCTION		;02.23
;
; CPTRK and CPSEC moved to RAM segment 02.40
;
sectrn:	push	d		;table to hl		02.20
	pop	h		;and keep in d		02.20
	mvi	c,0		;force < 255		02.20
	dad	b		;address sector		02.20
	dcx	h		;base=1			02.20
	mov	l,m		;get it			02.20
	mvi	h,0		; is < 255		02.20
	ret			;that's all		02.20
;
;
; DISK I/O HANDLER
;	IBM FORMAT/ CPM INTERLEAVING
;	a=COMMAND :	0-HOME
;			1-LIFT HEAD
;			2-SELECT DISK
;			3-EJECT DISK
;			4-READ (PHYSICAL)
;			5-READ (INTERVEAVED)
;			6-WRITE (PHYSICAL)
;			7-WRITE (INTERVEAVED)
;			8-RETURN SIZE
;			9-FLUSH BUFFER
;			10-GET CHARACTERISTICS
;			11-FREE BUFFER (NO I/O)
;
;	B=DISK (0..14), HL=BUFFER, ADE=BLOCK(0..FFFFFF)
;
;
; RETURNS:	A=0-OK
;		  1-i/o ERR 			 02.20
;
; SIZE VALUES: DE=TOTAL CLUSTERS
;	       A =BLOCKS/CLUSTER
;	       HLBC=TOTAL BLOCKS
;
	ENT	DSKIO,CSDTE,CDUCB
	ENT	WHREDK						;02.40
	ENT	LDTRK,UEJECT
	EXT	SDT
	EXT	MUL16,DIV16,ERMSG
	EXT	DIV32
	ext	dskbit,abit			;02.20
;
;
; TABLE ACCESS ROUTINES
;
ATSDT	MAC	; AT SDT
[MVI	L,&1
	CALL	GTSDT]
;
ATDUCB	MAC	; HI,LO REG
[MVI	L,&1
	CALL	GTDUCB]
;
LDWORD	MAC	; HI,LO
[MOV	&2,M
	INX	H
	MOV	&1,M]
;
; GET FROM SDT & DUCB
;	HL=OFFSET
;
GTSDT:	PUSH	D
	XCHG
	LHLD	CSDTE
	BR	GTDUC1				;02.35
;
GTDUCB:	PUSH	D
	XCHG
	LHLD	CDUCB
GTDUC1:	MVI	D,0
	DAD	D
	POP	D
	RET
;
; SET ADR PTR TO CURRENT SDT ENTRY (B=DISK)
;
ASDTE:	PUSH	PSW
	MOV	A,B
	PUSH	H
	PUSH	D
	INR	A
	LXI	D,SDTLEN
	LXI	H,SDT
	INX	H
ASDT1:	DCR	A
	BRZ	ASDT2				;02.35
	DAD	D
	BR	ASDT1				;02.35
;
ASDT2:	SHLD	CSDTE	; (*NON-REENTRANT*)
	POP	D
	POP	H
	POP	PSW
	RET
;
;  ************ DISK HANDLER ***********
;  **** THIS CODE IS NOT RE-ENTRANT ****
;
;
DSKIO:	STA	GENCMD
	MOV	A,B
	ANI	7FH				;02.37
	STA	GENDSK
	MOV	A,C
	STA	GENBKX
	SHLD	GENBUF
	XCHG
	SHLD	GENBLK
;
;
; SET UP POINTERS
;
AGAIN:
	LXI	H,SDT
	LDA	GENDSK	; IF DISK>=SDT.MAX
	MOV	B,A	;  (FOR ASDTE)
	CMP	M
	BRlt	noerr1	; else ERROR(ILLEGAL)		 02.35
	lxi	b,8802h	;illegal command		 02.20
	BR	setm2					 02.35
noerr1:	CALL	ASDTE
	#ATSDT	[SDTDUB]
	#LDWORD	[D,E]
	XCHG
	SHLD	CDUCB	; CURRENT DISK UNIT CONTROL BLOCK
;
	#ATSDT	[SDTUN]
	MOV	A,M	
	STA	DUNIT	; DISK UNIT NUMBER
;
	LDA	GENCMD	; CASE 0..3: SPECIAL
	CPI	4
	JLT	DSPECIAL ; 4..7: IO
	CPI	8	 ; 8: SIZE
	JEQ	DSIZE
	JGE	DSPECIAL ; 9...: SPECIAL
;
	ani	02h	; 6 and 7 > non-0		 02.20
	BRz	dskiox	; read, so ok			 02.35
	lda	gendsk					 02.20
	mov	b,a	;for dskbit routine		 02.20
	call	dskbit	;				 02.20
	inx	h	; r/o bits 2 further on		 02.20
	inx	h					;02.20
	call	abit	;ready to test!			 02.20
	ana	m	; if non-0, write protected	 02.20
	BRz	dskiox					;02.35
	lxi	b,8902h	;error code			 02.20
setm2:	mvi	a,-2					;02.20
	jmp	dskerr					;02.20
;
; READ OR WRITE
;
dskiox:							;02.20
	#ATDUCB	[DUBSIZ+2]
	LXI	D,GENBKX
	MVI	B,3
CHKBLK:	LDAX	D	;IF BLOCK TOO BIG
	CMP	M
	BRC	BLKOK					;02.35
	BRNZ	BADBLK					;02.35
	DCX	D
	DCX	H
	DCR	B
	BRNZ	CHKBLK					;02.35
BADBLK:	lxi	b,8703h	;GIVE ERROR message		 02.20
	BR	setm2					;02.35
;
BLKOK:	CALL	WHREDK
	JMP	AFTRWH				       ;02.39
;
WHREDK:	#ATDUCB	[DUBSUR]
	#LDWORD	[B,C]
; BC=BLOCKS PER SURFACE
	LHLD	GENBLK				;02.39
	LDA	GENBKX		; ADE = REQUEST	 02.39
	ORA	A		; IF HIGH <> 0	 02.39
	BRNZ	WHRE01		; COMPUTE	;02.39
	PUSH	B				;02.39
	POP	D				;02.39
	XCHG					;02.39
	CALL	CMPHL		; IF B/S >= RQ	 02.39
	XCHG			   NO COMPUTE	 02.39
	MVI	E,0		; E = HIGH PART	 02.39
	BRLT	WHRE02		; EHL = 00(BLK)	 02.39
	LDA	GENBKX		; MUST COMPUTE
WHRE01:	MOV	E,A
	MVI	D,0
; EHL=REQUESTED BLOCK, D IS 0			 02.39
	CALL	DIV32
; E=SURFACE, HL=BLOCK ON SURFACE
WHRE02:	MOV	D,E	;FOR POP PSW
	PUSH	D	;SAVE SURFACE
	PUSH	H
	LXI	B,0	; TO BE ADDED TO TRK	 02.39
	#ATDUCB	[DUBSEC]			;02.39
	MOV	A,M				;02.39
	MOV	E,A	; SAVE FACTOR		 02.39
	DCR	A	; IF A =1		 02.39
	BRZ	WHRE04	; NO SD/DD GARBAGE	 02.39
	#ATDUCB	[DUBSTK]			;02.39
	#LDWORD	[B,C]	; GET SDTRKS, SIZE	 02.39
;		C IS TRKS, B IS SIZE OF EACH	 02.39
	POP	H				;02.39
	PUSH	H				;02.39
	MOV	A,H	; HIGH PART OF REQ	;02.39
	ORA	A				;02.39
	BRNZ	WHRE03	; <> 0, IS DD PART	 02.39
	MOV	A,L	; LOW PART		 02.39
	CMP	E				;02.39
	BRGE	WHRE03	; REQ >= SDSEC		 02.39
; IN SD PART OF DISK!!!	B IS SIZE OF SD TRK,	 02.39
	MOV	E,B				;02.39
	LXI	B,0	; ADDER IS 0		 02.29
	BR	WHRE05				;02.39
;
WHRE03:	MVI	B,0	; ADDER FACTOR IN BC	 02.39
;	SUBTRACT VALUE IN E FROM BLOCK #	 02.39
;	AT TOP OF STACK!!!			 02.39
	MVI	D,0				;02.39
	POP	H				;02.39
	XCHG		; FOR NEGATION		 02.39
	CALL	NEGHL				;02.39
	DAD	D				;02.39
	PUSH	H				;02.39
WHRE04:	#ATDUCB	[DUBTRK]
	MOV	E,M	;BLOCKS PER TRACK
WHRE05:	MVI	D,0
	POP	H
	CALL	DIV16
; HL=TRACK, DE=SECTOR
	DAD	B	; ADD FACTOR FOR SD/DD	 02.39
	INR	E
	PUSH	H	;TRACK
	PUSH	D	;SECTOR (BASE 1)
;
	#atsdt	[sdtdty]			;02.37
	mov	a,m				;02.37
	ani	subdir		       		;02.37
	brnz	yesint				;02.37
	lda	genbkx				;02.37
	ora	a				;02.37
	brnz	mayint				;02.37
	lhld	genblk				;02.37
	xchg					;02.37
	#atsdt	[sdtmdr+1]			;02.37
	mov	a,m				;02.37
	cmp	d				;02.37
	brlt	mayint				;02.37
	brne	noint				;02.37
	dcx	H				;02.37
	mov	a,m				;02.37
	cmp	e				;02.37
	breq	mayint				;02.37
	brge	noint				;02.37
;
mayint:	LDA	GENCMD
	ANI	1
	BRZ	NOINT				;02.35
;
;	DO INTERLEAVING
;
yesint:	#ATDUCB	[DUBITB]
	#LDWORD	[B,C]
	MOV	A,B
	ORA	c					;02.37
	BRZ	NOINT	; NONE				;02.35
	mov	a,c					;02.37
	ana	b					;02.37
	inr	a					;02.37
	brnz	NOINTA	; -1(0FFFFH)=IBM		 02.37
	LXI	B,INTER
NOINTA:	POP	H	;HL:=SECTOR
	DAD	B	; ADD PHYSICAL SECTOR
	DCX	H	; (CORRECT FOR BASE=1)
	MOV	L,M	; SECTOR:=TABLE(PHY. SEC)
	PUSH	H
NOINT:
	POP	D	;E:=SECTOR
	POP	B	;TRACK
	MOV	D,C	;D:=TRACK(LOW)
	MOV	C,B	;C:=TRACK(HIGH)
	LDA	DUNIT
	MOV	B,A	;B:=UNIT
	POP	PSW	;A:=SURFACE
	RET
;
AFTRWH:	PUSH	AF
	PUSH	B
	PUSH	D
	#ATDUCB	[DUBSET]
	#LDWORD	[D,E]
	XCHG		;HL:=@SET ROUTINE
	POP	D
	POP	B
	POP	PSW
	CALL	JUMPHL
;
DOFUNC:	ORA	A	;ERROR (>16)
	BRNZ	DSKERR				;02.35
;
	LXI	H,DIODID
	PUSH	H	; RETURN FROM DRIVER
	#ATDUCB	[DUBIO]
	#LDWORD	[D,E]
	PUSH	D
	LHLD	GENBUF	; @HL:=BUFFER
	LDA	GENCMD
	ANI	2
	RRC		; CMD.BIT 1
	MOV	C,A
	RET		; DO I/O FUNCTIONS
;
;  SPECIAL FUNCTIONS
;
DSPECIAL:
	LXI	H,DIODID
	PUSH	H
	LDA	GENCMD
; LOCAL ENTRY
DSPECX:	MOV	C,A
	MVI	A,10		; IF THIS IA A 10 CALL	;02.37
	CMP	C		; AND THE DISK IS LOGGED;02.37
	BRNE	NOT10		; THEN FORGET IT -	;02.37
	PUSH	B		; WE DON'T WANT TO	;02.37
	LDA	GENDSK		; KILL RESULT OF LABEL	;02.37
	MOV	B,A		; PROCESSING!!!		;02.37
	CALL	DSKBIT					;02.37
	CALL	ABIT					;02.37
	ANA	M					;02.37
	POP	B					;02.37
	BRZ	NOT10					;02.37
	XRA	A					;02.37
	RET						;02.37
;
NOT10:	LDA	DUNIT
	MOV	B,A	; B:=UNIT NUMBER
	#ATDUCB	[DUBSPC]
	#LDWORD	[D,E]
	PUSH	D	; DE:=ROUTINE ADR
;
	call	getfree	; HL points to a system buffer		;02.40
	pop	d						;02.40
	push	h	; Save buffer pointer			;02.40
	call	jumpde	; Call disk special routine		;02.40
	xthl  					;02.40  02.41
	push	psw	; Save return code			;02.40
	call	brelse	; Release the system buffer		;02.40
	pop	psw						;02.40
        pop     h                                      ;02.41
	ret		; Return results of disk special call	;02.40
;
jumpde:								;02.40
	push	d	; Preserve HL for routine.		;02.40
	ret							;02.40
;
JUMPHL:	PCHL
;
DIODID:	ORA	A
	RZ
;
DSKERR:	PUSH	PSW
	PUSH	H
	ADRUCB	OPT		;02.37
	MOV	A,M		;02.37
	ANI	10H		;02.37
	BRZ	DSKERB		;02.37
	POP	H		;02.37
	POP	PSW		;02.37
	MVI	A,1		;02.37
	RET			;02.37
DSKERB:	POP	H		;02.37
	POP	PSW		;02.37
	PUSH	PSW		;02.37
	PUSH	H		;02.37
	MOV	L,A	; A=ERROR CODE
	MVI	H,0
	CPI	-3	; IF A=-1 OR -2			 02.20
	BRLT	DSKER1					;02.35
	MOV	L,C	; THEN ERR:=BC (LONG);
	MOV	H,B
DSKER1:	PUSH	H
	SHLD	ERRST	;SAVE STATUS
	MOV	L,H
	SHLD	ERRCD	;THEN CODE
;
	LDA	GENDSK
	ADI	'A'
	STA	ERRDK	; PRINTABLE DISK LETTER
;
;
	LDA	GENCMD
	LXI	H,0	;BLOCK 0 IF NOT I/O
	MOV	E,L
	CPI	4	;READ OR WRITE?
	BRLT	NOBLK	;NO...				;02.35
	CPI	8
	BRGE	NOBLK					;02.35
	LHLD	GENBKX	;YES, GET BLOCK
	XCHG
	LHLD	GENBLK
NOBLK:	SHLD	ERRBLK	;SET BLOCK IN ERROR
	XCHG
	SHLD	ERRBKX
	ANI	1	;IF INTERLEAVED
;       LXI	H,2C49H	; HL:='I,'
        mvi     a,'I'                                   ;02.41
	BRNZ	DSKER2					;02.35
;	LXI	h,202ch	; ELSE HL:=', '	02.10
        mvi     a,' '                                   ;02.41
;DSKER2:SHLD	ERRTY
dsker2: sta     errty                                   ;02.41
	LXI	H,DKEM
	CALL	C3ERMSG
	POP	B
	POP	H
	POP	PSW
	CPI	-2	;ANY MSG?
	BRne	DSKER5	;NO, NONE...		 02.35
	MVI	A,80H				;02.20
	CMP	B				;02.20
	BRZ	DSKER4	;YES, USER'S...		;02.35
	LXI	H,ERRTBL
DSKER3:	MOV	A,M
	INX	H
	CPI	-1	;IF END OF TABLE
	BRZ	DSKER5	; JUST CRLF		;02.35
	CMP	B
	BRNZ	DSKER3				;02.35
dsker4:	push	h					;02.20
	lxi	h,errzzz				;02.20
	call	C3ERMSG	; flags before description	 02.20
	pop	h					;02.20
	MOV	A,M	;1ST MSG CHAR HAS 'ERROR' FLAG
	inx	h					;02.10
	PUSH	PSW
	CALL	C3ERMSG	;SEND THE ERROR TYPE
	POP	PSW
	RLC		;SEND 'ERROR'?
	BRNC	DSKER5	;NO...				;02.35
	LXI	H,ERRER
	CALL	C3ERMSG
DSKER5:	LXI	H,erryyy				;02.20
	CALL	C3ERMSG
; HOME FAULTY DISK JUST IN CASE
	MVI	A,0
	CALL	DSPECX
;
; ALLOW ERROR RECOVERY
;
	adrucb	chr	;address input character	 02.20	;02.40
	mvi	m,0					;02.20
;
dsker6:								;02.40
	lxi	h,errsbw	; Show options message		;02.40
	call	c3ermsg						;02.40
;
	CALL	CIN	; GET USER RESPONSE
;
;
;****	Rewritten 02.40	*********************************************
;
	ani	5fh	; Ensure upper case
	cpi	'R'	; Retry?
	mvi	b,-2	; (Flag a jump to AGAIN)
	lxi	h,agnm	; ("Retry" message)
	breq	..1
;
	inr	b	; (Flag a jump to ABORT)
	lxi	h,ctlc	; ("^C" message)
	cpi	3	; No: Control-C?
	breq	..1
;
	inr	b	; (Flag a non-error return)
	lxi	h,retim	; ("Ignore" message)
	cpi	'I'	; No: Ignore?
	breq	..1
;
	inr	b	; (Flag an error return)
	lxi	h,errer	; ("Error" message)
	cpi	'E'	; No: Error?
	brne	dsker6	; No: Repeat options message
;
..1:			; Option selected:
	push	b
	call	ermsgx	; Show the message
	pop	b
	inr	b	; -2 means retry?
	jm	again	; Yes: Retry WITHOUT FREEING BUFFER!
;
	dcr	b	; No: Set flags for below
	mov	a,b	; and set return condition in A
	push	psw
	mvi	a,11
	call	dspecx	; FREE THE DISK BUFFER
	pop	psw	; Restore return condition:
	jm	abort	; -1 means abort
	ret		; Else return a 0 or 1 for OK or ERROR
;
;****	End of 02.40 Rewrite	*************************************
;
ermsgx:	call	ermsg				;02.37
sejcr:	lxi	h,ejcr				;02.37
	jmp	ermsg				;02.37
;
CTLC:	DB	'^C',0				;02.37
;
AGNM:	DB	'Retry',0			;02.37
;
RETIM:	DB	'Ignore',0			;02.37
;
ERRER:	DB	' Error',0
;
;
DKEM:	DB	'Disk error ',80H
      	DW	errcd
	DB	', Drive ',082h
      	dw	errdk
	DB	': Block ',80H
       	DW	errbkx
	DB	81H
       	DW	errblk
        db      082h
        dw      errty
        db      ', Status ',080h
      	DW	errst
	DB	0	;END
        ram                                             ;02.41
errcd:  dw      0
errdk:  db      0
errbkx: dw      0
errblk: dw      0
errty:  db      0
errst:  dw      0
ejmsg1: db      0
;
        rog
errzzz:	db	13,10,'---> ',0				;02.20
erryyy:	db	' <---',0					;02.40
errsbw:	db	13,10				;02.20		;02.40
	db	'Enter R(etry), I(gnore), E(rror'	;02.20
	db	' return), or ^C(ancel) ',0		;02.20
;
;  ERROR MESSAGE TABLE
;	ENTER ERROR CODE FOLLOWED BY MESSAGE
;	IF MSB OF FIRST MSG CHAR IS ON
;	'ERROR' IS PRINTED AFTER MSG
;
ERRTBL:
	db	81h,0,'Disk not ready',0		;02.14
	db	82h,0,'Disk will not home',0		;02.20
	db	83h,80H,'Seek position',0		;02.20
	db	84h,80H,'Read',0			;02.20
	db	85h,80H,'Write',0			;02.20
	db	86h,80H,'Read after Write',0		;02.20
	db	87h,0,'Illegal block number',0		;02.20
	db	88h,0,'Illegal command',0		;02.20
	db	89h,0,'Disk is write protected',0	;02.20
	db	8Ah,0,'Disk was changed illegally',0	;02.36
	DB	-1	;END OF TABLE
;
;	INTERLEAVING TABLE
;	(IN LOGICAL SECTOR ORDER 1..26)
;
INTER:
	DB	1,7,13,19,25,5,11,17,23
	DB	3,9,15,21,2,8,14,20,26
	DB	6,12,18,24,4,10,16,22
;
; DISK SIZE
;
DSIZE:		; HLBC:=BLOCKS PER DISK
	#ATDUCB	[DUBSIZ]
	#LDWORD	[B,C]
	INX	H
	MOV	L,M
	MVI	H,0
	PUSH	H
		; DE:=CLUSTERS PER DISK
	#ATSDT	[SDTNCL]
	#LDWORD	[D,E]
		; A:=CLUSTER SIZE
	#ATSDT	[SDTCSZ]
	MOV	A,M
	POP	H
	RET
;
; SPECIAL DRIVER ROUTINES
;
;  FOR DISKS WITH OUT EJECT HARDWARE
;
UEJECT:			; CMD=3 EJECT DISK
	MVI	A,'A'
	ADD	B	; 0..14->'A'..'O'
	STA	EJMSG1
	LXI	H,EJMSG
	CALL	ermsg	; TELL OPERATOR
	CALL	CIN	; WAIT FOR RESPONSE
	XRA	A	; Return no error			;02.39
	RET
;
EJMSG:	DB	'Remove disk in drive ',082h           ;02.41
        dw      ejmsg1
       	db	', Press RETURN to continue'
ejcr:	db	13,10,0
;------------------------------------------
;ONLY OUTPUT IF NORMAL ERROR MODE
;
C3ERMSG:
	JMP	ERMSG	;02.36 THEN GIVE A MSG
;
; LOAD POINTER @HL=TRK
;
LDTRK:	#ATSDT	[SDTTK]
	RET
;
; DATA AREA
;
	ram							;02.40
	ent	gendsk,genblk,genbkx,gencmd,genbuf		;02.40
	ent	dunit,cptrk,cpsec				;02.40
;
GENDSK:	ds	1	; DISK NUMBER				;02.40
GENBLK:	ds	2	; BLOCK NUMBER				;02.40
GENBKX:	ds	2	; BLOCK NUMBER(HIGH)			;02.40
GENCMD:	ds	1	; COMMAND				;02.40
GENBUF:	ds	2	; BUFFER				;02.40
DUNIT:	ds	1	; DEVICE UNIT NUMBER			;02.40
CPTRK:	ds	2						;02.40
CPSEC:	ds	2						;02.40
;
; GLOBALS
;
CDUCB:	ds	2	; CURRENT DUCB				;02.40
CSDTE:	ds	2	; CURRENT SDT ENTRY			;02.40
;
	END
