GARTHWILSON wrote:
It can be used with the index registers in 8-bit mode as well. The Eyes & Liechty programming manual specifically shows it in both 8- and 16-bit mode, on page 382 of my old paper copy. (The .pdf that was distributed until early last year didn't have the same page numbers.)
How the code below can be used with 8-bit XR?
Code:
lda #index ;zero-based routine index
asl a ;double it
tax ;now absolute index
jmp (table,x) ;goto routine
it may work only with 128 entries instead of 256...
BigEd wrote:
I see that it's inconvenient to have to account for the difference between the 02 and the C02. But, I think it may still be possible to use a 257 byte table which will suit both CPUs?
It is exactly the current code for 6502. One man spent hours trying to find out why this program working at C64 is not working with SuperCPU (65816) -
http://www.lemon64.com/forum/viewtopic.php?t=58674&postdays=0&postorder=asc&start=19#top. So I had to add one byte for 65C02 "feature". Of course,
Code:
ldx divisor
jmp (divjmp,X)
is better than the code for NMOS 6502. It is 3 bytes shorter and 3 cycles faster. This discussion helps me to realize this.
So it is the way I should use to prepare the specialized 65C02 version for BBC Micro. It is the only advantage of 65C02 usable in the spigot but the byte division is not exactly in the main loop so the advantage in speed will be less than ≈0.1%.
GARTHWILSON wrote:
The '816 has most of these, plus instructions and addressing modes that are totally impractical to do on the '02 at all. (Keeping with the topic title), PEA for example is a three-byte instruction that pushes a two-byte literal (its operand), which is typically an address but it can also be data, onto the stack, without affecting the processor registers. One use of it is to pass data to a subroutine. For a 6502 to synthesize it requires six instructions, and more if you need to save A. It's a similar story for PEI. PER requires 18 6502 instructions to synthesize (and more if you need to save A), 11 of those being in a subroutine. BRL (Branch Relative Long) and a four-byte (two-instruction) BSR (Branch to SubRoutine, or Branch, Saving Return address) with a 16-bit relative address are valuable, especially in relocatable code. So are the extra stack-addressing modes and the 16-bit stack pointer permitting much heavier use of the hardware stack for passing lots of parameters, as in C or recursive functions that may run the '02 out of stack space. Many features of the '816 make it far more suitable for multitasking.
You'd written about 65816 instructions. They are good and powerful indeed. I can only think that they can be better and faster. I bet for the segment registers, for example. I also bet for Z register of 4510 - it is much better the plain (zp) mode.
GARTHWILSON wrote:
BigEd wrote:
Just for historical interest, I had a look to see what's the earliest mention of this bug, and the earliest I found is a note by Heinz J Schilling in 6502 User Notes newsletter, issue 15, June 1979.
Thanks, Ed.
6502 development was beheaded so without "political cover" it was easily influenced by men who did not think primarily about this development but might have other aims.