在 1980 年代,软件开发工作室使用性能更强的计算机来为性能较弱的机器创建和调试软件的情况并不罕见。秉承这一精神,rpcDrive 是 Minecraft 的一个模组,它增加了 RedPower 2 的磁盘驱动器与 ComputerCraft 的计算机之间的跨模组兼容性,允许使用 Lua 脚本从基于 65EL02 的 RedPower 2 计算机生态系统中读取数据并向其写入数据。
此外,该模组还内置了一个(自动安装的)实用工具 rpc/drive,可用于对 RP2 软盘执行基本的读取、写入和复制操作。

ComputerCraft API 文档
RP2 磁盘驱动器被注册为类型为 rp_drive 的外设。需要注意的是,该模组的软盘以 128 字节扇区为单位进行操作;rp_drive 外设提供了一个内部的 128 字节缓冲区,用于从中读取和写入扇区。
索引和扇区计数均提供从 1 开始的编号,这与 Lua 中的惯例一致。
| 名称 |
参数 |
描述 |
| isPresent |
- |
如果存在软盘则返回 true。 |
| hasData |
- |
如果软盘包含数据则返回 true。 |
| isReadable |
- |
如果插入的软盘可读则返回 true。 |
| isWritable |
- |
如果插入的软盘可写则返回 true。 |
| getSerialNumber |
=> string |
以字符串形式返回软盘的内部标识符(即“序列号”)。 |
| getLabel |
=> string |
获取软盘的可显示标签。 |
| setLabel |
newLabel (string) |
设置软盘的可显示标签。 |
| getBytesPerSector |
=> number |
返回一个扇区中的字节数;通常为 128。 |
| getSectorCount |
=> number |
返回当前已写入插入软盘的扇区数量。 |
| getSectorSize |
=> number |
返回插入软盘上的总扇区数,包括那些从未写入过的扇区。 |
| readSector |
sectorIndex (number) |
从磁盘读取一个扇区到内部缓冲区。 |
| writeSector |
sectorIndex (number) |
将内部缓冲区中的一个扇区写入磁盘。 |
| erase |
- |
擦除软盘的内容。 |
| initialize |
- |
初始化一张空软盘;这将赋予其新的序列号。注意:向空软盘写入一个扇区会自动将其初始化。 |
| getBufferByte |
index (number) |
从内部缓冲区读取一个字节。 |
| setBufferByte |
index (number), value (number) |
向内部缓冲区写入一个字节。 |
In the 1980s, it wasn't at all uncommon to see software development houses use a more powerful computer to create and debug software for a less powerful machine. In this spirit, rpcDrive is a mod for Minecraft which adds cross-mod compatibility between RedPower 2's Disk Drives and ComputerCraft's Computers, allowing using Lua scripts to read data from and write data to RedPower 2's 65EL02-based computer ecosystem.
In addition, the mod comes with a built-in (automatically installed) utility called rpc/drive, which allows performing basic read, write and copy operations on RP2 floppies.

ComputerCraft API Documentation
RP2 Disk Drives are registered as peripherals of type rp_drive. It is important to note that Floppy Disks from that mod are operated on in terms of 128-byte sectors; the rp_drive peripheral provides an internal 128-byte buffer, from which sectors are read from and written to.
Indexes and sector counts are provided 1-indexed, as is the case across Lua.
| Name |
Arguments |
Description |
| isPresent |
- |
Returns true if a floppy disk is present. |
| hasData |
- |
Returns true if a floppy disk contains data. |
| isReadable |
- |
Returns true if the inserted floppy disk can be read from. |
| isWritable |
- |
Returns true if the inserted floppy disk can be read from. |
| getSerialNumber |
=> string |
Returns the floppy disk's internal identifier (its "serial number") in the form of 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 in a sector; typically 128. |
| getSectorCount |
=> number |
Returns the number of sectors currently written to the inserted floppy. |
| getSectorSize |
=> number |
Returns the number of total sectors on the inserted floppy, including ones which have never been written to. |
| readSector |
sectorIndex (number) |
Read a sector from the disk to the internal buffer. |
| writeSector |
sectorIndex (number) |
Write a sector from the internal buffer to the disk. |
| erase |
- |
Erase the floppy disk's contents. |
| initialize |
- |
Initialize an empty floppy disk; this gives it a new serial number. Note that writing a sector to an empty floppy disk initializes it automatically. |
| getBufferByte |
index (number) |
Read a byte from the internal buffer. |
| setBufferByte |
index (number), value (number) |
Write a byte to the internal buffer. |
评论 0
登录后参与评分
还没有评论,来抢沙发吧