*************************************************************************
*
* NEWDISK
*   This source was created from NEWDISK.CMD found on a FLEX 1.0
*   disk for the SWTPC 6800 with the MF-68 floppy drive cabinet
*   (5.25" drives). FLEX 1.0 for the MF-68 is also known as MiniFLEX.
*
*   This version of FLEX uses 128 byte sectors as with the 8" drives
*   of the DMF-1 for which FLEX 1.0 was originally written. With FLEX
*   version 2.0, the format was changed to ten sectors of 256 bytes
*   instead of 18 sectors of 128 bytes.
*
*   See also the options for gap 1 and gap 4 below at the end of the
*   equates section.
*
*   Disassembled by Mike Douglas, January 2022
*
**************************************************************************

* FLEX and SWTBUG equates

WARMS	equ	$7103		;FLEX warm start entry
GETCHR	equ	$710F
PUTCHR	equ	$7112
PSTRNG	equ	$7118
PCRLF	equ	$711E
OUTDEC	equ	$7133
GETHEX	equ	$713F
FMSCALL	equ	$7806		;FMS call entry point
DWRITE	equ	$7F03		;write sector
RESTOR	equ	$7F09		;restore to track zero
OUT2HS	equ	$E0CA		;output two hex digits followed by space

* FMS Disk I/O commands

fmsREAD	equ	9		;read a sector 
fmsWRT	equ	10		;write a sector
fmsINFO	equ	7		;get info about a file
fmsSIR	equ	16		;get system information record

* Offsets into the FMS file control block (FCB)

fcbCMD	equ	0		;FMS command
fcbDRV	equ	3		;drive number
fcbFSIZ	equ	21		;FMS puts file size here
fcbCTRK	equ	30		;track of current file position
fcbCSEC	equ	31		;sector of current file position

fcbSBUF	equ	64		;the data sector is buffered here
fcbFTRK	equ	64		;track, sector link to next sector
fcbFSEC	equ	65

* System Information Record offsets (into the sector in the FCB)

sirFTRK	equ	85		;first track, sector in free chain
sirFSEC	equ	86
sirLTRK	equ	87		;last track, sector in free chain
sirLSEC	equ	88
sirCNT	equ	89		;count of sectors in free chain

* Miscellaneous equates

CR	equ	$0D
LF	equ	$0A
EOT	equ	$04

* FD1771 equates

CMDREG	equ	$8018 		;command register
TRKREG	equ	$8019 		;track register
SECREG	equ	$801A 		;sector register
DATAREG	equ	$801B 		;data register

cRESTOR	equ	$0B		;command - restore to track zero
cSEEK	equ	$1B		;command - seek to track, load head
cREAD	equ	$8C		;command - read secctor
cWRTTRK	equ	$F4		;command - write track (for formatting)

sBUSY	equ	$01		;1=1771 busy
sDRQ	equ	$02		;1=data request
sRDERRS	equ	$1C		;read error bits

* Disk equates

NUMTRK	equ	35		
NUMSEC	equ	18
SECLEN	equ	128
TOTSEC	equ	NUMTRK*NUMSEC-NUMSEC	;sectors available for data

* Layout of raw sector in the format buffer

	org	0
idMark	rmb	1		;address mark
idTrk	rmb	1		;LSB of track number
	rmb	1
idSec	rmb	1		;sector number
idSize	rmb	1		;sector length code
idCrc	rmb	1		;CRC mark
	rmb	17		;gap bytes
dataMrk	rmb	1		;data mark
fwdTrk	rmb	1		;track of the forward link
fwdSec	rmb	1		;sector of the forward link
	rmb	126		;rest of sector data
dataCrc	rmb	1		;CRC on sector data
	rmb	14		;gap bytes
RSECLEN	equ	*		;raw sector length

* Gap 1 (the post index gap) is just two bytes as formatted by this
*   program. This short gap causes problems for some newer disk 
*   controller ICs which are not able to read the 1st sector on most
*   tracks. Gap 1 was increased to 8 bytes in FLEX 2.0. The program
*   can also fail to fill gap 4 all the way to the end of the track
*   for a drive spinning slightly slow.
*
*   To generate the original code, uncomment the first two statements
*   below. To fix the gap problems, uncommment the 2nd two statements.

*GAP1	equ	2			;2 byte gap 1
*BUFLEN	equ	RSECLEN*NUMSEC+2	;track space required for format

GAP1	equ	8			;8 byte gap 1
BUFLEN	equ	RSECLEN*NUMSEC+$100 	;extra bytes for slow drives

*------------------------------------------------------------------
* Program data
*------------------------------------------------------------------
	org	$20
trkNum	rmb	1
secNum	rmb	1
badCnt	rmb	1		;count of consecutive bad sectors
drvNum	rmb	1
saveX0	rmb	2
saveX1	rmb	2
goodCnt	rmb	2		;count of good data sectors
frstTrk	rmb	1		;location of first free sector
frstSec	rmb	1
lastTrk	rmb	1		;location of last free sector
lastSec	rmb	1

*------------------------------------------------------------------
* Start of code
*------------------------------------------------------------------
	org	$0200 
STKPTR	equ	*-1		;stack grows down below code

entry	bra	start
	fcb	$01		;version

* Validate drive number and confirm format request

start	lds	#STKPTR
	jsr	GETHEX		;get drive number
	bcc	haveDrv
	jmp	abort		;invalid drive spec
	
haveDrv	stx	saveX1
	ldaa	saveX1+1	;ensure drive is 0-3
	anda	#$03
	ldx	#fmsFcb		;store in FCB
	staa	fcbDRV,x
	staa	drvNum

	ldx	#mSure		;"are you sure?"
	jsr	PSTRNG
	jsr	GETCHR
	cmpa	#'Y'
	bne	abort		;no, exit

	ldx	#mScrDsk	"scratch disk in drive"
	jsr	PSTRNG
	ldx	#fmsFcb+fcbDRV-1   ;form 16 bit drive number
	clr	0,x		;MSB is zero
	clrb			;no leading spaces
	jsr	OUTDEC		;display drive number

	ldaa	#'?'		;follow with '?'
	jsr	PUTCHR
	ldaa	#' '
	jsr	PUTCHR
	jsr	GETCHR		;confirmed?
	cmpa	#'Y'
	bne	abort		;no
	jsr	PCRLF
	
* Init for format: Restore drive to track 0 and clear track buffer

	ldx	#fmsFcb		;point to FCB
	jsr	RESTOR		;restore to track 0
	bcs	abort		;restore failed
	bne	protErr		;write protected

	ldx	#trkBuf		;zero the track buffer
clrLoop	clr	0,x
	inx
	cpx	#trkBuf+BUFLEN
	bne	clrLoop

* Loop through all 35 tracks performing a Write Track operation
*   to format each track

	clr	trkNum		;start on track zero

fmtLoop	ldx	#trkBuf+GAP1	;allow for post index gap (gap 1)
	clr	secNum

secLoop	bsr	secData		;update per-sector data
	inc	secNum
	ldaa	secNum
	cmpa	#NUMSEC
	bne	secLoop		;loop for all sectors in track

	jsr	wrtTrk		;write the track
	bra	nxtTrk		;(branch not needed)

nxtTrk	inc	trkNum		;move to next track
	ldaa	trkNum
	cmpa	#NUMTRK
	beq	chkDisk		;format done, go check the disk

	staa	trkNum		;else, move to next track and repeat
	jsr	seek
	bra	fmtLoop

abort	ldx	#mAbort		"Formatting aborted"

pgmExit	jsr	PSTRNG		;print string pointed to by X
	jmp	WARMS		;return to FLEX

protErr	ldx	#mProt		"Write protect error"
	bra	pgmExit

*------------------------------------------------------------------
* secData - Update the sector ID data and sector links
*------------------------------------------------------------------
secData	ldaa	#$FE		;write address mark
	staa	idMark,x

	ldaa	trkNum		;track number
	staa	idTrk,x

	ldab	secNum		;look up and store logical sector number
	stx	saveX0
	ldx	#skewTbl
	bsr	addB2X		;index into sector skew table
	ldab	0,x		;B=logical sector number
	ldx	saveX0

	tst	idTrk,x		;on track 0?
	bne	notTrk0		;no

	cmpb	#2		;sector 1 or 2?
	bhi	notTrk0		;no

	decb			;update 2->1 and 1->0
	stab	idSec,x
	beq	nxtSec		;next sector will be 1 (0->1)
	incb			;next sector will be 3 (1->3)
	bra	nxtSec

notTrk0	stab	idSec,x		;put sector num in address mark	

nxtSec	incb			;compute next track, sector
	cmpb	#NUMSEC+1	;past last sector on track?
	bne	setLink		;no

	inca			;move to next track
	ldab	#1		;wrap to sector 1
	cmpa	#NUMTRK		;all done?
	bne	setLink		;no, go set the forward link

	clra			;otherwise, terminate the linked list
	clrb

setLink	staa	fwdTrk,x	;set forward track:sec link
	stab	fwdSec,x
	
	ldaa	#$FB		;place data mark before user data
	staa	dataMrk,x
	
	ldaa	#$F7		;generate a CRC
	staa	idCrc,x		;  at end of address mark
	staa	dataCrc,x	;  and end of user data
	
	ldab	#RSECLEN	;increment pointer by raw sector length
addB2X	stx	saveX1
	addb	saveX1+1	;add LSBs
	stab	saveX1+1
	bcc	addExit		;no carry to MSB
	inc	saveX1		;else, add carry to MSB
addExit	ldx	saveX1
	rts

*------------------------------------------------------------------
* skewTbl - Returns logical sector number in the physical order the
*   sectors appear on disk
*------------------------------------------------------------------
skewTbl	fcb	1,4,7,10,13,16,2,5,8
	fcb	11,14,17,3,6,9,12,15,18

*------------------------------------------------------------------
* chkDisk - Format is complete. Now validate the disk and update
*   the linked list as required to bypass any bad sectors.
*------------------------------------------------------------------				
chkDisk	ldx	#TOTSEC		;assume all sectors good to begin
	stx	goodCnt

	ldx	#$0101		;first track and sector (1, 1)
	stx	frstTrk
	ldx	#$2212		;last track and sector (34, 18)
	stx	lastTrk

	ldaa	drvNum		;put drive number in the FCB
	staa	fmsFcb+fcbDRV

	clra
	staa	badCnt		;counts consecutive bad sectors
	staa	trkNum		;start with track 0, sector 0
	staa	secNum

* chkLoop - Loop through each sector to check for errors

chkLoop	bsr	readSec		;read a sector
	bne	badSec		;sector is bad
	clr	badCnt		;good clears consecutive bad count

nextSec	ldaa	trkNum		;update track, sector to next sector
	ldab	secNum
	bsr	incSec
	bne	notDone		;not past last track

	jmp	sysInfo		;else, done - go write sys info record

notDone	staa	trkNum		;track, sector of next sector
	stab	secNum
	bra	chkLoop		;repeat

* readSec - Read the sector into the FCB buffer using the FMS

readSec	ldx	#fmsFcb		;X->FCB
	ldaa	trkNum
	staa	fcbCTRK,x	;set current track
	ldaa	secNum
	staa	fcbCSEC,x	;set current sector 
	jmp	fmsRead		;do the read

*------------------------------------------------------------------
* incSec - Update track and sector in A:B to point to the
*    next sector. Exits with Z flag true if the end of
*    the disk is reached.
*------------------------------------------------------------------
incSec	incb			;increment sector number
	tsta			;track 0?
	bne	notSec2		;no

	cmpb	#2		;skip sec 2 on trk 0
	bne	notSec2
	incb			;sec 2 becomes sec 3

notSec2	cmpb	#NUMSEC+1	;end of track?
	bne	incExit		;no
	inca			;else, next track
	ldab	#1		;wrap to sector 1
	cmpa	#NUMTRK		;Z is set at end of disk
incExit	rts

*------------------------------------------------------------------
* badSec - Bypass the bad sector just read
*------------------------------------------------------------------
badSec	inc	badCnt		;count consecutive bad sectors
	beq	fatal		;too many - give up

	ldaa	trkNum		;fatal if track 0, secs 0-4
	bne	notFatl
	ldab	secNum
	cmpb	#4
	bhi	notFatl

fatal	ldx	#mFatal		;"fatal error" and exit
	jmp	pgmExit

notFatl	ldx	#fmsFcb		;X->FCB
	ldaa	frstTrk		;A=1st avail track
	ldab	frstSec		;B=1st avail sector
	cmpa	trkNum		;is first avail on this track?
	bne	remSec		;no

	cmpb	secNum		;first avail at this sector?
	bne	remSec		;no

	bsr	incSec		;skip this bad sector
	staa	frstTrk		;next sec is new first available
	stab	frstSec
	bra	dspBad		;display the failed sector error

* remSec - Bad sector not at the start of the free chain, so it must
*   be removed from within the linked list.

remSec	ldaa	trkNum		;A,B=current track,sector
	ldab	secNum
	subb	badCnt		;compute previous good sector
	beq	onPrev		;prev good not on this track
	bpl	onThis		;it was on this track

onPrev	deca			;move back to previous track
	ldab	#NUMSEC		;last sector on track

onThis	staa	fcbCTRK,x	;read the sector to link from
	stab	fcbCSEC,x
	bsr	fmsRead
	bne	fatal		;error

	ldaa	fcbFTRK,x	;point to next sector instead
	ldab	fcbFSEC,x
	bsr	incSec
	bne	updtLnk		;not end of disk

	ldaa	fcbCTRK,x	;end of disk - save last available
	ldab	fcbCSEC,x	;  track and sector
	staa	lastTrk
	stab	lastSec
	clra			;zero the forward link
	clrb			;  (end of chain)

updtLnk	staa	fcbFTRK,x	;point around the bad sector
	stab	fcbFSEC,x
	bsr	fmsWrt
	bne	fatal

* dspBad - Display the track, sector number of the bad sector

dspBad	ldx	goodCnt		;decrement total avail count
	dex
	stx	goodCnt

	ldx	#mBadSec	;"Bad sector at"
	jsr	PSTRNG
	ldx	#trkNum		;display track, sector
	jsr	OUT2HS
	jsr	OUT2HS
	jmp	nextSec

*------------------------------------------------------------------
* fmsRead - Perform a sector read using the FMS
*------------------------------------------------------------------
fmsRead	ldx	#fmsFcb
	ldaa	#fmsREAD	;read sector command
	staa	fcbCMD,x
	jmp	FMSCALL

*------------------------------------------------------------------
* fmsWrt - Perform a sector write using the FMS
*------------------------------------------------------------------
fmsWrt	ldx	#fmsFcb
	ldaa	#fmsWRT		;write sector command
	staa	fcbCMD,x
	jsr	FMSCALL
	beq	fmsRead		;verify the write
	rts

*------------------------------------------------------------------
* sysInfo - Update the System Information Record
*------------------------------------------------------------------
sysInfo	ldx	#fmsFcb		;X->FCB
	clr	fcbCTRK,x	;trk 0, sec 3 is the System
	ldaa	#3		;  Information Record
	staa	fcbCSEC,x
	jsr	fmsRead
	bne	jmpFatl

	ldx	#fmsFcb		;X->FCB
	clr	fcbFTRK,x	;clear forward link
	clr	fcbFSEC,x	;  (end of sys info data)

	ldaa	frstTrk		;set first track, sector
	ldab	frstSec
	staa	sirFTRK,x
	stab	sirFSEC,x

	ldaa	lastTrk		;set last track, sector
	ldab	lastSec
	staa	sirLTRK,x
	stab	sirLSEC,x

	ldaa	goodCnt		;set free sector count
	ldab	goodCnt+1
	staa	sirCNT,x
	stab	sirCNT+1,x

	jsr	fmsWrt		;write the sys info record
	beq	finish		;go finish up

jmpFatl	jmp	fatal

*------------------------------------------------------------------
* finish - Zero the forward link at the end of the directory,
*   write the boot loader to track 0, dispay results and exit.
*------------------------------------------------------------------
finish	ldx	#fmsFcb		;read last directory sector
	ldaa	#NUMSEC		;track 0, sector 18
	staa	fcbCSEC,x
	jsr	fmsRead
	bne	jmpFatl

	ldx	#fmsFcb		;X->FCB
	clr	fcbFTRK,x	;clear forward link
	clr	fcbFSEC,x	;  (end of directory)
	jsr	fmsWrt		;write final directory sector
	bne	jmpFatl

* Write the boot loader to track zero, sectors 0 and 1

	ldx	#BOOTIMG	;X->boot loader
	clra			;track 0
	clrb			;sector 0
	jsr	DWRITE
	bne	jmpFatl

	ldx	#BOOTIMG+SECLEN	;X->2nd 128 bytes of loader
	clra			;track 0
	ldab	#1		;sector 1
	jsr	DWRITE
	bne	jmpFatl

* Display number of free sectors available and exit

	ldx	#fmsFcb		;open the system information record
	ldaa	#fmsSIR
	staa	fcbCMD,x
	jsr	FMSCALL
	bne	jmpFatl

	ldaa	#fmsINFO	;get first info entry 
	staa	fcbCMD,x
	jsr	FMSCALL
	bne	jmpFatl

	ldx	#mFmtCmp	;"Total Sectors ="
	jsr	PSTRNG
	ldx	#fmsFcb+fcbFSIZ	;"file" size will be all free space
	clrb
	jsr	OUTDEC		;display the count 
	jmp	WARMS

*------------------------------------------------------------------
* wrtTrk - Issue the 1771 write track command to format a track from
*   the data prepared in trkBuf
*------------------------------------------------------------------
wrtTrk	ldx	#trkBuf		
	ldaa	#cWRTTRK	;1771 Write Track command
	staa	CMDREG
	jsr	delay

wrtLoop	ldaa	CMDREG		;loop waiting for data requests
	bita	#sDRQ
	bne	wrtByte		;time to write a byte
	
	bita	#sBUSY		;still busy?
	bne	wrtLoop		;yes
	bra	wrtExit		;else, done

wrtByte	ldaa	0,x		;give the next byte to the controller
	staa	DATAREG
	inx
	cpx	#BUFEND		;out of bytes to write?
	bne	wrtLoop		;not yet
	
	bsr	wtDone		;else wait for 1771 to finish
wrtExit	rts

*------------------------------------------------------------------
* seek - Seek to track in A using the 1771
*------------------------------------------------------------------
seek	staa	DATAREG		;set track to seek to
	ldaa	#cSEEK
	staa	CMDREG
	jsr	delay		;delay, then fall into wtDone

*------------------------------------------------------------------
* wtDone - Wait for 1771 to finish current disk operation 
*------------------------------------------------------------------
wtDone	ldaa	CMDREG		;wait for not busy
	bita	#sBUSY
	bne	wtDone
	rts

*------------------------------------------------------------------
* delay - Delay 56us including call
*------------------------------------------------------------------
delay	jsr	delay2
delay2	jsr	delay3
delay3	rts

*------------------------------------------------------------------
* Messages
*------------------------------------------------------------------
mSure	fcc	"ARE YOU SURE? "
	fcb	EOT

mProt	fcc	"DISK IS PROTECTED!"
	fcb	EOT

mScrDsk	fcc	"SCRATCH DISK IN DRIVE "
	fcb	EOT

mFatal	fcc	"FATAL ERROR --- "
mAbort	fcc	"FORMATTING ABORTED"
	fcb	EOT

mBadSec	fcc	"BAD SECTOR AT "
	fcb	EOT

mFmtCmp	fcc	"FORMATTING COMPLETE"
	fcb	CR,LF,0,0,0
	fcc	"TOTAL SECTORS = "
	fcb	EOT


**************************************************************************
*
* FLEX cold boot loader
*   The following code is written to track 0, sectors 0 and 1 by the
*   NEWDISK routine. It is loaded into RAM at $2400 (BOOTLOC) by the
*   SWTBUG boot ROM to then load FLEX (DOS.SYS). As part of part of
*   this NEWDISK source code, it is not at $2400 in this file so a
*   few equates are used to allow assembly here but to run at $2400.
*
**************************************************************************
BOOTLOC	equ	$2400		;runtime address of the loader
BOOTIMG	equ	*		;location of the loader in NEWDISK
BOOTSTK	equ	$A07F		;stack for boot loader

* Start of code

boot	lds	#BOOTSTK	;init stack
	bra	bLdFlex		;jump to load entry point

bData	fcb	0,2,0,0,0,0,0,0	;see data section at end

*------------------------------------------------------------------
* bRdSec - Read sector at the track, sector specified in A,B.
*   The sector is read into secBuf
*------------------------------------------------------------------
bRd1st	ldaa	dosTrk		;read 1st sector of DOS.SYS
	ldab	dosSec

bRdSec	bsr	bSeek		;seek to track in A
	ldaa	#cREAD
	staa	CMDREG
	bsr	bDelay

	ldab	#SECLEN		;read length in B
	ldx	#secBuf		;buffer pointer in X

bRdLoop	ldaa	CMDREG		;wait for data available flag
	bita	#sDRQ
	bne	bRdByte

	bita	#sBUSY		;or for not busy (1771 done)
	bne	bRdLoop
	bra	boot

bRdByte	ldaa	DATAREG		;move the next byte to secBuf
	staa	0,x
	inx
	decb
	bne	bRdLoop

	bsr	bWait		;wait for 1771 to show finished
	bitb	#sRDERRS	;check for errors
	bne	boot		;read fail - start over
	
	ldx	#secBuf+4	;data starts at offset 4
bSavPtr	stx	pSource		;pSource->data in secBuf
	rts

*------------------------------------------------------------------
* bSeek - seek to track in A, set sector to hunt from B
*------------------------------------------------------------------
bSeek	cmpa	TRKREG		;on correct track already?
	beq	bSkDone		;yes

	staa	DATAREG		;give new track to the 1771
	bsr	bDelay

	ldaa	#cSEEK		;issue seek
	staa	CMDREG
	bsr	bDelay

	pshb			;preserve sector
	bsr	bWait		;wait for seek to complete

	pulb			;B=sector
bSkDone	stab	SECREG		;set sector to look for

*------------------------------------------------------------------
* bDelay - Delay 56us including call
*------------------------------------------------------------------
bDelay	bsr	bDly1
bDly1	bsr	bDly2
bDly2	rts

*------------------------------------------------------------------
* bWait - Wait for 1771 to no longer show busy
*------------------------------------------------------------------
bWait	ldab	CMDREG
	bitb	#sBUSY
	bne	bWait
	rts

*------------------------------------------------------------------
* bGetByt - Get next byte from sector buffer. Retrieve next
*    sector as needed.
*------------------------------------------------------------------
bGetByt	ldx	pSource
	cpx	#secBuf+SECLEN
	beq	bNxtSec

	ldaa	0,x
	inx
	bra	bSavPtr		;save pointer and exit

bNxtSec	ldx	#secBuf
	ldaa	0,x		;next track
	ldab	1,x		;B=next sector
	bsr	bRdSec		;get next sector
	bra	bGetByt		;and continue

*------------------------------------------------------------------
* bLdFlex - Load FLEX entry point and main loop
*------------------------------------------------------------------
bLdFlex	ldaa	#cRESTOR	;restore drive to track 0
	staa	CMDREG
	bsr	bDelay
	bsr	bWait
	bsr	bRd1st		;fetch the 1st sector of DOS.SYS

* bRecLp - Record loop for reading an FMS binary file

bRecLp	bsr	bGetByt		;get next byte
	cmpa	#$02		;data record header?
	beq	bHeader		;yes

	cmpa	#$16		;transfer address header?
	bne	bRecLp		;neither, get nextbyte

	bsr	bGetByt		;get transfer address
	staa	pFlex		;MSB
	bsr	bGetByt		;LSB
	staa	pFlex+1

	ldx	pFlex		;enter FLEX
	jmp	0,x					

* bHeader - Record header found. Get load address and length
*   and begin transfer of data.

bHeader	bsr	bGetByt		;A=MSB of load address
	psha
	bsr	bGetByt		;A=LSB of load address
	pulb			;B=MSB of load address
	staa	pDest+1		;save load address
	stab	pDest

	bsr	bGetByt		;A=byte count
	tab			;B=byte count
	beq	bRecLp		;byte count was zero

* bMoveLp - Move number of bytes specified in B

bMoveLp	pshb
	bsr	bGetByt		;get next data byte
	pulb
	ldx	pDest		;store in secBuf
	staa	0,x

	inx			;increment pointer
	stx	pDest
	decb			;decrement counter
	bne	bMoveLp		;loop for byte count in B

	bra	bRecLp		;get next record

*------------------------------------------------------------------
* secBuf - The sector buffer immediately follows the boot code.
*   The label is used as an immediate argument for LDX so it needs
*   to be the actual address relative to BOOTLOC ($2400)
*------------------------------------------------------------------
secBuf 	equ	*-boot+BOOTLOC


*------------------------------------------------------------------
* The track buffer for NEWDISK format and the FCB for FMS calls
*    overlay each other here at the end of code. 
*------------------------------------------------------------------
trkBuf	equ	*
fmsFcb	equ	*
	rmb	BUFLEN
BUFEND	equ	*


*------------------------------------------------------------------
* References to boot data items must be at the actual location
*   relative to BOOTLOC ($2400). These data items are present
*   near the start of the boot code (see bData above).
*------------------------------------------------------------------
	org	bData-boot+BOOTLOC
dosTrk	rmb	1		;DOS.SYS track and sector
dosSec	rmb	1		;  (filled in by LINK)

pFlex	rmb	2		;FLEX entry address
pDest	rmb	2		;pointer to destination in memory
pSource	rmb	2		;pointer to data in secBuf

	end	entry
