Update to v081r01 release.

byuu says:

- EI takes an extra cycle to raise IME; fixes Bubble Bobble [for the
  Gameboy], and likely many more games [Jonas Quinn]
- nall/gameboy/cartridge.hpp descrambles MMM01 images (header can be at
  top or bottom of image now)
- screenshot timestamps use filename-yyyy-mm-dd hh.mm.ss.bmp format; so
  that they can save on Windows
- closing the emulator will switch to windowed mode first, so that
  geometry is preserved
This commit is contained in:
Tim Allen 2011-08-13 13:51:29 +10:00
parent 064ca4c626
commit 423d9ba00d
12 changed files with 43 additions and 8 deletions

View File

@ -55,7 +55,7 @@ void Cartridge::MMM01::mmio_write(uint16 addr, uint8 data) {
void Cartridge::MMM01::power() { void Cartridge::MMM01::power() {
rom_mode = 0; rom_mode = 0;
rom_base = 0x00; rom_base = 0;
ram_enable = false; ram_enable = false;
rom_select = 0x01; rom_select = 0x01;

View File

@ -580,7 +580,8 @@ void CPU::op_di() {
} }
void CPU::op_ei() { void CPU::op_ei() {
status.ime = 1; status.ei = true;
//status.ime = 1;
} }
//jump commands //jump commands

View File

@ -114,6 +114,7 @@ void CPU::power() {
status.clock = 0; status.clock = 0;
status.halt = false; status.halt = false;
status.stop = false; status.stop = false;
status.ei = false;
status.ime = 0; status.ime = 0;
status.p15 = 0; status.p15 = 0;

View File

@ -17,6 +17,7 @@ struct CPU : Processor, MMIO {
unsigned clock; unsigned clock;
bool halt; bool halt;
bool stop; bool stop;
bool ei;
bool ime; bool ime;
//$ff00 JOYP //$ff00 JOYP

View File

@ -21,6 +21,7 @@ void CPU::serialize(serializer &s) {
s.integer(status.clock); s.integer(status.clock);
s.integer(status.halt); s.integer(status.halt);
s.integer(status.stop); s.integer(status.stop);
s.integer(status.ei);
s.integer(status.ime); s.integer(status.ime);
s.integer(status.p15); s.integer(status.p15);

View File

@ -1,18 +1,28 @@
#ifdef CPU_CPP #ifdef CPU_CPP
void CPU::op_io() { void CPU::op_io() {
cycle_edge();
add_clocks(4); add_clocks(4);
} }
uint8 CPU::op_read(uint16 addr) { uint8 CPU::op_read(uint16 addr) {
cycle_edge();
uint8 r = bus.read(addr); uint8 r = bus.read(addr);
add_clocks(4); add_clocks(4);
return r; return r;
} }
void CPU::op_write(uint16 addr, uint8 data) { void CPU::op_write(uint16 addr, uint8 data) {
cycle_edge();
bus.write(addr, data); bus.write(addr, data);
add_clocks(4); add_clocks(4);
} }
void CPU::cycle_edge() {
if(status.ei) {
status.ei = false;
status.ime = 1;
}
}
#endif #endif

View File

@ -9,3 +9,4 @@ void timer_4096hz();
void op_io(); void op_io();
uint8 op_read(uint16 addr); uint8 op_read(uint16 addr);
void op_write(uint16 addr, uint8 data); void op_write(uint16 addr, uint8 data);
void cycle_edge();

View File

@ -6,7 +6,7 @@ namespace nall {
class GameBoyCartridge { class GameBoyCartridge {
public: public:
string xml; string xml;
inline GameBoyCartridge(const uint8_t *data, unsigned size); inline GameBoyCartridge(uint8_t *data, unsigned size);
//private: //private:
struct Information { struct Information {
@ -21,7 +21,7 @@ public:
} info; } info;
}; };
GameBoyCartridge::GameBoyCartridge(const uint8_t *romdata, unsigned romsize) { GameBoyCartridge::GameBoyCartridge(uint8_t *romdata, unsigned romsize) {
xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
if(romsize < 0x4000) return; if(romsize < 0x4000) return;
@ -34,6 +34,20 @@ GameBoyCartridge::GameBoyCartridge(const uint8_t *romdata, unsigned romsize) {
info.romsize = 0; info.romsize = 0;
info.ramsize = 0; info.ramsize = 0;
unsigned base = romsize - 0x8000;
if(romdata[base + 0x0104] == 0xce && romdata[base + 0x0105] == 0xed
&& romdata[base + 0x0106] == 0x66 && romdata[base + 0x0107] == 0x66
&& romdata[base + 0x0108] == 0xcc && romdata[base + 0x0109] == 0x0d
&& romdata[base + 0x0147] >= 0x0b && romdata[base + 0x0147] <= 0x0d
) {
//MMM01 stores header at bottom of image
//flip this around for consistency with all other mappers
uint8_t header[0x8000];
memcpy(header, romdata + base, 0x8000);
memmove(romdata + 0x8000, romdata, romsize - 0x8000);
memcpy(romdata, header, 0x8000);
}
switch(romdata[0x0147]) { switch(romdata[0x0147]) {
case 0x00: info.mapper = "none"; break; case 0x00: info.mapper = "none"; break;
case 0x01: info.mapper = "MBC1"; break; case 0x01: info.mapper = "MBC1"; break;

View File

@ -2,6 +2,10 @@ namespace Info {
static const char Profile[] = "Performance"; static const char Profile[] = "Performance";
} }
#if defined(DEBUGGER)
#error "bsnes: debugger not supported with performance profile."
#endif
#include <snes/alt/cpu/cpu.hpp> #include <snes/alt/cpu/cpu.hpp>
#include <snes/alt/smp/smp.hpp> #include <snes/alt/smp/smp.hpp>
#include <snes/alt/dsp/dsp.hpp> #include <snes/alt/dsp/dsp.hpp>

View File

@ -1,7 +1,7 @@
namespace SNES { namespace SNES {
namespace Info { namespace Info {
static const char Name[] = "bsnes"; static const char Name[] = "bsnes";
static const char Version[] = "081"; static const char Version[] = "081.01";
static const unsigned SerializerVersion = 21; static const unsigned SerializerVersion = 21;
} }
} }

View File

@ -129,10 +129,11 @@ void Interface::video_refresh(const uint16_t *data, bool hires, bool interlace,
tm *info = localtime(&currentTime); tm *info = localtime(&currentTime);
string filename = { "-", string filename = { "-",
decimal<4, '0'>(info->tm_year + 1900), "-", decimal<2, '0'>(info->tm_mon + 1), "-", decimal<2, '0'>(info->tm_mday), " ", decimal<4, '0'>(info->tm_year + 1900), "-", decimal<2, '0'>(info->tm_mon + 1), "-", decimal<2, '0'>(info->tm_mday), " ",
decimal<2, '0'>(info->tm_hour), ":", decimal<2, '0'>(info->tm_min), ":", decimal<2, '0'>(info->tm_sec), ".bmp" decimal<2, '0'>(info->tm_hour), ".", decimal<2, '0'>(info->tm_min), ".", decimal<2, '0'>(info->tm_sec), ".bmp"
}; };
bmp::write(path(utility.slotPath(), filename), buffer, outwidth, outheight, outpitch, false); if(bmp::write(path(utility.slotPath(), filename), buffer, outwidth, outheight, outpitch, false)) {
utility.showMessage("Screenshot captured"); utility.showMessage("Screenshot captured");
}
} }
} }

View File

@ -144,6 +144,7 @@ void Application::main(int argc, char **argv) {
} }
cartridge.unload(); cartridge.unload();
utility.setFullScreen(false);
saveGeometry(); saveGeometry();
foreach(window, windows) window->setVisible(false); foreach(window, windows) window->setVisible(false);
OS::processEvents(); OS::processEvents();