Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob

Implementing Case Statements in Assembler

Implementing Case Statements in Assembler

Anonymous
Not applicable
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.

0 Likes
263 Views
Contributors