View Single Post
Old November 1st, 2007   #10 (permalink)
Dwedit
Registered User
 
Join Date: May 2007
Location: Chicago
Posts: 20
In GB.c, the fix to that switch block would have the effect only in rare situations where the program counter was into a bad memory area usually not containing code. If not fixed, it would just execute NOPs while in there. If fixed, it would fetch instructions from the hardware registers area.
Double check the ASM code generated by the invalid switch block, if the compiler just removes all of it, the the invalid switch block may have been a perverse "optimization". Otherwise, put it back in for the sake of accuracy.
Also, double check the part with mapperReadRam, it looks like it may fall back to reading from mapper ram anyway even if mapper ram is disabled or absent? I would think it would read some junk value instead, but I don't have a GB devkit to find out what it should read.

The GB echo ram bug is clearly visible, though it only affects games which read and write to out of bounds memory.
You can see the bug in Super Mario Land 2 (version 1.0).
# Enter a level previously cleared (Pumpkin Zone 1 is a great place to try this)
# Go down a pipe
# While going down the pipe, press Start then Select to exit the level
# Re-enter the level, mario will pipe down through the floor.
# The visible level becomes the Echo RAM area of memory.
## If emulated correctly, you will get empty space in pumpkin zone 1.
## If emulated incorrectly, you get a screen full of breakable blocks.
VBA versions prior to the fix gave a screen full of breakable blocks, because they made echo ram separate memory instead of a mirror of main memory. (Man, GB programmers would have killed for an extra 8k of ram!)
Fixed VBA versions will behave correctly, and get the screen of empty space.

VBA Rerecording 20 uses the newer GB emulation code, and that has the echo ram bug fixed.

I also made a custom VBA build and released it to the internet, it's called "vba_romwrite". It's identical to stock vba from sourceforge, but the cartridge rom area is writable. I made that version so I could test code designed to run on an M3.

Last edited by Dwedit; November 1st, 2007 at 05:31.. Reason: clarify SML2 part
Dwedit is offline   Reply With Quote