mima-tools/examples/jmp_to_address_in_acc.mimasm

28 lines
485 B
Text

.reg IAR technique-1
; This file demonstrates a few techniques for jumping to an address
; stored in the ACC.
; A few variables
jump-instruction: JMP 0
tmp: .lit 0
; Jumping by setting the RA and then returning
.org 100
technique-1:
LDC technique-2
STRA
RET
; Jumping by writing a JMP instruction to a memory location and then
; jumping to that (aka. almost self-modifying code)
.org 200
technique-2:
LDC end
OR jump-instruction
STV tmp
JMP tmp
.org 300
end:
HALT