- If you have a switch statement, it's usually implemented as a branch table.
- The branch table gives the address of the intended destination
When we have:
switch(value)
case _ (lower bound)
...
case _ (upper bound)
If the value is in that range, then it will get an index into the branch table.
usually, INDEX ← value - lower bound
We can use that to index into a table of case addresses
If it's out of the range, it would fall into the default case.
Relative addressing: PC
- branching, BL and conditional branches
Relative addressing: register
- 5-bit encoded signed offset
- registers can change
Direct and Indexed addressing
Immediate mode
- putting 8 bits into the LSByte or MSByte
SIDE NOTE: for the xm23 emulator, implement the following functionalities
i: toggle single step mode
r: display registers
g: go
display start: <pc val> PSW, brkpt, clk val
end: PC val, clk val
b: set breakpoint
m: display memory (lower bound, upper bound) Index