Mario Sprites Problem

Discuss emulation of the Nintendo Entertainment System and Famicom.
User avatar
Anes
Posts: 717
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Mario Sprites Problem

Post by Anes »

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
Posts: 4148
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis

Post by Memblers »

Sounds like it could be a CPU bug. Do other games work ok?
User avatar
Disch
Posts: 1848
Joined: Wed Nov 10, 2004 6:47 pm

Post by Disch »

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: 22993
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)

Post by tepples »

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: 717
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Nestress

Post by Anes »

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 »

Do not trust it; I'm pretty sure there is something wrong with your ADC and SBC code (V flag).
User avatar
Anes
Posts: 717
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

adc implementation

Post by Anes »

sure, thanks i will try
ANes
User avatar
Zepper
Formerly Fx3
Posts: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil

Post by Zepper »

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: 717
Joined: Tue Dec 21, 2004 8:35 pm
Location: Mendoza, Argentina

Post by Anes »

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: 3262
Joined: Fri Nov 12, 2004 4:59 pm
Location: Brazil

Post by Zepper »

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: