MicroCoreLabs / Projects

Ted Fried's MicroCore Labs Projects which include microsequencer-based FPGA cores and emulators for the 8088, 8086, 8051, 6502, 68000, Z80, Risc-V, and also Typewriter and EPROM Emulator projects. MCL51, MCL64, MCL65, MCL65+, MCL68, MCL86, MCL86+, MCL86jr, MCLR5, MCLZ8, MCL6809, XTMax
399 stars 80 forks source link

ADC/SBC buggy? #5

Closed GrantMeStrength closed 2 years ago

GrantMeStrength commented 3 years ago

Hi -

I am wondering if you have checked your (beautifully neat) 6502 implementation against a respected test such as Klaus2m5?

I ask because I have been testing my own emulation, and I have trouble with the notorious ADC/SBC opcodes. When I tried your implementations it also failed.

I see in your code the line:

if ((0x00FF&bcd_total) > 0x09) { bcd_total=bcd_total+0x010; bcd_total=bcd_total-0x0A; }

which contains a reference bcd_total before it has been assigned a value, thus the condition is never true. Maybe you missed something?

thanks!

-John

MicroCoreLabs commented 3 years ago

Hi,

Thanks for your email! Youre correct that the bcd_total is left-over code which is not used. I will clean it up...

Yes, I definitely ran Klause's tests and they all passed.. even the BCD as far as I know... I think I also ran another BCD test too...

I will check again though.. maybe I passed Klaus's test with the BCD tests optioned out... Ill take a look.

Were you able to get my code to pass the BCD test? If so, what was the mistake in my code? 🙂

Thanks again, -Ted


From: John Kennedy @.> Sent: Tuesday, March 23, 2021 11:45 PM To: MicroCoreLabs/Projects @.> Cc: Subscribed @.***> Subject: [MicroCoreLabs/Projects] ADC/SBC buggy? (#5)

Hi -

I am wondering if you have checked your (beautifully neat) 6502 implementation against a respected test such as Klaus2m5https://github.com/Klaus2m5/6502_65C02_functional_tests/blob/master/6502_functional_test.a65?

I ask because I have been testing my own emulation, and I have trouble with the notorious ADC/SBC opcodes. When I tried your implementations it also failed.

I see in your code the line:

if ((0x00FF&bcd_total) > 0x09) { bcd_total=bcd_total+0x010; bcd_total=bcd_total-0x0A; }

which contains a reference bcd_total before it has been assigned a value, thus the condition is never true. Maybe you missed something?

thanks!

-John

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHubhttps://github.com/MicroCoreLabs/Projects/issues/5, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM4AVELRSFRYDVEWOYRMWQ3TFGDCNANCNFSM4ZWUIMOA.

GrantMeStrength commented 3 years ago

I am still trying to get ANY BCD code to pass the tests, mine or yours. If yours is good, the issue is elsewhere in my code and I apologize for suggesting otherwise :-)

I know that the first time I ran Klause's test my code passed and I was delighted - and then I remembered BCD testing was off, and turned it on, and was less delighted ;-)

MicroCoreLabs commented 3 years ago

Im confident that you'll get it. 🙂 Thanks for catching the stale code in my BCD algorithm!

Best of luck!

-Ted


From: John Kennedy @.> Sent: Wednesday, March 24, 2021 4:25 PM To: MicroCoreLabs/Projects @.> Cc: MicroCore Labs @.>; Comment @.> Subject: Re: [MicroCoreLabs/Projects] ADC/SBC buggy? (#5)

I am still trying to get ANY BCD code to pass the tests, mine or yours. If yours is good, the issue is elsewhere in my code and I apologize for suggesting otherwise :-)

I know that the first time I ran Klause's test my code passed and I was delighted - and then I remembered BCD testing was off, and turned it on, and was less delighted ;-)

— You are receiving this because you commented. Reply to this email directly, view it on GitHubhttps://github.com/MicroCoreLabs/Projects/issues/5#issuecomment-806247758, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AM4AVEJDNTDQSK27EVHJYDTTFJYIPANCNFSM4ZWUIMOA.