From: slack Date: Sun, 29 Jun 2008 01:30:01 +0000 (+0200) Subject: Core fixes X-Git-Tag: v0.1~45 X-Git-Url: http://slack.codemaniacs.com/git/?a=commitdiff_plain;h=7101021cf1426e4587444d1a6e2c006602fadbf9;p=wenboi.git Core fixes --- diff --git a/gbcore.cc b/gbcore.cc index c5a7859..be0f451 100644 --- a/gbcore.cc +++ b/gbcore.cc @@ -832,6 +832,7 @@ GameBoy::run_status GameBoy::run_cycle() } else { regs.PC += 2; // if !cc, skip 2 (nn) bytes } + break; } case 0xCC: { // CALL Z, nn @@ -842,6 +843,7 @@ GameBoy::run_status GameBoy::run_cycle() } else { regs.PC += 2; // if !cc, skip 2 (nn) bytes } + break; } case 0xD4: { // CALL NC, nn @@ -852,6 +854,7 @@ GameBoy::run_status GameBoy::run_cycle() } else { regs.PC += 2; // if !cc, skip 2 (nn) bytes } + break; } case 0xDC: { // CALL C, nn @@ -862,6 +865,7 @@ GameBoy::run_status GameBoy::run_cycle() } else { regs.PC += 2; // if !cc, skip 2 (nn) bytes } + break; } // Restarts @@ -880,6 +884,7 @@ GameBoy::run_status GameBoy::run_cycle() u16 retaddr = (memory.read(regs.SP+1)<<8) | memory.read(regs.SP); regs.SP += 2; regs.PC = retaddr; + break; } // RET cc @@ -922,6 +927,7 @@ GameBoy::run_status GameBoy::run_cycle() regs.SP += 2; regs.PC = retaddr; IME=1; + break; } default: @@ -969,6 +975,7 @@ std::string GameBoy::get_port_name(int port) const case 0x48: port_name = "OBP0"; break; case 0x49: port_name = "OBP1"; break; case 0x46: port_name = "DMA "; break; + case 0x0F: port_name = "IF "; break; case 0xFF: port_name = "IE "; break; default: if (port >= 0x80 && port <= 0xFE) { @@ -1007,7 +1014,7 @@ void GameBoy::disassemble_opcode(u16 addr, std::string &instruction, int &length opcode = memory.read(PC++); std::ostringstream result; - result << std::hex << std::setfill('0'); + result << std::hex << std::uppercase << std::setfill('0'); switch(opcode) { diff --git a/gbcore.h b/gbcore.h index 658dcad..23829ad 100644 --- a/gbcore.h +++ b/gbcore.h @@ -14,10 +14,10 @@ class GameBoy enum GameBoyType { GAMEBOY, GAMEBOYCOLOR, SUPERGAMEBOY } gameboy_type; enum InterruptRequest { IRQ_VBLANK = 0x00, - IRQ_LCD_STAT = 0x10, - IRQ_TIMER = 0x20, - IRQ_SERIAL = 0x40, - IRQ_JOYPAD = 0x80 + IRQ_LCD_STAT = 0x01, + IRQ_TIMER = 0x02, + IRQ_SERIAL = 0x04, + IRQ_JOYPAD = 0x08 }; enum Flag @@ -94,7 +94,7 @@ class GameBoy GameBoy(std::string rom_name, GameBoyType type=GAMEBOY); - void irq(InterruptRequest i) { memory.write(0xFFFF, memory.read(0xFFFF) | i); } + void irq(InterruptRequest i) { memory.write(0xFF0F, memory.read(0xFF0F) | i); } void reset(); run_status run_cycle(); run_status run();