Fixed bug in core. LDH was accessing directly to memory.high, and
authorslack <slack@codemaniacs.com>
Fri, 12 Sep 2008 20:02:14 +0000 (22:02 +0200)
committerslack <slack@codemaniacs.com>
Fri, 12 Sep 2008 20:02:14 +0000 (22:02 +0200)
wouldn't trigger DMA or DIV responses.

GBMemory.cc
gbcore.cc

index bb311064d71902a99b383d310ca917aa0be674ec..5a8e118fd7a1cf6d028d9d71e4d0fbca5d1da101 100644 (file)
@@ -64,7 +64,7 @@ void GBMemory::write(u16 addr, u8 value, WatchpointControl watch)
                else if (addr == DMA)
                {
                        u16 dma_src = value << 8;
-                       logger.warning("OAM DMA transfer from 0x", std::hex, std::setfill('0'), dma_src, " requested");
+                       //logger.warning("OAM DMA transfer from 0x", std::hex, std::setfill('0'), dma_src, " requested");
                        core->video.DMA_OAM(dma_src);
                }
        }
index 07467a1e9e68114984661dbb42268ec6472ea5f4..a744d18cb9bccbd8aa89a2afa99b25dfd2c91644 100644 (file)
--- a/gbcore.cc
+++ b/gbcore.cc
@@ -553,13 +553,13 @@ GameBoy::run_status GameBoy::run_cycle()
                                                break;
                                        // LDH (n), A
                                        case 0xE0: {
-                                               memory.high[memory.read(regs.PC++)] =  regs.A;
+                                               memory.write(0xFF00+memory.read(regs.PC++), regs.A);
                                                cycles_until_next_instruction = 12; 
                                                break;
                                        }
                                        // LDH A, (n)
                                        case 0xF0:
-                                               regs.A = memory.high[memory.read(regs.PC++)];
+                                               regs.A = memory.read(0xFF00+memory.read(regs.PC++));
                                                cycles_until_next_instruction = 12; 
                                                break;