
     TrackLoader  -  System-Free Sector Loader V1.1- By Phil!94 26/4/94.
     ------------------------------------------------------------------

 Wanna contact me? I'm at: 43 Fairholme Rd,  
                           Hodge Hill,
                           Birmingham,
                           B36 8HN.
                           England.
DESCRIPTION
-----------

This piece of code is a cut down version of MultiDiskTrackLoader and
enables you to load data from dos blocks from a disk in one drive only.

You can set the label DRIVE to any drive number IE: 00 - 03 but this
is only for test purposes - If you want to access more than one drive
use the MULTIDISK version.

LOADING A FILE:
---------------

Before loading for the 1st time ONLY, you MUST call "INIT_DISK".
You will never need to call it again.

To load, you should preset the registers A6,D6 and D7 as shown:

Move.w #xxxx,D7     - The start block of the read ($0-$6df)
Move.l #xxxxxxxx,D6 - The number of bytes you wish to load.
move.l #xxxxxxxx,A6 - The load address in RAM.

BSR/JSR: "BLOCK_LOAD" (All Registers are preserved-except D7)

 D7 - Returns as 00 upon a successful load. Else it will be:

 01 = No speed signal from motor
 02 = No DMA transfer - time out
 03 = Disk removed from drive
 04 = Can't find that disk block   (disk corrupt)
 05 = Wrong track marker ID        ('')
 06 = Checksum error on disk block ('')
 07 = Block number out of range    (>$6df)

If error report occurs, its up to you to display an appropiate message
(or disk requester in the case of error $03).. You can then if you want
jump straight back to your 'set-registers and call load' bit of code as
the program switches off the drive, and waits 1 second before exit.IE: It
does things properly NOT leaving the motor running for example! Actual
MFM (disk corrupt) errors are only returned after the program has tried
to re-read the dodgey track 12 times! - during which time it will have
reset the disk head etc in case its an alignment problem.

IMPORTANT:-
-----------

To shut down the drive after youve finished loading for a while - call 
"MOTOR_OFF"!!!

I did not make this automatic as it would have meant stopping and restarting
the motor needlessly and wasting time waiting for the motor to reach the
right speed between each load. The motor will only be left running (ready
for next load) if there has not been any error report! The code will always
sense if the motor needs to be restarted and will perform this task.

The code contains an MFM buffer - if you select a short load from near the
same place as the previous load, the drive may not actually start as the
data will be fetched from the buffer.

GENERAL INFO
------------

The loader contains thorough error checking and should not lock up.
You can even eject a disk whilst loading and it will return an error as
normal! I've tested it on A500-A1200 with no problems - Timing is made
using CIAB timer b so CPU speed will make NO difference. It doesnt generate
any interrupts, lock out any interupts or use the blitter. The code is
obviously not designed to multitask - you'd use TRACKDISK_DEVICE for
system friendly loading! -So make sure you knock out the system IRQs when
testing. You can run your own interrupts whilst loading takes place
(EG:copper,VBL etc - but be careful if using the cia's!)

The example call on the source returns to dos after completion, this is
only for test purposes.. DO NOT attempts any normal dos disk activity cus
the Amiga will not realize that the heads have been shifted etc and it
probably will corrupt your disk(s).. Also the example calls have a large
load buffer for testing (128k) so dont be put off by the executable file
size!

Abrieviated info also contained at the start of the source code together
with an example load call. For multidisk/multidrive loading see the docs
for "MultiDiskTrackLoader".

-----------------------------------------------------------------------------

QUICK EXAMPLE OF USE:

	move.w #$4000,$dff09a	;Disable Irqs

GO	move.w #$370,d7		;start at block $370
	move.l #$12345,d6		;bytes to load
	move.l #$c0000,a6		;some address

	jsr BLOCK_LOAD

	tst.w d7			;how did it go?
	beq.s LOAD_OK
          		
	bsr SHOW_ERROR_REPORT	;your routine
	
LOAD_OK	bsr MOTOR_OFF
	move.w #$c000,$dff09a
	rts

-------------------------------------------------------------------------------

