|
| void | ritrackdisklib_libinit (void) |
| void | ritrackdisklib_libfinit (void) |
| void | opentrack (void) |
| void | opentrack2 (void) |
| void | motoron (void) |
| void | closedisk (void) |
| void | readsector1 (void) |
| void | readsector2 (void) |
| void | motoroff (void) |
| void | writesector1 (void) |
| void | writesector2 (void) |
| void | formatsector1 (void) |
| void | formatsector2 (void) |
| void | install1 (void) |
| void | install2 (void) |
| void | iostatus (void) |
| void | ioreq (void) |
| void | bootprog (void) |
| void | diskmotor (void) |
| static struct IOStdReq * | getioreq (LONG unit) |
| static void | putioreq (LONG unit, struct IOStdReq *req) |
| static struct MsgPort * | newport (void) |
| static void | freeport (struct MsgPort *mp) |
| static struct IOStdReq * | newreq (void) |
| static void | freereq (struct IOStdReq *req) |
| static ULONG | doio (struct IOStdReq *req) |
| static void | c_libinit (void) |
| | init: clear the request table and create the reply port.
|
| ULONG | c_motoroff (LONG unit) |
| | MotorOff unit#: write the track buffer to the disk (CMD_UPDATE), then switch the drive motor off (TD_MOTOR, length 0).
|
| BB_BOOL | c_closedisk (LONG unit) |
| | CloseDisk unit#: switch the motor off, close the device, free the request.
|
| static void | c_libfinit (void) |
| | finit: CloseDisk 0-3 and free the reply port.
|
| static BB_BOOL | opendisk (LONG unit, const char *name) |
| BB_BOOL | c_opentrack (LONG unit) |
| | OpenDisk unit#: open trackdisk.device for a unit with a new request.
|
| BB_BOOL | c_opentrack2 (LONG unit, const char *name) |
| | OpenDisk unit#,devicename$: c_opentrack() with another device.
|
| static ULONG | trackpos (ULONG off) |
| static int | needsbounce (const UBYTE *buffer, ULONG len, UWORD cmd) |
| static ULONG | bounceio (struct IOStdReq *req, ULONG offset, UBYTE *buffer, ULONG len, UWORD cmd) |
| static ULONG | sectorio (LONG unit, ULONG offset, APTR buffer, ULONG num, UWORD cmd) |
| ULONG | c_readsector2 (LONG unit, ULONG sector, APTR buffer, ULONG num) |
| | ReadSector unit#,sector#,buffer,numsectors: read sectors (CMD_READ).
|
| ULONG | c_readsector1 (LONG unit, ULONG sector, APTR buffer) |
| | ReadSector unit#,sector#,buffer: read one sector.
|
| ULONG | c_writesector2 (LONG unit, ULONG sector, APTR buffer, ULONG num) |
| | WriteSector unit#,sector#,buffer,numsectors: write sectors (CMD_WRITE).
|
| ULONG | c_writesector1 (LONG unit, ULONG sector, APTR buffer) |
| | WriteSector unit#,sector#,buffer: write one sector.
|
| ULONG | c_formatsector2 (LONG unit, ULONG track, APTR buffer, ULONG num) |
| | FormatTrack unit#,track#,buffer,numsectors: format tracks (TD_FORMAT).
|
| ULONG | c_formatsector1 (LONG unit, ULONG track, APTR buffer) |
| | FormatTrack unit#,track#,buffer: format one track.
|
| static void | checksum (UBYTE *mem) |
| ULONG | c_install1 (LONG unit) |
| | WriteBoot unit#: write a bootable standard boot block (sectors 0-1).
|
| ULONG | c_install2 (LONG unit, APTR buffer) |
| | WriteBoot unit#,bootdata: write 1024 bytes of bootdata to the boot block (sectors 0-1).
|
| ULONG | c_bootprog (LONG unit, UBYTE *mem) |
| | BootProg unit#,memoryaddress: make a boot block of 1024 bytes in memory bootable and write it.
|
| ULONG | c_iostatus (LONG unit) |
| | DiskStatus unit#: CheckIO of the unit's request.
|
| ULONG | c_ioreq (LONG unit) |
| | DiskIO unit#: the unit's IOStdReq.
|
| ULONG | c_motoron (LONG unit) |
| | MotorOn unit#: switch the drive motor on (TD_MOTOR, length 1).
|
| ULONG | c_diskmotor (void) |
| | DiskMotor: -1 if the motor of a unit the library has open is on, as the library knows it.
|
| ULONG c_diskmotor |
( |
void | | ) |
|
DiskMotor: -1 if the motor of a unit the library has open is on, as the library knows it.
Fixed (#857): the state is the library's own knowledge: on after a MotorOn or a ReadSector, WriteSector, FormatTrack, WriteBoot or BootProg that worked (trackdisk.device switches the motor on for them and leaves it on), off after a MotorOff that worked and after CloseDisk. What other programs do with the drives is not seen. The original returned SNE of bit 7 of CIAB PRB ($BFD100, /MTR), which trackdisk.device leaves 1 after every request (it deselects the drives): always -1.
- Returns
- d0: $FF (-1) if a unit's motor is on, else 0 (a byte result)
| ULONG c_formatsector2 |
( |
LONG | unit, |
|
|
ULONG | track, |
|
|
APTR | buffer, |
|
|
ULONG | num ) |
FormatTrack unit#,track#,buffer,numsectors: format tracks (TD_FORMAT).
The first sector is track * 11 (MULU.w: the low word of the track), the length numsectors * 512, as in the original: the count is in sectors, though the declaration calls it numtracks. trackdisk.device formats whole tracks only (5632 bytes = 11 sectors on a DD disk) and refuses another length with -4 (IOERR_BADLENGTH): 11 formats one track, 22 two (#858, decided: the count stays in sectors).
- Parameters
-
| unit | d0: unit# (0-3) |
| track | d1: the first track |
| buffer | d2: the data (numsectors * 512 bytes) |
| num | d3: the number of sectors (a multiple of 11) |
- Returns
- d0: the result of the sector and motor commands (#1155): DoIO's d0 with io_Error as its low byte, so the byte is 0 when the request worked and the trackdisk.device error otherwise (28 write protected, 29 no disk, -4 a length the device refuses, ...); 0 also when the unit is not open or there is no reply port, so 0 does not tell "done" from "not open" (unlike OpenDisk, whose -1 is success)
| ULONG c_install1 |
( |
LONG | unit | ) |
|
WriteBoot unit#: write a bootable standard boot block (sectors 0-1).
Fixed (#865): reads sectors 0-1 first and keeps the flag byte of the disk's boot block (byte 3, the file system: 0 OFS, 1 FFS, ...) if it starts with "DOS", else 0; then writes "DOS" and that byte, root block 880, the boot code above and the checksum (checksum()). The buffer is chip memory (1024 bytes, freed again). The original wrote its 8 byte block ("DOS",0, -1) and the 1016 bytes behind it. Fixed (#858): with CMD_WRITE (the original's TD_FORMAT of 1024 bytes was refused).
- Parameters
-
- Returns
- d0: as c_writesector2(); 0 without port or request, TDERR_NoMem (31) without chip memory for the buffer