Reverted to revision 2 of GB.cpp, on advice from Dwedit

This commit is contained in:
mudlord 2007-11-01 06:43:27 +00:00
parent 94e3698ba9
commit cb3bac591d
1 changed files with 12 additions and 30 deletions

View File

@ -586,12 +586,7 @@ bool gbIsGameboyRom(char * file)
void gbCopyMemory(u16 d, u16 s, int count)
{
if (s>=0xE000 && s<0xFE00)
{
s-=0x2000;
}
while(count)
{
while(count) {
gbMemoryMap[d>>12][d & 0x0fff] = gbMemoryMap[s>>12][s & 0x0fff];
s++;
d++;
@ -674,16 +669,10 @@ void gbWriteMemory(register u16 address, register u8 value)
return;
}
if (address<0xE000)
{
if(address < 0xfe00) {
gbMemoryMap[address>>12][address & 0x0fff] = value;
return;
}
if(address < 0xfe00)
{
gbMemoryMap[(address-0x2000)>>12][address & 0x0fff] = value;
return;
}
if(address < 0xff00) {
gbMemory[address] = value;
@ -1166,7 +1155,7 @@ u8 gbReadOpcode(register u16 address)
if(gbCheatMap[address])
return gbCheatRead(address);
switch((address>>12) & 0x000f) {
switch(address & 0xf000) {
case 0x0a:
case 0x0b:
if(mapperReadRAM)
@ -1226,10 +1215,6 @@ u8 gbReadOpcode(register u16 address)
}
}
break;
if (address>=0xE000 && address<0xFE00)
{
return gbMemoryMap[(address-0x2000)>>12][address & 0x0fff];
}
}
return gbMemoryMap[address>>12][address & 0x0fff];
}
@ -1395,11 +1380,8 @@ u8 gbReadMemory(register u16 address)
case 0xff:
return register_IE;
}
if (address>=0xE000 && address<0xFE00)
{
return gbMemoryMap[(address-0x2000)>>12][address & 0x0fff];
}
}
return gbMemoryMap[address>>12][address & 0x0fff];
}