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.