4300H – Start of the BOOT/SYS Module
NOTE: 43EAH is where the DISK SECTOR NUMBER and 43EBH is where the DISK TRACK NUMBER is stored.
NOTE: 43ECH is where the BYTE NUMBER is stored.
4322H – Data Byte: Number of Backups Permitted
4323H – Read a Data Block from Diskette into a Memory Buffer Pointed To By HL
If we are here, the byte we read from disk was a DATA BLOCK designator.
So, at this point we have the 01H, so we need to pull the rest of the header bytes from disk. To do this we GOSUB to 433EH (the READ A BYTE FROM DISKETTE routine).
432CH – Start of LOOP to read “B” bytes from the diskette and put them into a buffer starting at HL.
4335H – Get an Address from Diskette
Basically, this just reads 2 bytes into Register Pair HL; LSB into L and MSB into H.
433EH – Read a Byte from Diskette
NOTE: 43ECH is where the BYTE NUMBER is stored.
If we’re here, we are not at the sector we want.
4348H is the start of a loop of 9 tries to get a good sector read.
… uh oh, we have an error!
At this point we failed 9 times, so its time to error out.
NOTE: 0033H is the character print routine, to put the character held in Register A at the current cursor position.
NOTE: 021BH will display the character at (HL) until a 03H or 0DH is found.
4364H – Sector Successfully Read
Jumped to by 434FH if we weren’t originally at the sector we wanted, but we are now.
NOTE: 43EAH is where the DISK SECTOR NUMBER and 43EBH is where the DISK TRACK NUMBER is stored.
- If Register A equals 13H, the Z FLAG is set.
- If A < 13H, the CARRY FLAG will be set.
- if A >= 13H, the NO CARRY FLAG will be set.
If we are here, the sector number is greater than 18 sectors, so we need to bump the track number and reset the sector number to 01H (which is the lowest sector in TRSDOS v1.3 land).
NOTE: 43EAH is where the DISK SECTOR NUMBER and 43EBH is where the DISK TRACK NUMBER is stored.
NOTE: 43ECH is where the BYTE NUMBER is stored.
437FH – Read a Sector from Diskette
NOTE: Port F4H is the Floppy drive select and options register. For OUTPUT:
- Bit 0: Drive 0 Select
- Bit 1: Drive 1 Select
- Bit 2: Drive 2 Select
- Bit 3: Drive 3 Select
- Bit 4: Side Select (0 = Select Side 0, 1 = Select Side 1)
- Bit 5: Write Precompensation (0 = Disable WP, 1 = Enable WP)
- Bit 6: Wait State Generation (0 = Disable WSG, 1 = Enable WSG)
- Bit 7: Density Select (0 = Single/FM, 1 = Double/MFM)
NOTE: 404AH is the high byte of the RST 0 NMI Vector.
NOTE: 4049H is the low byte of the RST 0 NMI Vector.
NOTE: Port E4H is the Non-Maskable Interrupt Latch. Sending a Bit 6 and Bit 7 high to E4 will enable the DRQ and INTRQ Interrupts.
NOTE: Port F0H is the FDC Status port on input. Input Results:
- Bit 0: Busy
- Bit 1: Index/DRQ
- Bit 2: Track 0/Data Lost
- Bit 3: CRC error
- Bit 4: Seek error/Record not found
- Bit 5: If Reading, Record Type, if Writing, Write Fault/Head loaded
- Bit 6: Write Protect
- Bit 7: Not ready
If we are here, then the FDC returned CONTROLLER READY.
NOTE: Port F4H is the Floppy drive select and options register. For OUTPUT:
- Bit 0: Drive 0 Select
- Bit 1: Drive 1 Select
- Bit 2: Drive 2 Select
- Bit 3: Drive 3 Select
- Bit 4: Side Select (0 = Select Side 0, 1 = Select Side 1)
- Bit 5: Write Precompensation (0 = Disable WP, 1 = Enable WP)
- Bit 6: Wait State Generation (0 = Disable WSG, 1 = Enable WSG)
- Bit 7: Density Select (0 = Single/FM, 1 = Double/MFM)
43B7H – Interrupt Vector Handler
This routine was set as the INTERRUPT VECTOR at 438AH. This routine exits with Register A holding the FLOPPY DISK CONTROLLER status.
NOTE: Port E4H is the Non-Maskable Interrupt Latch. Sending a 0 to E4 will turn off all Non-Maskable Interrupts.
NOTE: Port F4H is the Floppy drive select and options register. For OUTPUT:
- Bit 0: Drive 0 Select
- Bit 1: Drive 1 Select
- Bit 2: Drive 2 Select
- Bit 3: Drive 3 Select
- Bit 4: Side Select (0 = Select Side 0, 1 = Select Side 1)
- Bit 5: Write Precompensation (0 = Disable WP, 1 = Enable WP)
- Bit 6: Wait State Generation (0 = Disable WSG, 1 = Enable WSG)
- Bit 7: Density Select (0 = Single/FM, 1 = Double/MFM)
NOTE: Port F0H is the FDC Status port on input. Input Results:
- Bit 0: Busy
- Bit 1: Index/DRQ
- Bit 2: Track 0/Data Lost
- Bit 3: CRC error
- Bit 4: Seek error/Record not found
- Bit 5: If Reading, Record Type, if Writing, Write Fault/Head loaded
- Bit 6: Write Protect
- Bit 7: Not ready
43C5H – Position the Read Head
Routine to position the read head based on the contents of HL (H=Track, L=Sector)
NOTE: Port F4H is the Floppy drive select and options register. For OUTPUT:
- Bit 0: Drive 0 Select
- Bit 1: Drive 1 Select
- Bit 2: Drive 2 Select
- Bit 3: Drive 3 Select
- Bit 4: Side Select (0 = Select Side 0, 1 = Select Side 1)
- Bit 5: Write Precompensation (0 = Disable WP, 1 = Enable WP)
- Bit 6: Wait State Generation (0 = Disable WSG, 1 = Enable WSG)
- Bit 7: Density Select (0 = Single/FM, 1 = Double/MFM)
NOTE: 43EAH is where the DISK SECTOR NUMBER and 43EBH is where the DISK TRACK NUMBER is stored.
The reason this is going to the data register is that the FDC seek command requires that the Track Register contains the track number of the current position of the head and the Data Register contains the desired track number.
NOTE: Port F0H is the FDC Status port on input. Input Results:
- Bit 0: Busy
- Bit 1: Index/DRQ
- Bit 2: Track 0/Data Lost
- Bit 3: CRC error
- Bit 4: Seek error/Record not found
- Bit 5: If Reading, Record Type, if Writing, Write Fault/Head loaded
- Bit 6: Write Protect
- Bit 7: Not ready
Z FLAG will be set if that bit is 0 (=NOT BUSY), and NZ FLAG will be set if that bit is 1 (=BUSY).
NOTE: Port F2H is the Floppy Disk Controller SECTOR Register.
43E0H – Delay Routine
Routine delay Of 2 Lengths (Depending on Entry). Used primarily as a short delay between OUTputting to the FDC and INputting from the FDC.
43EAH-43ECH – Byte Storage Area
43EDH – Error Message Storage Location
43F3H
43F4H – Byte Storage Area
43FBH