zlacker

Extra Instructions Of The 65XX Series CPU (1996)

submitted by embedd+(OP) on 2025-12-06 00:38:50 | 70 points 14 comments
[view article] [source] [go to bottom]

NOTE: showing posts with links only show all posts
◧◩◪
4. cyco13+ac[view] [source] [discussion] 2025-12-06 02:41:53
>>embedd+C7
These instructions were not intentionally designed and put in there in secret. They're simply an unintended consequence of the "don't care" states of the instruction decoding logic.

The decoder is the part of the CPU that maps instruction opcodes to a set of control signals. For example "LDA absolute" (opcode 0xA5) would activate the "put the result in A" signal on its last cycle while "LDX absolute" (opcode 0xA6) would activate the "put the result in X" signal. The undocumented "LAX absolute" (opcode 0xA7) simply activates both because of the decoder logic's internal wiring, causing the result to be put in both registers. For other undocumented opcodes, the "do both of these things" logic is less recognizable but it's always there. Specifically disallowing these illegal states (to make them NOPs or raise an exception, for instance) would require more die space and push the price up.

See here[1] for example to get a sense of how opcode bits form certain patterns when arranged in a specific way.

  [1] https://www.nesdev.org/wiki/CPU_unofficial_opcodes
◧◩◪◨
5. Nobody+We[view] [source] [discussion] 2025-12-06 03:10:53
>>kimixa+1b
That's exactly right. There's a really good article about it here: https://www.pagetable.com/?p=39
6. ruk_bo+rs[view] [source] 2025-12-06 06:03:27
>>embedd+(OP)
A nice guide on how to actually put those ”illegal opcodes” into work is ”No More Secrets”

https://csdb.dk/release/?id=248511

8. JetSet+nI[view] [source] 2025-12-06 10:03:48
>>embedd+(OP)
A couple of threads on AtariAge are exploring the possibility of using the "unstable" opcodes in this group (ARR, etc.) as a sort of fingerprint. The hope is that the instability is a prediction of the specific model of CPU. To what end I'm not sure of yet, but it's interesting research all the same.

https://forums.atariage.com/topic/385516-fingerprinting-6502... https://forums.atariage.com/topic/385521-fingerprinting-6502...

11. djmips+i81[view] [source] 2025-12-06 14:40:11
>>embedd+(OP)
a good essay on how they work https://www.pagetable.com/?p=39
◧◩
14. Scaevo+uH2[view] [source] [discussion] 2025-12-07 06:46:41
>>djmips+i81
He went even farther, decapping the CPU and reverse engineering its entire workings to understand how each "undocumented" opcode functioned: https://www.pagetable.com/?p=517
[go to top]