|
|
|
|
|
by kazinator
2930 days ago
|
|
What do you think about using 6C, indirect jump? Instead of a little thunk, some 16 bits of data can be set aside in a fixed location. We mutate only the low order address and then do an indirect jump through it. LDA OPTBL-2,Y
STA OPADDR
JMP (OPADDR)
The contents of OPADDR+1 is initialized once on entry into the interpreter. Or perhaps statically.Another thing would be self-modifying code (if we can forgo ROM-ming this, which Woz couldn't): the interpreter mutates the operand of an immediate JMP instruction to set up the address. That instruction then simply follows; there is no need to branch to it. Same as your thunk, but placed inline. Ah, the first machine language program I wrote was on the 6502 and used self-modifying code to march through the graphics buffer. Indexed addressing modes were the next chapter in the Rodney Zaks book. |
|
I doubt I ever used JMP indirect. For this sort of thing running from RAM, I'd typically use self-modifying code and a JMP absolute, which is where the idea of having a little thunk came from.