I will shortly publish the fixed ROM on the CreatiVEmu website as well as other updates.
Thanks!
Recover damaged CPU Diagnostic ROM
Re: Recover damaged CPU Diagnostic ROM
Hi,
i just gave the diag ROM a go on the real hardware and it works as expected...
Cheers, TOM:0)
i just gave the diag ROM a go on the real hardware and it works as expected...
Cheers, TOM:0)
http://www.8bit-homecomputermuseum.at Find me here...
Re: Recover damaged CPU Diagnostic ROM
Thanks Tom, thats great result!
I feel now confident to burn the fixed ROM into a brand new EPROM chip and solder it back to where it belongs
I feel now confident to burn the fixed ROM into a brand new EPROM chip and solder it back to where it belongs
- wavemotion
- Posts: 8
- Joined: Sat Jul 15, 2023 1:12 am
Re: Recover damaged CPU Diagnostic ROM
Incredible work, Óscar!
Looks like the CreatiVision emulator (and my ColecoDS) use the same 6502 emulation core and it also fails. At first it looked like I was getting illegal opcodes (0x34 and 0x37) but after talking with Óscar, he is fairly sure there are no undocumented opcodes being used... so it's debug time!
With Óscar's help, I found the culprit for ColecoDS. I'm sure any emulator that is using the same M6502 core will have the same bug - it's in the ADC (Add with Carry) and Decimal Mode. The missing line is pointed to below:
This is also the reason why some games (like Sonic Invaders) under emulation would show HEX digits (A-F) in the score... that's this bug!
Looks like the CreatiVision emulator (and my ColecoDS) use the same 6502 emulation core and it also fails. At first it looked like I was getting illegal opcodes (0x34 and 0x37) but after talking with Óscar, he is fairly sure there are no undocumented opcodes being used... so it's debug time!
With Óscar's help, I found the culprit for ColecoDS. I'm sure any emulator that is using the same M6502 core will have the same bug - it's in the ADC (Add with Carry) and Decimal Mode. The missing line is pointed to below:
Code: Select all
#define M_ADC(Rg) \
if(R->P&D_FLAG) \
{ \
K.B.l=(R->A&0x0F)+(Rg&0x0F)+(R->P&C_FLAG); \
if(K.B.l>9) K.B.l+=6; \
K.B.h=(R->A>>4)+(Rg>>4)+(K.B.l>15? 1:0); \
if(K.B.h>9) K.B.h+=6; \ // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< !!!
R->A=(K.B.l&0x0F)|(K.B.h<<4); \
R->P=(R->P&~C_FLAG)|(K.B.h>15? C_FLAG:0); \
} \
else \
{ \
K.W=R->A+Rg+(R->P&C_FLAG); \
R->P&=~(N_FLAG|V_FLAG|Z_FLAG|C_FLAG); \
R->P|=(~(R->A^Rg)&(R->A^K.B.l)&0x80? V_FLAG:0)| \
(K.B.h? C_FLAG:0)|ZNTable[K.B.l]; \
R->A=K.B.l; \
}