Apachicorp's floppy drive offers a simple long-term storage solution for your data and greatly facilitates software sharing!
Specifications
Manufacturer: Apachicorp
Version: 1.0B
Default address: 0x000B
Hardware ID: 0x000B
The players can upload their own binary data to a floppy disk or download to a file using the floppy buttons in the editor.
Floppies contains 80 tracks with 18 sectors per track. That's 1440 sectors of 512 words. (total 1,474,560 bytes / 737,280 words / 1.44MB)
Interrupt Behavior
Value of A | Action | Energy cost | Result |
---|---|---|---|
1 |
FLOPPY_POLL |
0 kJ |
Puts the status of the drive (READY = 0 , NO_MEDIA =1 ) in register B . |
2 |
FLOPPY_READ_SECTOR |
1 kJ |
Copies a sector from the drive media into CPU RAM (more info). |
3 |
FLOPPY_WRITE_SECTOR |
1 kJ |
Copies 512 words from CPU RAM into a sector on the drive media (more info). |
Read and write operations are synchronous. Track seeking time is 2ms.*
*Seek time is added to the total execution time, which is not yet calculated as of v1.3a
FLOPPY_READ_SECTOR
Copies a sector from the floppy drive media into CPU RAM. The sector to read is specified by the X
register. The address in CPU RAM to write the sector to is specified by the Y
register. If this action is ran without any media in the floppy drive, then CPU RAM will not be changed and register B
will be set to 0. Otherwise, register B
will be set to 1 to indicate success.
Example sector read
mov A, 2 ; FLOPPY_READ_SECTOR = 2
mov X, 20 ; Read sector no. 20 from the floppy drive media
; (valid values are 0-1440).
mov Y, 0x2000 ; Write the sector to CPU RAM starting at
; address 0x2000. Addresses 0x2000-0x2200 will
; contain the read sector.
hwi 0x000B ; Floppy Drive hardware ID = 0x000B
; After the hwi instruction completes, register
; B will be set to 1 if the operation was
; successful, otherwise it will be 0.
FLOPPY_WRITE_SECTOR
Copies 512 words from CPU RAM into a sector on the floppy drive media. The sector to write to is specified by the X
register. The starting address in CPU RAM to read from is specified by the Y
register. If this action is ran without any media in the floppy drive, then register B
will be set to 0. Otherwise, register B
will be set to 1 to indicate success.
Example sector write
mov A, 3 ; FLOPPY_WRITE_SECTOR = 3
mov X, 12 ; Overwrite sector no. 12 in the floppy drive media
; (valid values are 0-1440).
mov Y, 0x2000 ; Read 512 words from CPU RAM starting at
; address 0x2000. Addresses 0x2000-0x2200 will
; be copied into the sector.
hwi 0x000B ; Floppy Drive hardware ID = 0x000B
; After the hwi instruction completes, register
; B will be set to 1 if the operation was
; successful, otherwise it will be 0.