[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: 6502 illegal opcodes questions



John Selck wrote:
Am 18.05.2006, 16:14 Uhr, schrieb Paul Schlyter <pausch@saaf.se>:

Could you point at one single case where use of undocumented opcodes did
significantly speed up an application on the 6502 platform?


Bresenham interpolation.

Without illegal opcodes:

STA $12
TXA
STA $FE00,Y
TAX
LDA $12
SBC $10
BCS .skip
ADC $11
INX
..skip

With illegal opcodes:

SHX $FE00,Y
SBC $10
BCS .skip
ADC $11
INX
..skip

Best case: 21 vs 11 clock cycles (almost 2x speed with illegal)
Worst case: 25 vs 15 clock cycles (still 1.67x speed)

I note that the TAX in the first case is unnecessary, trimming the
best case advantage to 19 vs 11 cycles (1.7x) and the worst case
advantage to 23 vs 15 cycles (1.5x).

-michael

Parallel computing for 8-bit Apple II's!
Home page:  http://members.aol.com/MJMahon/

"The wastebasket is our most important design
tool--and it is seriously underused."