I have to express my admiration for Hitachi 6309 chip. It can even divide! So I have to say that it is a bit sad that due to a kind of grey power 8-bit systems had not reached their top possibilities.
We can only have dreams about them. IMHO MOSTEC team might create something much better than 6309 if they had the opportunity.
BigDumbDinosaur wrote:
If using the 65C02 or 65C816, there is the JMP (<addr>,X) instruction, which requires no preparation of any jump vectors. You use it with a table containing 16 bit addresses in little endian order. The following code does the work:
This code requires 16 bit in XR. So it is impossible for 65C02. It may be used with 65816 but requires rare 16-bit index registers mode.
Klaus2m5 wrote:
That's simply because it doesn't work.
It is because the right working example was just ignored.
So I had to make a "fast and dirty" example which shows only the right idea without 100% correctness. Anyway, thank you very much for analyse of the example. However, I repeat, this example is artificial. The natural example was the first. It is taken from the code of still the fastest 6502 division for
http://forum.6502.org/viewtopic.php?f=2&t=4185. So I have to add more explanations to it. The spigot algorithm uses only the odd divisors so as the specialized division for it. So the only one 256 bytes table for the odd divisors is required. The used code is very easy and fast
Code:
ldx divisor
stx mjmp+1
mjmp jmp (divjmp)
The
divjmp table for CMOS 6502 has to have an
ugly 1 byte displacement. It maybe considered as a bug.
This example also shows that it doesn't allow to use bit 7 instead of bit 0.
GARTHWILSON wrote:
JMP (<addr>) is not a ZP instruction.
It is not any kind of 6502 absolute address too. JMP (addr) is the special addressing mode for this instruction only. It is perfectly documented in the original 6502 manuals:
MOS Technology 6500 Series Hardware Manual
MOS Technology 6500 Series Programming Manual
NMOS 6502 works fine according its specification. So it is CMOS 6502 which has a JMP (addr) bug. IMHO CMOS 6502 is a step in the wrong direction. It is the direction to decline 6502.
Almost all of its additional instructions have very little importance. They may make codes slightly faster and smaller but in the completely tiny scale. I can estimate less than 2% smaller size and less than 1% faster speed. I want only BIT #imm and DEA, INA of its instructions. Even the useful BIT #imm can't set N and V flags.
Sometimes 65c02 is even slower than 6502.
The major evil of CMOS 6502 is the occupation of the valuable opcodes by these unimportant instructions. This had halted the natural development of 6502. 65816 and even 4510 had to follow this heavy and bad inheritance.
Instead of these "occupants" maybe placed much more powerful instructions: 16 bit arithmetic, POP XY, PUSH XY, work with two (or more) segment registers (it might give short and fast operations with 20 or 24 address bus and the relocation of codes), 16-bit accumulator, maybe another 16 bit accumulator, etc.
I have also to note that we have tens of thousands (or even more) ML programs for NMOS 6502...
GARTHWILSON wrote:
That's one reason I'm intrigued by Jonathan Halliday's
preemptive multitasking GUI OS for Atari 6502 computers.
Thank you. I missed this great project. It looks much better than GEOS but requires a lot of fine applications to match it.