Posted Tue Oct 6, 2009 1:32 PM
Well, lets see... 6516 vs 65816.
The 6516 added pretty much all of what the 65C02 did and several features over the 65C02.
Pretty much everything the 65816 has minus the extended address buss features.
Direct Page register (Z)
The D register.
16 bit mode for X, Y and SP (A becomes D in 16 bit mode)
User defined flag and supporting instructions
The ability to directly push/pull all registers to/from the stack.
Some additional addressing modes.
You could reassemble 6502 code with minor changes to take advantage of any of those features.
Taking advantage of the 65816's additional features beyond the 6516 doesn't look so simple to me but I'm no expert on the 65816 by any means.
Most of the additions to the 6516 are borrowed from the 6809 but it falls a little short of the 6809.
B register is missing.
No multiply instruction.
No 2nd stack pointer.
6516 has to toggle between 8 and 16 bit modes where the 6809 has 8 and 16 bit instructions.
6809 uses a single instruction to PUSH/PULL multiple registers to/from the stack.
While the article says the missing items are no big deal, that's not quite so in reality.
MPY is definitely faster and as you do larger number multiplies where you may do several smaller multiplies to get the result it really adds up.
A later MICRO article said it was faster to transfer some math operations to a 6809 daughter card for the Apple II than to do them natively.
It can also make code smaller.
The 2nd stack pointer on the 6809 is regularly used as another index register and simulating additional stack pointers is slower.
Toggling modes clearly requires extra instructions and slower code as a result.
While it may not have equaled the 6809, I think the 16 bit registers and direct page register alone would have allowed programmers to write much faster code. Certainly eliminating much of the 6809's speed advantage.
The article's author suggests 30% faster code than a 6502 and I'd have to say at least that much.
Just as important, you can write smaller code allowing you to fit more in memory.
The gap between 6809 and 6516 would certainly have been much smaller than between 6502 and 6809.
The 6516 would probably have been cheaper as well.
I don't think the difference between 6516 and 65816 would have been more than a clock cycle here or there. The two chips appear very similar if you stay within 64K.
I ported some code from the Z80 (A simple music player for the AY sound chips) to the 6803, 6809 and 6502.
The 6803 code was much smaller than the 6502 even though the '03 only has one index register.
The 16 bit index register cut out a lot of the code the 6502 required and I think that is where the biggest gain would come.
The 6809 code was obviously the smallest and fastest.
Ultimately, there are times when having a B register is an advantage, times when having a Y register is an advantage, and even times when having an A register + B register make up the D register is an advantage... but having 16 bit registers almost always offered an advantage.
Even the 65C02's added features made the 6502 code a few instructions smaller and faster.
16 bit index registers eliminates the need for a lot of page zero use, freeing it for other things.
The 6516's larger stack and 16 bit registers would also support high level languages like C better.
I think supporting the added memory of the 65816 from C would be a little more complex but if you don't you have something similar to a 6809 C compiler, just added 8/16 bit mode instructions and no B register.
If Atari could have used the 6516 when the 8 bit computer was introduced it would have had a HUGE advantage in processing power over competitors at the time.
Programmers could have easily ported code to it and optimized crucial sections of code for more speed.
They could have also ported code from it, working backwards from the faster code to strait 6502 code while running both on the same machine.
Larger programs could have fit on carts without paging.
Faster built in math and as a result, faster Atari BASIC.
You name it, the Atari would have benefited.
Now, does the 6516 offer any advantage over the 65816? Given the comments from the IIgs community on 65816 compatibility I'd say no. Most IIgs compatibility issues were due to a change in the drive controller, not the 65816. Adding an old controller and drives let you run almost all the old software. Only a handful didn't run due to the 65816 (that was the word from the IIgs community anyway).
If you are implementing the 6516 in an FPGA you could possibly throw in some optimizations that would make it worthwhile. Maybe cache the current memory page and direct page to cut cycle times when cache is enabled. Otherwise the 65816 pretty much does what the 6516 does and more.
I think I would examine the instructions and address modes very carefully and only support those on the 65816. That way the 65816 would still be in the migration path.