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.