Disk
Device Type: 0x0004
Disk is a persistent storage device. A disk is divided into data sectors, each of identical size and individually addressable.
Sector size can be 0-65535. While the sector size can be arbitrary, it should be practical as well, because any read or write operation will require at least one sector size of memory for a buffer. So for example, sector size of 32768 would require half of WOPR memory. The most common sector size is 256.
Number of sectors can also be 0-65535. Size 0 is reserved. Note that when addressing sectors, sector number is zero based, meaning the first sector is 0.
GETINFO command has no parameters. It returns two values: P1 - sector count P0 - sector size
READ will read a single sector of data from the disk and store it into specified memory location.
Parameter | Meaning |
---|---|
P1 | buffer address |
P0 | sector number; zero based |
Result | Meaning |
---|---|
P0 | result code; 0 on success |
WRITE will write a single sector of data to the disk from the specified memory location.
Parameter | Meaning |
---|---|
P1 | buffer address |
P0 | sector number; zero based |
Result | Meaning |
---|---|
P0 | result code; 0 means success |
Code | Description |
---|---|
0 | OK, success |
1 | invalid sector number; disk does not have the as many sectors as requested |
2 | hardware error; there is a physical problem with the disk |