Ruud wrote:
Hallo André,
Implementation Specs:
"16 bit - ... the PC stays 16 bit": If I want to replace the 80286 of an IBM AT or the 68000 od an Amiga with your 16
-bitter, I need more addresslines.
This is only the first option. The PC is "just" an address register, which gets larger with the 32 and 64 bit options. There will be no 24 bit option, but you could decide to simply not use the upper bits. The interrupt vectors are considerably placed at the upper end (not the upper end of the lowest 64k but the upper end of the whole address space).
Quote:
"LongLong - equivalent to Q, deprecated": I tried Google etc. but cannot place 'deprecated'. Please explain.
"deprecated" basically means "outdated". Well, new spec and already outdated? :-) Actually I started to describe everything with "LL" for 64 bit, but I found other docs where 64 bit are noted with a "Q", so as I prefer single characters here, I'm moving to Q.
Quote:
"bit5 set to 0"
: Why, what is the advantage?
This is actually only used in the exception/interrupt stack frame, to detect the extended stack frame.
Quote:
"Prefix Overview":
- Please explain the role of Prefix1 and Prefix2; should both be used or just one? A later example just shows one. But how are you going then to combine certain features ???
There are 32 prefix1 values and 16 prefix2 values. Both can be placed before certain opcodes. Those opcodes that support both prefix can actually have both prefix bytes, prefix1, prefix2, then opcode. With two-byte opcodes, the full opcode can even be four byte now.
With the 32 prefix1 values you can define 5 bits, which I designed to define register/operand size (RS1/0), Address Offset (OF1/0) and Addressing Mode (AM). With prefix2 you can define 4 bits, 2 of which are currently defined: "no Zero extension" ZE and "User Mode" UM bits.
These 7 bits, 5 from prefix1 and 2 from prefix2 can be seen as opcode modifiers and one of the tables on the page shows which opcode can use which modifier.
Quote:
- Do we need an offset register?
Two things often pop up when discussing a 6502 extension, PC-relative and Stack Pointer-relative addressing. Using two bits I was able to define another register - "B"ase offset - which can be used as B-relative addressing. I also even think it is very useful for user-defined stacks. In object oriented languages it could point to the base address of the current object for example.
Quote:
- I don't see the need for a zero-extension bit. Using your own example:
LDA.W #$1234 = the 16 bits instruction
LDA.Z #$56 = lda #$56 of the original 6502. No Z-bit needed.
IMHO the RS0/RS1 covers the item. "STA32.B $12345678" only overwrites the address $12345678.
The zero extension bit comes in when writing a value to a register. A register is always full width (i.e. as wide as an address). So what should happen when you load a 16 or 32 bit register with an 8 bit value like
LDA #$12
Should only the lowest 8 bit be set in the Accumulator like in the 65816, keeping the upper 8 or 24 bit? Or should the upper bits be zero-extended like the index registers in the 65816? For the principle of least surprise I decided to always zero-extend, and provide a ZE bit to NOT zero-extend the value.
I have actually been thinking about providing two more extension modes: 1-extension, and sign-extension, where the latter takes the uppermost bit of the operand value and uses this to extend the value to the full register width.
Quote:
My view: The 6502 opcodes don't need a prefix byte. So you need three to tell wether it is a 16, 32 or 64-bits action. Add three to support another 256 extra opcodes/prefixes (which can cover the ideas you want and I don't understand :). Add six that cover the privileged mode. That totals twelve, multiply with four for RS0/RS1 and you get 48.
I'm almost with you there. Yes, where the extension bits are zero - for the original 6502 opcodes for example - no prefix bytes are needed. But what do you do when you combine 32 bit action with one of the extra opcodes and with privileged mode? You'd use 3 separate prefix bytes. Besides, 16/32/64 bit action ARE the RS0/1 bits!
Quote:
You see I discarded the AM bit. ZP stays ZP ie. just one byte. Absolute is the width of the addres bus. If you say "LDA $1234" on a 32-bitter, what are the highest 16 bytes? If you mean zeros, then use "LDA $00001234". OK, it will cost some extra memory but, hey man, you don't create a 32-bitter that can address up to 4 GB and then want to save a few bytes? :)
But then code for a 16 bit 65k would not run on a 32 or 64bit 65k processor. Not acceptable.
Quote:
"Offset":
Use a new opcode for instructions like LDA P,$1234 or LDA (P,$12),Y. You just got 256 new ones from me :)
But that's just 2 bits in my prefix codes :-)
Quote:
"Quick Opcodes":
Why don't you use prefix + two bytes? Costs one byte more but gives you a range from 1 to 255.
I was thinking along the lines of the CMOS BBR/BBS/SMB/RMB opcodes - I think I forgot them so far actually - which combine the actual bit number into the opcode. I think that's open for discussion.
Although it might be possible to put some special "shift by 8" code into the ALU, but certainly not a shift-by-256, while an INC-by-256 would work again. Multi-shift comes up sometimes in the extension discussion, INY #8 / INX #8 should in my opinion be a must with 64bit registers.
Not sure yet what I'll do, any more opinions?
Quote:
"Interrupts":
- What about using a 8259 or equivalent as interrupt collector? No extra pins needed.
Something like the 8259 is certainly a good idea. I'd want to keep the interrupt tables of the 6502 in memory though. But you're right, the processor could have different options in numbers of interrupt lines, with a byte as interrupt number, working similar to the trap table (unifying these two implementations, which is good).
I could reserve 128 vectors for interrupts and 128 vectors for aborts - where I am still not sure if I should really use the current design, as it limits the number of abort causes (and I already have another abort in mind - OPWIDTH: abort when a wide operation is executed in a smaller processor, like a 32 bit opcode in a 16 bit processor - which would fill up the currently reserved abort table)
Quote:
- Why is the standard word wide vector not good enough? If the 64 KB it covers isn't enough, just simply use a long jump outside the original 64 KB.
What would be the high word of the interrupt routine address? Would it be the same as the interrupt vector? Would be working. Would certainly make the implementation easier - but interrupt handling needs to be within the 64k, at least as you say a long jump. I'll probably just start with this option and see how it works. Other opinions?
Quote:
- Why didn't you keep the original order IRQ / RESET/ NMI for the three highest vectors?
Because there are many interrupts now, so I replaced IRQ with the BRK vector (which it now already is as well), and placed the interrupts elsewhere. Then NMI ended up elsewhere as well.
Many thanks for your comments, very much appreciated!
I hope I was able to answer your questions.
André