section td_read,code_c ; force to chipmem, only necessary when ; writing to the disk, the data must be in ; chipmem (and is assumed to be so) if it ; is not, the trackdisk device will write ; rubbish instead. execbase = 4 findtask = -294 addport = -354 remport = -360 openlib = -408 closelib = -414 opendev = -444 closedev = -450 doio = -456 *************************************************************** * * * NOTE: THIS IS AN ABSOLOUTE TRACKDISK DEVICE LOADER, IT * * WILL LOAD DATA FROM THE DISK TO ADDRESS $60000-$62C00 * * AND OVERWRITE ANY INFOMATION STORED THERE! * * * * * * IT IS RECOMMENDED TO USE A UTILLITY LIKE TRACKDOS OFF * * QUATERBACK TOOLS OR ANOTHER SIMILAR UTILLITY. * * * *************************************************************** *************************************************************** * * * THE REASON FOR THE *512 ON THE BLOCKNUMBER AND NUMBER * * OF BLOCKS (SEE BELOW) IS THAT TRACKDISK DEVICE USES * * A DISK ADDRESS SYSTEM AND NOT THE BLOCK NUMBER. * * * * HERE IS HOW TO CONVERT ONE TO THE OTHER * * * * DISK ADDRESS $C7000 IS INFACT BLOCK 1592 ($C7000/512) * * AND ALSO IS TRACK 72, SECTOR 8 (22 BLOCKS PER TRACK - * * 11 UPPERSIDE/11 LOWERSIDE, TRACKDISK DEVICE USES * * BOTH SIDES AS ONE CONTUNIES SURFACE.) * * * * BLOCK RANGE: 0-1759 DISK ADDRESS RANGE: (0-$DBE00) * * * * YOU ARE ALSO ABLE TO USE ALL 512 BYTES OF THE BLOCK * * UNLIKE DOS WHICH ONLY USES 488 (24 BYTES USED FOR * * BLOCKID AND CHECKSUMS, NEXT BLOCK ETC.), THUS GIVING * * YOU THE FULL 880k INSTEAD OF THE USUAL 836k AVAILABLE * * TO AMIGADOS. * * * *************************************************************** move.l #0,drive ; set drive to df0: move.l execbase,a6 move.l #0,a1 jsr findtask(a6) ; find the task structure for this task ; d0=task structure lea readreply,a1 ; name of reply port move.l d0,$10(a1) ; put task structute into reply port jsr addport(a6) ; create the reply port lea diskio,a1 ; address of the datablock for the device move.l drive,d0 ; drive number to td device clr.l d1 lea td_device,a0 ; name of device jsr opendev(a6) ; open the device tst.l d0 bne td_error ; if an error occurs move.w #2,command ; device command number ; 2 = read ; 3 = write ; 9 = turn motor on/off move.l #$60000,buffer ; address to load move.l #11*512,block ; block number (11, must be *512) move.l #22*512,number ; number of blocks to load (22, must ; be *512 bsr do_td_command ; do it! move.w #9,command ; turn drive motor move.l #0,number ; off - (0=off or 1=on) bsr do_td_command ; do it! lea readreply,a1 ; address of the reply port jsr remport(a6) ; remove reply port lea diskio,a1 ; address of the datablock jsr closedev(a6) ; close device move.l #0,d0 rts *************************************************************** td_error: ; if an error has occured (the trackdisk device could not be ; opened) remove the reply port and quit. ; ; normally, if the trackdisk device could not be opened ; it means that drive does not exsist! lea readreply,a1 jsr remport(a6) ; remove reply port move.l #-1,d0 rts *************************************************************** do_td_command: lea diskio,a1 ; address of the datablock for ; the device lea readreply,a2 ; address of the reply port move.l a2,14(a1) ; address of reply port move.w command,28(a1) ; put command into datablock move.l buffer,40(a1) ; put io address into datablock move.l number,36(a1) ; put number of blocks into datablock move.l block,44(a1) ; put start block info datablock move.l execbase,a6 ; address of the execbase library jsr doio(a6) ; send to datablock to trackdisk ; device, and wait for a reply ; in the reply port lea diskio,a1 ; address of the datablock cmp.b #0,31(a1) ; get offset 31 from the datablock beq.s td_ok ; compare it with zero, if it was ; everything was ok, otherwise ; flash the background colour move.w #$f000,d0 td_err: move.w $dff006,$dff180 ; setbackgroud colours dbf d0,td_err td_ok: rts *************************************************************** td_device: dc.b "trackdisk.device",0 even *************************************************************** drive: dc.l 0 block: dc.l 0 number: dc.l 0 command: dc.w 0 buffer: dc.l 0 diskio: dcb.l 20,0 readreply: dcb.l 8,0 *************************************************************** end