rpcDrive - RedPower 2 and ComputerCraft Compatibility
In the 1980s era, it was common practice for developers to use more powerful computers to create and debug software for less performant machines. It is in this spirit that the rpcDrive mod was created, providing cross-mod compatibility between disk drives from RedPower 2 and computers from ComputerCraft. This allows using Lua scripts to read and write data to the RedPower 2 computer ecosystem based on the 65EL02 processor.
The mod also includes a built-in utility rpc/drive that is automatically installed and provides basic read, write, and copy operations for RP2 floppies.

ComputerCraft API Documentation
RP2 disk drives are registered as peripheral devices of type rp_drive. It's important to note that operations with floppy disks are performed using 128-byte sectors. The rp_drive peripheral device provides an internal 128-byte buffer from which sectors are read and to which they are written.
Indexes and sector counts are specified starting from 1, as is customary in Lua.
| Name | Arguments | Description |
|---|---|---|
| isPresent | - | Returns true if a floppy disk is present |
| hasData | - | Returns true if the floppy disk contains data |
| isReadable | - | Returns true if the floppy disk can be read |
| isWritable | - | Returns true if data can be written to the floppy disk |
| getSerialNumber | => string | Returns the floppy disk's internal identifier ("serial number") as a string |
| getLabel | => string | Gets the floppy disk's displayable label |
| setLabel | newLabel (string) | Sets the floppy disk's displayable label |
| getBytesPerSector | => number | Returns the number of bytes per sector; typically 128 |
| getSectorCount | => number | Returns the number of sectors written to the floppy disk |
| getSectorSize | => number | Returns the total number of sectors on the floppy disk, including never-written ones |
| readSector | sectorIndex (number) | Reads a sector from the floppy disk to the internal buffer |
| writeSector | sectorIndex (number) | Writes a sector from the internal buffer to the floppy disk |
| erase | - | Erases the floppy disk's contents |
| initialize | - | Initializes an empty floppy disk, assigning it a new serial number. Writing a sector to an empty floppy disk automatically initializes it |
| getBufferByte | index (number) | Reads a byte from the internal buffer |
| setBufferByte | index (number), value (number) | Writes a byte to the internal buffer |