We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I've been learning Arm32 assembly on my Raspberry Pi recently and all is going well but I would like to create a jump table and have no idea how. The bl (branch and link) instruction needs an address label, but I would like to simulate a switch statement by creating a jump table of addresses that can be jumped to but I don't know how to do this. As I'm emulating an 8-bit computer with 256 possible opcodes I need to be able to define 256 opcode handlers and set up a jump table containing the address of these handlers so I can bl to them based on the opcode as an index. How may I accomplish this task?
Many thanks in advance!
looks overly complicated
Pseudo code:
LD byte,[programcounter]
LD PC,[table+byte*8]
table:
long opcode0, opcode1, opcode2, opcode3
....
long opcode255
opcode0: