Trackloaders can be made in two ways,direct programming on the hardware,
and by using the Trackdisk.device. We'll be using the last method.
The example source will load the bootblock from drive 0 (DF0:)

First we must add a port for the disk input/output:
*************************************************
*	Findtask & Add port			*
*************************************************
	move.l	#0	,A1
	jsr	-294(A6)
	move.l	D0	,diskr+$10
	lea	diskr	,A1
	jsr	-354

Now we'll open the trackdisk.device:
*************************************************
*	Open trackdisk.Device			*
*************************************************
	lea	diskio	,A1
	move.l	#diskr	,14(A1)
	move.l	#0	,D0		;Drivenumber
	move.l	#0	,D1		;no flags
	lea	trackdiskdevice,A0
	jsr	-444(A6)
To load from DF1: ,simply change the "Move.l #0,d0" upstairs
in "Move.l #1,d0" (0,1,2,3 may be used).


The next routine loads the bootblock into the loadbuffer at the end
of the source.This loadbuffer has a length of 2 blocks (2 *512=1024
bytes).A block has a length of 512 bytes,there are 22 blocks in one
track,there are 80 tracks (0-79),so there are 1760 blocks on a disk.

first we do 'move #2,$1c(a1)'.The 2 indicates the command.
These are some of the commands:
2	READ	-read sectors
3	WRITE	-write sectors
4	UPDATE	-write sectors now
5	CLEAR	-Clear buffer
9	MOTOR	-Motor on/off
11	FORMAT	-Clear a track

after that,we specify the length of the part we want to read
(this should also be the length of the buffer!)The length must
be in bytes, so 2 sectors makes a length of 2*512=1024 bytes.
10 sectors makes a length of 5120 bytes.Make sure that your
length can be devided by 512,since you can only load complete sectors.

then we give the adres on wich the sectors must be loaded.You can
give an adress in memory (eg.#$50000) or the adress of a datablock
further on in the program.

and finally we must give the offset (also in bytes).Because we want to
load the bootblock,which are the first 2 sectors on your disk 
(blocks 0 & 1)
the offset is 0*512 = 0,but suppose you want to load blocks 880 & 881,
then the offset must be 880*512= 450560.
(ofcourse if you load more blocks,you will not only load 880 & 881,but
the number of bytes you specified at 'length')
All number are the same if you want to write.

*************************************************
*	READ BOOTBLOCK	 			*
*************************************************
	move.l	4	,A6
	lea	diskio	,A1
	move.l	#2	,$1c(A1)	;Command 2=>READ (3=WRITE)
	move.l	#2*512	,$24(A1)	;Length 1024,2 sectors
	move.l	#loadbuf,$28(A1)	;Adress to load at
	move.l	#0*512	,$2c(A1)	;Offset = 0sectors =>bootblocks
	jsr	-456(a6)

*************************************************
*	shut off drive motor 			*
*************************************************
	move.l	4	,A6
	lea	diskio	,A1
	move.w	#9	,$1c(A1)	;Command 9=>MOTOR
	move.l	#0	,$24(A1)	;1 = on,0 = off
	jsr	-456(A6)


*************************************************
*	Close trackdisk.Device/Port		*
*************************************************
	lea	diskio	,A1
	jsr	-450(A6)
	lea	diskr	,A1
	jsr	-360(A6)

*************************************************
*		Exit				*
*************************************************
	rts


diskr:			blk.b	32,0
diskio:			blk.b	80,0
trackdiskdevice:	dc.b	"trackdisk.device",0
			even

loadbuf:		blk.b	512*2,0	;room for 2 sectors

Make the loadbuf bigger if you want to load more sectors!
And remember that every time you assemble,loadbuf will be filled
with 0's!
Change BLK.B in DCB.B if you are using DEVPAC.


ROGER
