ON THIS WIKI
EEPROM
EEPROM | |
---|---|
| |
Name | EEPROM |
Source Mod | OpenComputers |
ID Name | OpenComputers:eeprom
|
OreDict Name | |
Type | Data Storage |
Stackable | Yes (64) |
The EEPROM is a vital OpenComputers component. It is used to store the code to be executed immediately after the computer is powered on, usually a BIOS that runs other code, such as an operating system. However, by default it contains no code, and must be programmed using another computer or by crafting it into a Lua BIOS. This BIOS checks connected file systems for an operating system, such as OpenOS, and boots it.
Storage[edit]
A single EEPROM chip stores two sequences of bytes: one containing up to 4096 bytes (4 KB) of startup code, usually in Lua, and a second one storing up to 256 bytes of other data. By default the latter is used to store a preferred boot address, however custom EEPROMs may use it for any other purpose. The code section may be permanently marked as read-only to prevent further changes to the code.
Both data sections of an EEPROM can be copied by crafting it together with a second EEPROM. If one chip is empty, the one with data is duplicated, otherwise the first one's data is written over the second one's.
A running computer's EEPROM can be replaced, which allows the computer to function as an EEPROM programmer. An EEPROM can be read, reprogrammed and relabeled with the flash
OpenOS program. Other operations can only be performed directly using its API.
Tooltip Description[edit]
Small, programmable storage that contains the BIOS that computers use to boot.
Component API[edit]
An EEPROM provides the eeprom
component with the following methods:
-
get(): string
: Return the EEPROM's code bytes as a string. -
getChecksum(): string
: Return a checksum of the EEPROM's code bytes, which is required to set it as read-only. -
getData(): string
: Return the EEPROM's data bytes as a string. -
getDataSize(): number
: Return the number of data bytes that can be stored on this EEPROM. Currently this is always 256. -
getLabel(): string
: Return the EEPROM's label. -
getSize(): number
: Return the number of code bytes that can be stored on this EEPROM. Currently this is always 4096. -
makeReadonly(checksum: string): true or (nil, error)
: Permanently mark the code bytes as read-only. Returntrue
if the checksum is correct and the operation was successful, elsenil
and an error message. -
set(data: string): nothing or (nil, error)
: Replace the EEPROM's code bytes with the given string. Returnnil
and an error message if the EEPROM is read-only, or raise an error ifdata
is too large. -
setData(data: string)
: Replace the EEPROM's data bytes with the given string. Raise an error ifdata
is too large. -
setLabel(label: string)
: Replace the EEPROM's label with the given string.
Recipe[edit]
Usage[edit]
EEPROM can be used to create the following items:
|