Hi Jecel,
I’ve been looking at the 6809 instruction set.
Isetta can handle opcodes that are multiple bytes long.
But this is most effective when the actions of these opcode bytes are independent.
As an example, let’s take the bit-set instructions SET 1,(hl) and SET 1,(IX+5) in Z80 mode.
For the SET 1,(HL) (instruction CB CE), the opcode starts with a 0xCB code that tells to the processor that this is a bit-or-shift instruction.
The 0xCB will put the registers H and L into the HW memory pointer DPH/DPL. It will
then execute the next opcode (0xCE), using the code page that implements the bit-or-shift instructions.
The bit-or-shift instruction can use a single register (A, B … H) but can also operate on (HL), and in that case it will use the byte that DPH/DPL points at.
Now for the SET 1,(IX+5). (instruction DD CB 05 CE)
The first opcode ix 0xDD, indicating that a normal instruction follows but HL is to be replaced by IX+5.
It will now read the next opcode, and use a code page that is special for the IX register. Here it will find the 0xCB opcode. But in this IX page, the 0xCB opcode will put the IX register in the DPH/DPL register. It will also read the displacement value from the following instruction byte (0x05) and add that to the DPH/DPL register (as a signed value).
Now it will get the next opcode, that is the bit-or-shift instruction 0xCE.
Now the bit-or-shift instruction executes the opcode CE. It is exactly the same as for the (HL) case. It will set bit 1 in the memory location that DPH/DPL points at. Note that this bit-or shift instruction has not the faintest idea if it handles a bit at (HL) or at (IX+d). The handling of the CE opcode is independent from the things that happened before it, in the same instruction.
Back to the 6809.
It will get the first opcode byte and put it in the instruction register.
If it is an instruction with indirect addressing, it will get the postbyte and put that in the instruction
register. It will calculate the effective address and put that in DPH/DPL. But now it has to
figure out what to do with the address. That information is in the first opcode byte, that is already gone !
We could re-fetch it, but that would mean decrementing the program counter. The PC can increment in the same cycle as an opcode fetch, but decrementing it will be clumsy.
We could also, when we are handling the first opcode byte, store that byte somewhere, so it is available to re-execute that (in another code page, with other actions) after the address has been calculated. So that will also need extra cycles that will make executing 6809 code not very effective.
Having two opcode bytes can be quite effective on Isetta, but we must split the instruction in independent sections.
For example, the first opcode byte could calculate an effective address and put that in DPH/DPL. The second opcode would then specify an action with the data that DPH/DPL points at. Or, the first opcode byte could fetch a value (this could also be an immediate value fetched from the instruction stream). This could also be a word (one byte in A and the other one in T). The second byte should then specify
what to do with that value. Both systems (effective address, or value) could also be combined in a single instruction set.
It might be possible to re-define the 6809 opcodes, to be effectively executed on Isetta.
But since there are so many (memory-based) registers, we could define a new instruction set inspired by the 68K, with 8 data registers (16 bit) and 8 address registers (also 16 bit).
NB Your “no pun intended” did put a smile on my face.