Component/drive: Difference between revisions

From OpenComputers: Rebooted
Jump to navigation Jump to search
imported>OCDoc Import
Imported from legacy OpenComputers documentation at ocdoc.cil.li
 
Clean up Markdown artifacts from DokuWiki migration
 
Line 5: Line 5:
To switch a managed drive to Unmanaged mode, just right click with the item in your hand and select Unmanaged mode (Warning: this will wipe the drive).
To switch a managed drive to Unmanaged mode, just right click with the item in your hand and select Unmanaged mode (Warning: this will wipe the drive).


Component name: `drive`. Callbacks:
Component name: <code>drive</code>. Callbacks:


* `readByte(offset:number):number`
* <code>readByte(offset:number):number</code>


<pre>Read a single byte at the specified offset.
<pre>Read a single byte at the specified offset.
</pre>
</pre>
* `writeByte(offset:number, value:number)`
* <code>writeByte(offset:number, value:number)</code>


<pre>Write a single byte to the specified offset.
<pre>Write a single byte to the specified offset.
</pre>
</pre>
* `getSectorSize():number`
* <code>getSectorSize():number</code>


<pre>Returns the size of a single sector on the drive, in bytes.
<pre>Returns the size of a single sector on the drive, in bytes.
</pre>
</pre>
* `getLabel():string`
* <code>getLabel():string</code>


<pre>Get the current label of the drive.
<pre>Get the current label of the drive.
</pre>
</pre>
* `setLabel(value:string):string`
* <code>setLabel(value:string):string</code>


<pre>Sets the label of the drive. Returns the new value, which may be truncated.
<pre>Sets the label of the drive. Returns the new value, which may be truncated.
</pre>
</pre>
* `readSector(sector:number):string`
* <code>readSector(sector:number):string</code>


<pre>Read the current contents of the specified sector.
<pre>Read the current contents of the specified sector.
</pre>
</pre>
* `writeSector(sector:number, value:string)`
* <code>writeSector(sector:number, value:string)</code>


<pre>Write the specified contents to the specified sector.
<pre>Write the specified contents to the specified sector.
</pre>
</pre>
* `getPlatterCount():number`
* <code>getPlatterCount():number</code>


<pre>Returns the number of platters in the drive.
<pre>Returns the number of platters in the drive.
</pre>
</pre>
* `getCapacity():number`
* <code>getCapacity():number</code>


<pre>Returns the total capacity of the drive, in bytes.
<pre>Returns the total capacity of the drive, in bytes.
Line 47: Line 47:


{{:Component/contents}}
{{:Component/contents}}

Latest revision as of 20:27, 24 August 2026

Component: Drive

This component is provided by Floppy Disks or Hard Disk Drives in Unmanaged mode (for Managed mode, see Filesystem)

To switch a managed drive to Unmanaged mode, just right click with the item in your hand and select Unmanaged mode (Warning: this will wipe the drive).

Component name: drive. Callbacks:

  • readByte(offset:number):number
Read a single byte at the specified offset.
  • writeByte(offset:number, value:number)
Write a single byte to the specified offset.
  • getSectorSize():number
Returns the size of a single sector on the drive, in bytes.
  • getLabel():string
Get the current label of the drive.
  • setLabel(value:string):string
Sets the label of the drive. Returns the new value, which may be truncated.
  • readSector(sector:number):string
Read the current contents of the specified sector.
  • writeSector(sector:number, value:string)
Write the specified contents to the specified sector.
  • getPlatterCount():number
Returns the number of platters in the drive.
  • getCapacity():number
Returns the total capacity of the drive, in bytes.

Components
Core Components Access Point - Computer - Drone - Drive - EEPROM - Filesystem - GPU - Microcontroller - Modem - Redstone - Robot - Transposer
Others Component Access - Signals
Cross-Mod Integration Applied Energistics