Skip to main content

LOAD

Read a value from a memory location into a framed register.

OpcodeBytesCyclesFormExample
$5934load b:_, [i:_]load b:1, [i:4]
$5a34load p:_, [i:_]load p:2, [i:4]
$5b34load i:_, [i:_]load i:4, [i:8]
$b644load b:_, [i:_ + {s_byte}]load b:1, [i:4 + 123]
$b744load p:_, [i:_ + {s_byte}]load p:2, [i:4 + 123]
$b844load i:_, [i:_ + {s_byte}]load i:4, [i:8 + 123]
$e554load b:_, [i:_ + {s_pair}]load b:1, [i:4 + 12345]
$e654load p:_, [i:_ + {s_pair}]load p:2, [i:4 + 12345]
$e754load i:_, [i:_ + {s_pair}]load i:4, [i:8 + 12345]

These special forms perform a widening conversion when loading 24-bit trio values:

OpcodeBytesCyclesForm
$6134load unsigned i:_, trio [i:_]
$be44load unsigned i:_, trio [i:_ + {s_byte}]
$ed54load 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 by i:8 and loads it in the i:4 register. Because i:4 is an int register, four bytes will be loaded.

  • For example, load p:2, [i:4 + 123] reads a pair value from the address i:4 plus offset 123, and loading the result in the p:2 register. 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 unsigned widening conversion, the missing bytes are zeros. For example, if load 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.