LOAD
Read a value from a memory location into a framed register.
| Opcode | Bytes | Cycles | Form | Example |
|---|---|---|---|---|
| $59 | 3 | 4 | LOAD B:_, [I:_] | LOAD B:1, [I:4] |
| $5A | 3 | 4 | LOAD P:_, [I:_] | LOAD P:2, [I:4] |
| $5B | 3 | 4 | LOAD I:_, [I:_] | LOAD I:4, [I:8] |
| $B6 | 4 | 4 | LOAD B:_, [I:_ + {S_BYTE}] | LOAD B:1, [I:4 + 123] |
| $B7 | 4 | 4 | LOAD P:_, [I:_ + {S_BYTE}] | LOAD P:2, [I:4 + 123] |
| $B8 | 4 | 4 | LOAD I:_, [I:_ + {S_BYTE}] | LOAD I:4, [I:8 + 123] |
| $E5 | 5 | 4 | LOAD B:_, [I:_ + {S_PAIR}] | LOAD B:1, [I:4 + 12345] |
| $E6 | 5 | 4 | LOAD P:_, [I:_ + {S_PAIR}] | LOAD P:2, [I:4 + 12345] |
| $E7 | 5 | 4 | LOAD I:_, [I:_ + {S_PAIR}] | LOAD I:4, [I:8 + 12345] |
These special forms perform a widening conversion when loading 24-bit TRIO values:
| Opcode | Bytes | Cycles | Form |
|---|---|---|---|
| $61 | 3 | 4 | LOAD UNSIGNED I:_, TRIO [I:_] |
| $BE | 4 | 4 | LOAD UNSIGNED I:_, TRIO [I:_ + {S_BYTE}] |
| $ED | 5 | 4 | LOAD UNSIGNED I:_, TRIO [I:_ + {S_PAIR}] |
Notes
-
The left operand is the target where the output will go.
-
For example,
LOAD I:4, [I:8]reads from the address indicated byI:8and loads it in theI:4register. BecauseI:4is anINTregister, four bytes will be loaded. -
For example,
LOAD P:2, [I:4 + 123]reads aPAIRvalue from the addressI:4plus offset123, and loading the result in theP:2register. In the Hybrix language, this form is often used to read class members, whose fields are located at fixed offsets from the object's address. -
For an
UNSIGNEDwidening conversion, the missing bytes are zeros. For example, ifLOAD UNSIGNED I:_, TRIO [I:_]reads three bytes$80_0000, they are converted to four bytes$0080_0000. -
This instruction does not affect the CPU condition flags.