QFT. The only thing to keep in mind is the actual NES behaves a certain way on these instructions and that unless you have good reason to use them, don't use them in your own projects. But if writing a NES emulator, you need to keep in mind some software might use/abuse them. However in my experience with emulation, no game I encountered ever executed an undocumented opcode unless the emulator had a bug/crash like incorrect bankswitching and jumping to code that wasn't there.tokumaru wrote:What I really want to know is, after you guys finish this arguably pointless discussion, how do you plan on making this new name official, considering that the presence of the 6502 is much wider than its use on the NES. We can't even change stuff that only pertains to the NES (iNES header, for example)!
I thought it very odd that I would see Nintendo using illegal opcodes. From reading this thread, it seems like it's really odd. I can provide more detail about where and what opcodes I'm seeing. I think some are double nops, but I was going to put those sections of bytes through an illegal opcode enabled disassembler before I made any serious attempts to figure out what's going on.
Byte offsets? I just disassembled $8000-$80C2 and didn't see any. (image CRC32: 45B180F7)puzzud wrote:[in Duck Hunt VS] not too long after the RESET vector, the code path encounters illegal opcode
Code: Select all
P_80B6 ; [80B6] lda Z_24 beq A_80BD jmp J_8101 ;  A_80BD ; [80BD] lda Z_25 jsr P_85B3 ; [85B3] tax !byte $82 ; illegal opcode E_80C4 ; [80C4] !byte $D4 ; . E_80C5 ; [80C5] !byte $9C ; . E_80C6 ; [80C6] ora Z_9D !byte $1C ; illegal opcode E_80C9 ; [80C9] sta A_A9A3,X cmp A_6D87,Y txa !byte $AF ; illegal opcode E_80D1 ; [80D1] !byte $89, $16, $AC, $4E, $AC, $6D, $AC ; ...N.m. !byte $EF, $AC, $A3, $A9, $FC, $80, $62 ; ......b !byte $A0, $D9, $87, $D9, $87, $C2, $84 ; ....... !byte $34, $88, $55, $B2, $81, $B2, $B6 ; 4.U.... !byte $B2, $CE, $B7, $17, $BA, $E6, $B7 ; ....... !byte $48, $83, $22, $81, $1F, $82, $27 ; H."...' !byte $9A, $A9, $0A, $85, $25, $60 ; ....%` J_8101 ;  lda Z_26 jsr P_85B3 ; [85B3] !byte $92 ; illegal opcode E_8107 ;  sty A_8CC8 !byte $13 ; illegal opcode E_810B ; [810B] sta A_8E1D lsr Z_8E !byte $5A ; illegal opcode S_8111
Which look like plausible jump targets. For reference: viewtopic.php?f=10&t=8956
Code: Select all
__85b3: STX $27 ; $85b3: 86 27 STY $28 ; $85b5: 84 28 ASL ; $85b7: 0a TAY ; $85b8: a8 INY ; $85b9: c8 PLA ; $85ba: 68 STA $14 ; $85bb: 85 14 PLA ; $85bd: 68 STA $15 ; $85be: 85 15 LDA ($14),y ; $85c0: b1 14 TAX ; $85c2: aa INY ; $85c3: c8 LDA ($14),y ; $85c4: b1 14 STA $15 ; $85c6: 85 15 STX $14 ; $85c8: 86 14 LDX $27 ; $85ca: a6 27 LDY $28 ; $85cc: a4 28 JMP ($0014) ; $85ce: 6c 14 00
@hcs, just confirmed those vectors are all valid code. So much for fully automated disassembly. At least I can start identifying these locations are data vs code.
Now I feel silly . Thanks for both of your help.