6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri Sep 27, 2024 11:27 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Wed Jul 16, 2008 3:32 am 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
I had memory back in time when I played with Apple II Plus. Apple II Plus uses an original 6502 microprocessor chip. Few software programs use illegal instructions because some illegal instructions treated like NOP. Only 65C02 added NOP to all illegal instructions.
Try to compare Opcode -- 02 and 03 or 13. If you use Opcode -- 02, 6502 MPU is frozen until you pull RESET' line low to restart. A question is why can't Opcode 03 or 13 be frozen until you pull RESET' line low to restart.
Possibly, Opcode 13 is like immediate. You enter the code 13 03 = ??? 03. It treats NOP. You can try to enter the code 13 08 = ??? 08. It treats frozen until you pull RESET' line low.
Let me give you an example code.

2000: LDY #00
2002: LDA #00
2004: 13 03 (??? # 03)
2006: NOP
2007: STA 3000,Y
200A: INC 2003
200B: INY
200E: BNE 2002
200F: RTS

Notice 200A: INC 2003? It is not a practice to modify code when it is supposed to modify data outside of code. Anyway, LDA #00 can be replaced to LDX #00, but I don't trust INX and DEX because illegal instructions might modify Accumulator register, Index X register, and Index Y register. It is best to modify inside code at run time while one byte in a code can be loaded into register again from memory.
Type "2000G" to run a program couple times. Then type "3000.30FF" to examine data in memory. Notice that memory reads 00 01 02 03 04 .... FF. Try to modify from ??? 03 to ??? 01 or ??? 02 and run again. Notice data in the memory? It does not look like real random. Run "2000G" again two or three more times until memory reads 00 01 02 03 04 .... FF.
Try to modify and use ??? 08 and so forth. You may notice that 6502 MPU is frozen until you pull RESET' line low.
Please let me know what you think. You can invest your time to try and play with my code. You can try to reproduce 6502 bug!
I like to do my experiment to reproduce bug when ADC and SBC use decimal mode. They claim Overflow flag has bug as invalid with invalid Negative flag, Zero flag, and Carry flag. However, in my conclusion, Overflow flag is 100% correct while in decimal mode!

Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jul 18, 2008 9:46 pm 
Offline

Joined: Wed Oct 22, 2003 4:07 am
Posts: 51
Location: Norway
I don't know what bug the code is supposed to show. That executing illegal opcodes leads to various undefined results is no surprise, that's why they're called illegal opcodes.

All the illegal opcodes have been documented in various texts, like this one: http://www.ffd2.com/fridge/docs/6502-NMOS.extra.opcodes

the 6502 have some real bugs (like jmp ($xxFF)), but they have also been documented.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jul 18, 2008 10:47 pm 
Offline

Joined: Tue Dec 25, 2007 4:57 am
Posts: 109
Thanks for the information. I am impressed to see extra instructions as illegal instructions on an original 6502 MPU. A question can't be answered. How do they know to figure out themselves? Did they use logic analyzer to count the clock cycle on all illegal instructions except $X2?

Do you want me to publish ADC & SBC in Decimal Mode bug? It can explain how to reproduce 6502 bug to show invalid Negative flag and Zero flag from my C++ source code. I always tell the truth that Overflow flag is the 100% correct using decimal mode on an original 6502 MPU!! I wonder why they claim to say -- Overflow flag is invalid. No. I can prove it.

Bryan Parkoff


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri May 08, 2009 7:48 pm 
Offline

Joined: Fri May 08, 2009 6:22 pm
Posts: 4
$13 $03 - undocumented SLO ($03),Y, equivalent of ASL ($03),Y + ORA ($03),Y. so code result depend on content of $03/$04 :)

02,12,02,32,42,52, 62,72,92,B2,D2,F2 known as KIL, they completely stop cpu, block even NMI


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 16 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: