Implementing Case Statements in Assembler

Question: How do I implement case statements in Assembler?

 

Answer:

You can use labels to jump to the starting location of each branch of code.

For example,
mov A, []
jacc JumpTable

JumpTable:
jmp Cycle0
jmp Cycle1
jmp Cycle2
jmp Cycle3
jmp Cycle4
jmp Cycle5
jmp Cycle6

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Cycle0:


reti
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Cycle1:

reti
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Cycle2:

reti


Please refer to the "imagecraft assembly language user guide" for details on jacc and other jump instructions.