Jump Table Dispatch
Implement a command dispatcher using a jump table so the branch cost does not grow with the number of commands, with a bounds check against an out-of-range index.
Constraints
- Command index in r0.
- Table has 8 entries.
- An index of 8 or more must branch to a default handler.
- Use a PC-relative table load.
- Must not fall through into the table data.
- Tail-call the handler rather than calling and returning.
1.global dispatch2dispatch:3 @ r0 = command index4 @ TODO5 bx lr