; I/OS 'BIG' DISK BIT MAP  BUILD MODULE
;
	NAM	BMP017
;
;	REV	00.14 KRS 07/13/81	CREATED FROM IOSINIT 00.13
;	REV	00.15 KRS 07/20/81	TWO PASSES FOR LINKED CLUS
;	REV	00.16 KRS 08/18/81	CLEANUP
;	REV	00.17 SCJ 06/17/82	BAD CLUSTER #'S & PROTECTED PRINT
;		      SCJ 12/01/82	Change ICL to reference $:(DCOM)
;
	ENT	MAXU,XPSDT,BIGMP,MSDT,DIRX,BITMP,BITS,PSDT0	;00.14
	ENT	MAPRC,BMNUM,FILNM,PSDT,EDIR,SETIT,BIGDSK	;00.14
	ENT	MAXUX,FILCNT,LOGIT				;00.15
;
	EXT	CMPHL,DIV16,XSCAL,LBLSV,MOVE,MUL16,BINH4	;00.14
	EXT	NOTBG,DSKTYP					;00.15
;
DOS	EQU	5
CR	EQU	13
LF	EQU	10
DLR	EQU	'$'
SPC	EQU	20H
;
	ICL	$:BMPDEF
	ROG
	LST	NASC
;
;  SYSTEM DISK TABLE -> MAX DISKS
;	MAX DISKS * CURRENT SDT ENTRY
;
SDTFB	EQU	0	; FLAG BITS (1)
SDTSB	EQU	1	; STATUS BITS  (1)
SDTUN	EQU	2	; UNIT NUMBER  (1)
SDTTK	EQU	3	; TRACK NUMBER (1)
SDTCSZ	EQU	4	; CLUSTER SIZE (1)
SDTDUB	EQU	5	; DUCB (UNIT CONTROL BLK) (2)
SDTMDR	EQU	7	; MASTER DIR START BLK (2)
SDTMLN	EQU	9	; MSTR DIR LENGTH (ENTRIES) (1)
SDTMCL	EQU	10	; MSTR DIR LENGTH (CLUSTERS)(1)
SDTDTY	EQU	11	; CURR DIR TYPE	 (1)
SDTNAM	EQU	12	; DISK VOLUME NAME (8)
SDTMAP	EQU	20	; ALLOCATION MAP PTR  <CLUSTRS*8> (2)
SDTPTR	EQU	22	; SPECIAL AREA POINTER	  (2)
SDTCPR	EQU	24	; CURR DIR PTR (2)
SDTNCL	EQU	26	; NUMBER OF CLUSTERS ON DISK (2)
;
SDTLEN	EQU	28
;
;	FILE CONTROL BLOCK
;
FCBFT	EQU	9	; FILE TYPE
FCBEX	EQU	12	; FILE EXTENT
FCBDE	EQU	14	; DIRECTORY ENTRY NUMBER
FCBRC	EQU	15	; RECORD COUNT
FCBDM	EQU	16	; DISK MAP
FCBNR	EQU	32	; NEXT RECORD
FCBRR	EQU	33	; RANDOM RECORD (CP/M 2.0)	 02.20
;
;  DIR BYTE 0 FLAGS IN BIG DIRECTORY
;
BIGFLG	EQU	02H	; FILE IS BIG FILE		 02.14
WHALF	EQU	04H	; WHICH DM HALF IS IN FCB	 02.14
BIGFIL	EQU	02H	; THIS ENTRY IS BIG FILE	 02.14
;
;  SDT.DIRTYP FLAGS
;
BIGDIR	EQU	01H	; THIS DIR IS BIG DIR
SUBDIR	EQU	80H	; THIS IS A SUB-DIRECTORY
DBLDIR	EQU	40H	; THIS IS A DOUBLE-SIDED DISKETTE
LBLDIR	EQU	10H	; THIS DISK HAS A LABEL		 02.20
;
	EJECT
BIGDSK:	LXI	H,0
	DAD	SP
	SHLD	SAVSTK					;00.15
	LDA	MAXUX					;00.15
	ORI	80H		; SAY INTERLEAVED
	STA	MAXU					;00.15
	CALL	SETIT
	CALL	LOGIT					;00.15
	CALL	RESETX					;00.15
	CALL	BITMP
	LHLD	SAVSTK
	SPHL
	RET
;
RESETX:	LXI	D,DIRX					;00.15
	MVI	C,1AH		;SET IO ADDR
	CALL	DOS
	LHLD	PSDT0		;DIR START		 00.15
	XCHG			; BAK
	LDA	MAXU
	MOV	B,A		; UNIT
	XRA	A
	MVI	C,83H		;READ
	CALL	DOS
	LXI	D,DIRX+1				;00.15
	LXI	H,LBLSV					;00.15
	MVI	C,8					;00.15
	CALL	MOVE		; MASTER DIR LABEL	 00.15
	RET
;
BITMP:	CALL	XXXMP					;00.15
	LDA	YLINK	; COUNT OF ENTRIES		 00.15
	ORA	A					;00.15
	RZ		; IF NONE - DONE		 00.15
	STA	XLINK	; SET PASS TWO FLAG (<>0)	 00.15
	CALL	RESETX					;00.15
	CALL	XXXMP					;00.15
	LXI	D,CRLF					;00.15
	MVI	C,9					;00.15
	CALL	DOS					;00.15
	RET
;
XXXMP:	LXI	B,8192	;SIZE OF BM WORK AREA
	LXI	H,BIGMP	;WHERE
CLRLP:	MVI	M,0
	INX	H
	DCX	B
	MOV	A,C
	ORA	B
	JNZ	CLRLP
;
	LDA	DIRX+15
	STA	DRENTX					;00.10
	LXI	D,DIRX
	MVI	C,1AH
	CALL	DOS
;
	MVI	C,90H
	CALL	DOS
	LXI	H,BITS+BM$DT
	MOV	M,B
	INX	H
	MOV	M,A
	INX	H
	MOV	M,C	;SET DATE IN BITMAP REC 0 AREA
;
	LDA	DIRX+12	;CLUSTER SIZE FROM LABEL
	STA	BITS+BM$CS
	LHLD	XPSDT
	LXI	D,SDTMCL
	DAD	D	;э?яяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяD	CNMSDT	;MAP.DIR REC 0!
;
	LHLD	XPSDT
	LXI	D,SDTNCL
	DAD	D	;ADDRESS NUMBER OF CLUSTERS ON DISK
	MOV	E,M
	INX	H
	MOV	D,M	;GET IT
	XCHG
	SHLD	BITS+BM$TC
	SHLD	BMNUM
	LXI	D,768				;00.09
	CALL	CMPHL				;00.09
	PUSH	PSW				;00.09
	MVI	C,1
	LXI	D,-768
	DAD	D	;COMPUTE NR OF BITS BEYOND REC 0
	POP	PSW
	JGE	REC00	; IF < 769,1 REC	 00.09
RECMM:	LXI	D,960
	CALL	DIV16	;COMPUTE NUMBER OF EXTRAS
	MOV	A,E
	ORA	D
	JZ	RECEV	;IF ZERO, EXACT NUMBER
	INR	L
RECEV:	INR	L
	MOV	C,L
REC00:	MOV	A,C
	STA	MAPRC	;NUMBER OF RECORDS IN MAP.DIR
	MOV	L,C
	MVI	H,0	;TO HL
	LDA	BITS+BM$CS
	MOV	E,A
	MVI	D,0	;CLUSTERS TO DIVIDE
	CALL	DIV16
	MOV	A,E
	ORA	D
	JZ	CLSEV	;EVEN NUMBER OF CLUSTERS
	INR	L
CLSEV:	MOV	C,L
	LDA	MAPAD
	LXI	H,MAPAD+2
CLSET:	DCR	C
	JZ	CLSAL
	INR	A
	MOV	M,A
	INX	H
	INX	H
	JMP	CLSET
;
CLSAL:	STA	BITS+BM$RS
	LHLD	PSDT0
	XCHG
	LDA	MAXU
	MOV	B,A
	XRA	A
	MVI	C,84H
	CALL	MXCAL	;WRITE TO DISK MAYBEE		;00.15
;
	MVI	C,16
	LHLD	BITS+BM$TC	;NUMBER OF CLUSTERS
	XCHG
XTRAS:	CALL	XSBIT
	INX	D
	DCR	C
	JNZ	XTRAS
;
	LXI	H,PSDT0+2	;  EXTENDED		 00.10
	SHLD	PSDTNX					;00.10
	MVI	A,1					;00.10
	STA	SUBFST	; SET FIRST SWITCH		 00.10
;
	LXI	H,PSDT0	;DIR START
LUPEDR:	PUSH	H		; SAVE THIS ONE		 00.10
	MOV	E,M	; BYTE LOW			 00.10
	INX	H					;00.10
	MOV	D,M	; BYTE HIGH			 00.10
	XCHG						;00.10
	XRA	A					;00.10
	STA	L2FIR					;00.10
	LDA	DRENTX					;00.10
	STA	DRENTS					;00.10
	CALL	LOG2		; LOG IN DIRECTORY	 00.10
	XRA	A					;00.10
	STA	SUBFST		; NOT MAIN DIR		 00.10
	POP	H		; GET IT BACK		 00.10
	INX	H		; ADVANCE		 00.10
	INX	H		; ADVANCE		 00.10
	XCHG						;00.10
	LHLD	PSDTNX		; PAST LAST ONE		 00.10
	XCHG						;00.10
	CALL	CMPHL					;00.10
	JNE	LUPEDR		; IF NOT EQU, DO DIR	 00.10
	RET
;
;
;
LOG2:	SHLD	PSDT
	XCHG
	LDA	MAXU
	MOV	B,A
	XRA	A	;HI BYTE
	MVI	C,83H
	CALL	DOS	;READ IT
;
;	LOG IN TWO FILES
;
	LXI	H,DIRX	;ADDRESS OF BUFFER
	MVI	C,2
	LDA	L2FIR				;00.10
	ORA	A				;00.10
	JNZ	LOG3				;00.10
	MVI	A,1				;00.10
	STA	L2FIR				;00.10
	LDA	SUBFST				;00.13
	ORA	A				;00.13
	JNZ	LOG3	; NO MSG ON PRIMARY	 00.13
	яыяАяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяBITM
	RNE		; RETURN IF NOT		;00.10
;	================ DIR NAME CODE ADDED VER 00.11
	PUSH	H
	PUSH	D
	PUSH	B
	LXI	D,DM1		; REBUILDING
	MVI	C,9		; DIRECTORY
	CALL	MXCAL					;00.15
	LXI	D,9					;00.12
	XCHG						;00.12
	DAD	D
	MVI	M,'$'
	INX	D
	PUSH	D					;00.14
	LXI	H,LBLSV					;00.14
	MVI	C,8					;00.14
	CALL	MOVE					;00.14
	POP	D					;00.14
	MVI	C,9					;00.14
	CALL	MXCAL		; XXXXXXXX		 00.15
	LXI	D,CRLF
	CALL	MXCAL					;00.15
	POP	B
	POP	D
	POP	H
	JMP	LOG4Q					;00.13
;	======================= END OF DIR NAME CODE VER 00.11
LOG3:	MOV 	A,M
	CPI	0E5H
	JZ	LOG4	;DELETED FILE
LOG3D:	PUSH	H	;ENTRY
	PUSH	B	;CONTROL
	ANI	BIGFIL
	PUSH	AF	;SAVE - NZ=BIGGIE
	LDA	SUBFST					;00.15
	ORA	A					;00.15
	JZ	LOG3A	; ONLY COUNT PRIMARY		 00.15
	LDA	FILCNT					;00.15
	INR	A					;00.15
	STA	FILCNT	; ONE MORE FILE			;00.15
	LDA	DSKTYP					;00.15
	ANI	80H					;00.15
	JNZ	LOG5E	; NO BITS FOR SUB-DIR		;00.16
;
; LOGIN DISK MAP (DM) ENTRIES
;
LOG3A:	INX	H					;00.14
	SHLD	FILNM					;00.14
	DCX	H					;00.14
	LXI	B,16
	DAD	B
LOG5:	MOV	E,M	;DE=DM CLUSTER
	INX	H
	MOV	D,M	;GET HIGH HALF
	MOV	A,D	;USED?
	ORA	E
	JZ	LOG5C	;NO...
	DCX	D	;MAKE ORIGIN 0.
	CALL	SBIT	;SET BIT
	JC	LOG5C					;00.17
;
	LDA	LFLAG					;00.14
	ORA	A					;00.14
	CNZ	LNKERR					;00.14
;
	POP	PSW
	PUSH	PSW
	CNZ	LINX	;GO DO BIG FILE INDEX BLOCK
LOG5C:	INX	H
	DCR	C	;COUNT LOGGED CLUSTERS
	JNZ	LOG5
LOG5E:	POP	AF					;00.16
	POP	B
	POP	H
	JMP	LOG4
	EJECT	
;
; LOGIN BIG FILE INDEX BLOCKS
;
LINX:	PUSH	B
	PUSH	H	; HL=@DIR ENTRY
	PUSH	D	; SAVE @ALLOC VEC
;
	LXI	D,EDIR	;OTHER AREA
	MVI	C,1AH
	CALL	DOS	;SET IO ADDRESS
;
	POP	D
	CALL	DBKCP
;
	LDA	BITS+BM$CS	;CL SIZE
	PUSH	AF
;
LINX1:	PUSH	B
	PUSH	D	;DISK ADDRESS
	LDA	MAXU
	MOV	B,A
	MOV	A,C
	MVI	C,83H
	CALL	DOS	;READ RECORD
;
	LXI	H,EDIR	;BUFFER ADDRESS
	MVI	B,64	; 64 OR LESS ENTRIES
LOG6B:	MOV	E,M
	INX	H
	MOV	D,M
	INX	H
	MOV	A,E
	ORA	D
	JZ	LOG6C
;IF NOT NULL THEN ENTER ()
	DCX	D	; ORGIN 0
	CALL	SBIT	; LOGIN CLUSTER
;
	LDA	LFLAG					;00.14
	ORA	A					;00.14
	CNZ	LNKERR					;00.14
?юяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяяя	XSBPOP	D
	POP	B	;DISK ADDRESS
	LXI	H,1
	DAD	D
	XCHG
	JNC	LOG6E
	INX	B
LOG6E:	POP	AF	;A=RECORD COUNT
	DCR	A
	PUSH	AF
	JNZ	LINX1
;
	POP	AF
;
	LXI	D,DIRX
	MVI	C,1AH
	CALL	DOS	;RESET IO ADDRESS FOR REGULAR
	POP	H
	POP	B
	RET
;
	EJECT
;
;	NEXT DIRECTORY ENTRY
LOG4:	LDA	SUBFST		; FLAG FOR MAIN DIR	 00.10
	ORA	A					;00.10
	JZ	LOG40		; 0, NOT MAIN		 00.10
	LDA	DSKTYP					;00.16
	ANI	80H					;00.16
	JNZ	LOG40					;00.16
	CPI	1		; IS IT REC 0 OF MAIN	 00.10
	JEQ	LOG49		; YES, BYPASS		 00.10
	MOV	A,M		; GET FLAGS		 00.13
	CPI	0E5H		; IS IT DELETED		 00.13
	JEQ	LOG49		; YES, BYPASS		 00.13
	PUSH	H					;00.10
	LXI	D,FCBFT		; ADDRESS EXTENSION	 00.10
	DAD	D					;00.10
	MVI	A,'D'					;00.10
	CMP	M					;00.10
	JNE	NOTSUB					;00.10
	INX	H					;00.10
	MVI	A,'I'					;00.10
	CMP	M					;00.10
	JNE	NOTSUB					;00.10
	INX	H					;00.10
	MVI	A,'R'					;00.10
	CMP	M					;00.10
	JNE	NOTSUB					;00.10
	LXI	D,FCBDM-FCBFT-2	; ADDRESS CLUSTER	 00.10
	DAD	D					;00.10
	MOV	E,M					;00.10
	INX	H					;00.10
	MOV	D,M					;00.10
	PUSH	D					;00.10
;
	LHLD	XPSDT					;00.10
	LXI	D,SDTCSZ				;00.10
	DAD	D					;00.10
	MOV	E,M		; CLUSTER SIZE		 00.10
	MVI	D,0		; FOR MULTIPLY		 00.10
	POP	H		; CLUSTER # - DIR START	 00.10
	DCX	H		; RELATIVE TO 0		 00.10
	CALL	MUL16					;00.10
	LHLD	PSDT0					;00.10
	DAD	D		; START OF NEW ONE	 00.10
	XCHG						;00.10
	LHLD	PSDTNX					;00.10
	MOV	M,E					;00.10
	INX	H					;00.10
	MOV	M,D		; IN RIGHT SPOT!!!	 00.10
	INX	H					;00.10
	SHLD	PSDTNX					;00.10
;
NOTSUB:	POP	H
LOG49:	MVI	A,2		; SAY NOT 1ST REC	 00.10
	STA	SUBFST					;00.10
;
LOG40:	LXI	D,64
	DAD	D	;NEXT ENTRY
	DCR	C
	JNZ	LOG3
;
LOG4Q:	LHLD	PSDT					;00.13
	INX	H
	LDA	DRENTS
	DCR	A
	STA	DRENTS
	JNZ	LOG2
	RET						;00.10
;
;
;  DIVIDE DE BY 8
;
DIVDE8:	PUSH	B
	MOV	A,D
	RRC
	RRC
	RRC
	MOV	B,A
	ANI	1FH
	MOV	D,A
	MOV	A,B
	ANI	0E0H
	MOV	B,A
	MOV	A,E
	RRC
	RRC
	RRC
	ANI	1FH
	ORA	B
	MOV	E,A
	POP	B
	RET
;
;	BIT ADDRESSING
;	NUMBERED FROM 7 TO BIT 0 (0..7)
;	ENTRY: DE=BIT(0..65535)
;	RETURNS: HL=BYTE, A=MASK
;
SBIT:	PUSH	H
	PUSH	D
	LHLD	BMNUM				;00.17
	CALL	CMPHL				;00.17
	JLT	SBIT1				;00.17
; Bad cluster #, value out of range error	 00.17
	LDA	XLINK				;00.17
	ORA	A				;00.17
	JNZ	SBIT2	;no msg on pass 2	 00.17
;						 00.17
	LXI	H,OUTMSG			;00.17
	CALL	PRTERR				;00.17
SBIT2:	STC					;00.17
	POP	D				;00.17
	POP	H				;00.17
	RET					;00.17
;
XSBIT:	PUSH	H				;00.17
	PUSH	D				;00.17
SBIT1:	LDA	XLINK		; CHECK PASS		 00.15
	ORA	A					;00.15
	CNZ	SETZZ		; IF PASS TWO		 00.15
	CALL	DIVDE8	;MAKE BIT BYTE
	LXI	H,BIGMP
	DAD	D	;HL=A (BYTE)
	POP	D
	MOV	A,E
MBITX:	ANI	7	;DEVELOP MASK FOR BIT
	PUSH	H
	PUSH	D
	LXI	H,BTAB
	MOV	E,A
	MVI	D,0
	DAD	D
	MOV	A,M
	POP	D
	POP	H
;
	PUSH	PSW					;00.14
	ANA	M					;00.14
	STA	LFLAG					;00.14
	POP	PSW					;00.14
;
	ORA	M	;OR IN BIT
	MOV	M,A
	POP	H
	RET		; CY = 0 : No Error		 00.17
;
BTAB:	DB	80H,40H,20H,10H,8,4,2,1
;
SETZZ:	PUSH	H	;======= ROUTINE ADDED AT REV	 00.15
	PUSH	D
	PUSH	B
	CALL	CHKTBL
	LXI	H,LNKMSG				;00.17
	CZ	PRTERR		; DO ERR MSG IF FOUND
	POP	B
	POP	D
	POP	H
	RET
;
CHKTBL:	LDA	YLINK
	LXI	B,ZLINK
SETZ0:	PUSH	PSW		; COUNT
	LDAX	B
	MOV	L,A
	INX	B
	LDAX	B
	INX	B
	MOV	H,A
	CALL	CMPHL
	JEQ	POPRZR
	POP	PSW
	DCR	A
	JNZ	SETZ0
	CPI	-1		; CAN'T BE EQUAL
	RET			; FORCE NON-ZERO
;
POPRZR:	POP	B		; STACK ADJUSTMENT
	RET			; ======== END ADDED AT	 00.15
;
LOGIT:	LDA	MAXUX					;00.09
	MOV	B,A					;00.09
	MVI	A,-1		; FORCE FLUSH!!		 00.09
	MVI	C,8BH		; HOME WILL FLUSH BFR	 00.09
	CALL	DOS
	LDA	MAXUX		;WITHOUT INTERLEAVED BIT 00.05
	MOV	E,A		;UNIT
	DCR	E
	MVI	C,0CH		;UNLOG DISK		 00.06
	CALL	DOS					;00.06
	LDA	MAXUX
	MOV	E,A
	DCR	E					;00.06
	MVI	C,0A0H		;MOUNT (FORCE LOG)
	CALL	DOS
	LXI	D,SDTDTY
	LHLD	XPSDT
	DAD	D		;ADDRESS DIRECTORY TYPE
	MOV	A,M
	RRC
	JNC	NOTBG
	RLC
	RLC
	JC	NOTBG
	RET
;
SETIT:	LDA	MAXUX		; WITHOUT BIT		 00.05
	MOV	E,A		; UNIT
	DCR	E
	MVI	C,0CH		; LIFT HEAD/DESELECT	 00.05
	CALL	DOS					;00.05
	LDA	MAXUX
	MOV	B,A
	MVI	C,8BH		; HOME DRIVE
	CALL	DOS
	LXI	D,DIRX		; BUFFER ADDRESS
	MVI	C,1AH		; SET
	CALL	DOS
	LXI	D,SDTMDR	; DIR START BLOCK
	LHLD	XPSDT
	DAD	D		; ADDRESS OF DIR START
	MOV	E,M
	INX	H
	MOV	D,M		; DE = DIR START BLOCK
	XCHG
	SHLD	PSDT		; SAVE IT!
	SHLD	PSDT0
	RET
;
LNKERR:	LDA	XLINK
	ORA	A
	RNZ			; PASS 2 - NO-OP
	PUSH	H
	PUSH	D
	PUSH	B
	LDA	YLINK		; COUNT SO FAR
	CPI	128
	JEQ	LNKRET		; ENOUGH - GIVE UP
	CALL	CHKTBL
	JZ	LNKRET		; RETURN IF FOUND
	LDA	YLINK
	INR	A
	STA	YLINK
	MOV	L,A
	MVI	H,0
	DAD	H		; TIMES 2 FOR ENTRY
	LXI	B,ZLINK-2	; SPOT
	DAD	B
	MOV	M,E
	INX	H
	MOV	M,D
LNKRET:	POP	B
	POP	D
	POP	H
	RET
;
;	print cluster error message
;	DE = Cluster (origin 0)
;	HL = Message pointer
;	renamed & changed 00.17
PRTERR:	PUSH	B				;00.15
	PUSH	D				;00.17
	XCHG					;00.17
	MVI	C,9				;00.17
	CALL	DOS				;00.17
;
	POP	B	; POP DE INTO BC
	PUSH	B
	INX	B	; ADJUST (REL TO 1)
	LXI	H,LNKBLK
	CALL	BINH4	; PUT BLOCK NUMBER IN LINE
	LXI	D,LNKBLK			;00.17
	MVI	C,9
	CALL	DOS
;
	LHLD	FILNM	; GET POINTER TO FILE NAME
	MVI	B,11				;00.17
	MVI	C,2				;00.17
    .DO						;00.17
	MOV	A,M				;00.17
	ANI	7FH				;00.17
	CPI	SPC				;00.17
	JGE	.NEXT				;00.17
	MVI	E,'^'				;00.17
	CALL	DOS				;00.17
	MOV	A,M				;00.17
	ANI	7FH				;00.17
	ORI	'@'	; convert to letter	 00.17
    .NEXT					;00.17
	MOV	E,A				;00.17
	CALL	DOS				;00.17
	INX	H				;00.17
	DCR	B				;00.17
	JNZ	.DO				;00.17
    .UNTIL					;00.17
;
	LXI	D,DIRXX
	MVI	C,9
	CALL	DOS
;
	LXI	D,LBLSV
	MVI	C,9
	CALL	DOS
;
	POP	D
	POP	B
	RET
;
DBKCP:	LDA	BITS+BM$CS	;CLUSTER SIZE
	MOV	C,A
	MVI	B,0
;
;	BCDE := DE * BC
;
	LXI	H,0
	MVI	A,16
MUL32A:	PUSH	PSW
	DAD	H
	MOV	A,E
	RAL
	MOV	E,A
	MOV	A,D
	RAL
	MOV	D,A
	JNC	MUL32B
	DAD	B
	JNC	MUL32B
	INX	D
MUL32B:	POP	PSW
	DCR	A
	JNZ	MUL32A
;
	MOV	C,E
	MOV	B,D
	XCHG
	LHLD	PSDT0
	DAD	D
	XCHG
	RNC
	INX	B
	RET
;
MXCAL:	STA	LDA01		; MAKE 'XSCAL'		 00.15
	LDA	XLINK		; CALLS ONLY ON THE	 00.15
	ORA	A		; FIRST PASS		 00.15
	MVI	A,0					;00.15
LDA01:	EQU	$-1					;00.15
	RNZ						;00.15
	JMP	XSCAL					;00.15
;
XLINK:	DB	0		; PASS SWITCH		 00.15
YLINK:	DB	0		; NUMBER OF ENTRIES	 00.15
ZLINK:	DS	256		; SAVE ENTRIES		 00.15
;
;
DM1:	DB	'Processing Sub-directory $'		;00.13
;
CRLF:	DB	CR,LF,DLR
;
OUTMSG:	DB	'Cluster out of legal range: ',DLR
LNKMSG:	DB	'Linked Cluster  ',DLR
LNKBLK:	DB	'....H on file ',DLR
DIRXX:	DB	' in directory ',DLR
;
SAVSTK:	DW	0
FILCNT:	DB	0					;00.15
FILNM:	DW	0					;00.14
LFLAG:	DB	0					;00.14
MSDT:	DW	0
BMNUM:	DW	0
DRENTX:	DB	0					;00.10
DRENTS:	DB	0
PSDT0:	DW	0
	DS	512	; SUB-DIR TABLE!!!!		 00.10
SUBFST:	DB	0	; SWITCH!!!			 00.10
PSDTNX:	DW	0	; POINTER			 00.10
L2FIR:	DB	0					;00.10
MAXUX:	DB	0
MAXU:	DB	0
XPSDT:	DW	0		; SDT ADDRESS
PSDT:	DW	0
;
DIRX:	DB	85H,'        ','   ',08,00,00,7FH
	DW	1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16
	DW	0,0,0,0,0,0,0,0
	DB	0E8H,'MAP     ','DIR',00,00,00
MAPRC:	DB	8H
MAPAD:	DW	17,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DW	0,0,0,0,0,0,0,0
;
EDIR:	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
	DB	0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H,0E5H
;
BITS:	DB	0
	DW	1,768
	DB	96
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DW	-1
	DB	8
	DB	10
	DB	0,0,0
	DB	0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
	DB	0
;
	RAM
BIGMP:	DS	8194
;
	END
