Hacker News new | ask | show | jobs
by eddie_catflap 406 days ago
I remember the knowledge/idea of illegal opcodes for the C64 slowly making their way through the hacker/cracker community. Like secret knowledge being distilled back then via BBS
1 comments

they were quite useful. I distinctly remember there were undocumented NOPs consuming a different number of cycles than the default one EA. These were fe used to pad raster line interrupt routines with cycle precision. (damn, I'm old)
IIRC the "normal" NOP took 2 cycles, so we used the illegal ones to waste an odd number of cycles for accurate raster line timing.
It's not like it's hard to find a harmless 3 cycle instruction.

For example Store A/X/Y to any unused/scratch Zero Page location.

Or condition branch to the next instruction using a condition known to be true .. BCC/BCS is often the most convenient. Or just JMP to the next instruction, though it's 3 bytes of code instead of 2.

INC/DEC of a scratch Zero Page location is useful for a 5 cycle delay in 2 bytes of code if you don't mind changing NZ flags, but the store/branch/jump alternatives don't even do that.

What do you mean by "fe"? "For example "?