VisualBoyAdvance has many major bugs regarding Echo Ram (E000-FDFF) on the GB/GBC. It treats the echo ram as a separate block of memory instead of a mirror of (C000-DDFF).
I've gone through GB.cpp and found a list of which lines need to be changed:
gbCopyMemory function is not echo-ram aware. Needs a check to see if the source address is in Echo Ram area, then subtract 0x2000 from the source address.
We don't need to validate the destination address, since it only DMAs to either OAM or VRAM.
Replace it with:
Code:
void gbCopyMemory(u16 d, u16 s, int count)
{
if (s>=0xE000 && s<0xFE00)
{
s-=0x2000;
}
while(count)
{
gbMemoryMap[d>>12][d & 0x0fff] = gbMemoryMap[s>>12][s & 0x0fff];
s++;
d++;
count--;
}
}
gbWriteMemory needs this change:
Replace this:
Code:
if(address < 0xfe00)
{
gbMemoryMap[address>>12][address & 0x0fff] = value;
return;
}
with this:
Code:
if (address<0xE000)
{
gbMemoryMap[address>>12][address & 0x0fff] = value;
return;
}
if(address < 0xfe00)
{
gbMemoryMap[(address-0x2000)>>12][address & 0x0fff] = value;
return;
}
gbReadOpcode is just really bad code, it has a major bug in that the switch statement doesn't do anything!
Replace the switch:
Code:
switch(address & 0xf000)
with this:
Code:
switch((address>>12) & 0x000f)
Then right before the last return add this:
Code:
if (address>=0xE000 && address<0xFE00)
{
return gbMemoryMap[(address-0x2000)>>12][address & 0x0fff];
}
gbReadMemory needs this right before the last return:
Code:
if (address>=0xE000 && address<0xFE00)
{
return gbMemoryMap[(address-0x2000)>>12][address & 0x0fff];
}
I already posted this on the TASVideos forum for the guy who maintains the re-recording version, and I'm posting here too.
VBA CVS Version does NOT have the bug.
VBA-S 31.07.2006 does NOT have the bug.
Costis's version 1.80 does NOT have the bug.
VBA-rerecording-19 has the bug.
Official VBA Source code 1.7.2 has the bug.
Forgotten's 1.8.0 beta 3 has the bug.
VBA Smooth 6.5 has the bug.
Collectors Edition 1.0 has the bug.
So it only affects the outdated forks. Someone really needs to get the fixed-up VBA source code out there so that programmers don't base their versions on an old buggy version!
Last edited by Dwedit; May 29th, 2007 at 21:15..
Reason: Researched bug's propogation