Skip to content

Assignment instructions

EyeBool edited this page Jan 17, 2018 · 7 revisions

We already have seen LDM and XCH instructions. Besides them there are few others used to assign and move values between different registers. Let us summarize:

Loading into Accumulator

  • LDM - loads this value into Accumulator (i.e. ldm 11)
  • LD - loads (copies) value of this register into Accumulator (i.e. ld r3)

Exchange instruction also changes value of Accumulator but we list it in other section.

Loading into Carry

  • CLC - clears Carry flag (sets it to 0)
  • STC - sets Carry flag (raises it to 1)
  • CLB - clears both Carry and Accumulator

Loading into Registers

  • XCH - exchanges values between Accumulator and register (i.e. xch r8)
  • FIM - loads 8-bit value into pair of registers (i.e. fim r4 $57)

Note that there is no way to simply copy value of Accumulator to Register (without modifying Acc).

About the FIM instruction note that it does not use Accumulator. Also note that we use form $57 to represent hexadecimal value so it is visually easy to split it into two half-bytes. That said you should see the example above simply loads 5 to r4 and also 7 to r5 (see demo).


Next: Addition, Shift and Inversion - Arithmetic instructions