Mario Sprites Problem

Discuss emulation of the Nintendo Entertainment System and Famicom.

Moderator: Moderators

Post Reply
User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Mario Sprites Problem

Post by Anes » Sat Dec 25, 2004 12:36 am

i have problems emulating super mario bros.
Mario sprites itself goes to position x = 0 after scrolling 128 pixels, and after that mario's sprites are animated but i cant move it.

Help please :(
ANes

User avatar
Memblers
Site Admin
Posts: 3903
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers » Sat Dec 25, 2004 8:06 am

Sounds like it could be a CPU bug. Do other games work ok?

User avatar
Disch
Posts: 1849
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch » Sat Dec 25, 2004 10:45 am

Sounds almost like a V flag problem (bad wrapping at 128 could be because the V flag is being set wrong on ADC/SBC)

Double check your ADC/SBC. For ADC... the V flag should be set when:

Positive + Positive = Negative
or
Negative + Negative = Positive

In all other instances of ADC, the V flag should be cleared.


Likewise for SBC... V flag is set when:

Positive - Negative = Negative
or
Negative - Positive = Positive

tepples
Posts: 22361
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples » Sat Dec 25, 2004 2:38 pm

You can make SBC always work by implementing SBC in terms of ADC: load the operand from memory as normal, invert it (^ 0xff), and then do your ADC code. Reducing complexity of your emulator's 6502 core is a good thing.

User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Nestress

Post by Anes » Sat Dec 25, 2004 6:02 pm

I have tested my cpu with nestress rom and it throw me all "ok"
do i have to trust in that?

Thanks
ANes

Hyde
Posts: 101
Joined: Mon Sep 27, 2004 11:51 pm

Post by Hyde » Sat Dec 25, 2004 7:00 pm

Do not trust it; I'm pretty sure there is something wrong with your ADC and SBC code (V flag).

User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

adc implementation

Post by Anes » Sat Dec 25, 2004 7:23 pm

sure, thanks i will try
ANes

User avatar
Zepper
Formerly Fx3
Posts: 3248
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Sun Dec 26, 2004 12:29 pm

tepples wrote:You can make SBC always work by implementing SBC in terms of ADC: load the operand from memory as normal, invert it (^ 0xff), and then do your ADC code. Reducing complexity of your emulator's 6502 core is a good thing.
Really? That's pretty good...
Is there any other similar case?

User avatar
Anes
Posts: 621
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Post by Anes » Sun Dec 26, 2004 3:27 pm

Fx3 wrote: Really? That's pretty good...
Is there any other similar case?
Fx3 if you read carefully Mos 6502 manual, it says that the processor is always really adding. It inverts the bytes of the source, add carry and then add. :D
ANes

User avatar
Zepper
Formerly Fx3
Posts: 3248
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil
Contact:

Post by Zepper » Mon Dec 27, 2004 5:56 pm

Anes wrote:
Fx3 wrote: Really? That's pretty good...
Is there any other similar case?
Fx3 if you read carefully Mos 6502 manual, it says that the processor is always really adding. It inverts the bytes of the source, add carry and then add. :D
Actually, it inverts the BITS of the data (byte)... :roll:

Post Reply