.TITLE	"HARD DISK SYSTEM TRACK LOADER 1-19-84"
.PABS
;THIS WRITES CPM (FROM CCP TO THE TOP OF MEMORY) FROM
;THE TPA (980H) TO THE HARD DISK.  ON THE
;HARD DISK, THE SYSTEM RESIDES ON 
;LOGICAL SECTORS 5 TO POSSIBLY AS FAR AS THE END OF TRACK 1
;IT ASSUMES THE HARD DISK IS A: !!!!
;this version also loads the cold start loader to sector 0
;
.LOC	0100H
;
MSIZE=	62
BIOS=	(MSIZE*1024)-600H
TPACCP=	0980H
SELDSK=	BIOS+1BH
HOME=	BIOS+18H
SETSEC=	BIOS+21H
SETDMA=	BIOS+24H
WRITE=	BIOS+2AH
NSECTS=	48H	;WRITE 72 SECTORS
;
LOADER:	DI
	LXI	SP,0080H
	MVI	C,0
	CALL	SELDSK
	CALL	HOME
	MVI	B,NSECTS
	MVI	C,0
	MVI	E,0	;E HOLDS SECTOR #
	LXI	H,TPACCP - 512
LOADL:	PUSH	B
	PUSH	D
	PUSH	H
	MOV	C,E
	CALL	SETSEC
	POP	B
	PUSH	B
	CALL	SETDMA
	MVI	C,01	;PRETEND IT'S A DIRECTORY WRITE
	CALL	WRITE
	CPI	00H
	JNZ	LOADER
	POP	H
	LXI	D,128
	DAD	D
	POP	D
	POP	B
	DCR	B
	JZ	DONE
	INR	E
	JMP	LOADL
;
;
DONE:	HLT		;WE MUST HALT SINCE THE OS IS NOW BAD
	.END
