Hi EEye
I've been thinking about what I'd do, and I'd like to get my thoughts down. It would be great if the two of us could agree on this, although I know we differ at present.
I can see a way to have a regular instruction encoding and a simple extension of the assembly language syntax - very simple to explain and hopefully not too difficult to implement in an assembler. These are important points if we want a core which people will make use of.
I might take some presentation ideas from John West's
65020 document. Also, for register naming, I like Notch's idea from DCPU-16 of using letters which indicate the intended conventional use - even if all registers function the same way. (In that case, the
v1.1 spec names A, B, C, I, J, X, Y, Z.)
So, my idea is:
16 registers, including A, X, Y and S
all can function as accumulators (for logic and arithmetic operations)
all can function as index registers
Perhaps name them A, B, C, D, E, F, G, H, I, J, K, V, W, X, Y, S
Long distance shift
The syntax of most instructions is very familiar, except A, X and Y can be replaced by any register letter
Code:
LDA (zp),Y
LDB (zp),E
LDC (zp),W
For arithmetic we need a syntax extension to name the source and target register (which is always the same)
Code:
ADC B abs,W
EOR C zp,X
AND J (zp,F)
Long distance shift needs an extension too:
Code:
ASL #5 X
ROR #6 abs
LSR #7 abs,D
The inter-register transfers look like yours:
Code:
TXA
TYB
TVW
TAS
As for the instruction encoding, it's simple: two 4-bit fields in the top of the instruction. One selects the destination register for those opcodes which need it. The other selects the index register for those opcodes which need it. In the case of shifts, the shift distance is in the register field except for register shifts. In the case of inter-register transfers, the source register is in the index field. That's it.
If we load all these features onto LDA, STA and TXA then we have the choice of freeing up existing opcodes for LDX, LDY, STX, STY and the other T opcodes. (I haven't thought that detail through!)
For the implementation I think it should be a matter of a 16-way mux directing the appropriate index register into play for each of the existing addressing modes, and a 2-way mux in the decoder. As we know, decode is not the critical path.
We gain a lot in simplicity and regularity. The resultant machine, and assembly code, still looks familiar to a 6502 assembly language programmer, and if they don't need all the registers they can use A, X and Y as before but they gain some more addressing modes. In fact a 4-register or 8-register version would make sense and just gives a few extra registers.
(Ah well, I didn't use John's presentation...)
What do you think?
Cheers
Ed