Implementing Case Statements in Assembler
Anonymous
Not applicable
Jun 19, 2011
10:53 AM
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
Jun 19, 2011
10:53 AM
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.
Labels
Rate this article:
Contributors
-
This widget could not be displayed.Anonymous