Update to v087r04 release.
byuu says:
Changelog:
- gameboy/ -> gb/
- GameBoy -> GB
- basic memory map for GBA
- enough code to execute the first BIOS instruction (b 0x68)
I have the code resetting r(15) to 0 on an exception just as a test.
Since that flushes the pipeline, that means we're basically executing "b
0x68" at 8MHz, and nothing else.
... and I am getting __6 motherfucking FPS__ at 4.4GHz on an i7.
Something is seriously, horribly, unfuckingbelievably wrong here, and
I can't figure out what it is.
My *fully complete* ARM core on the ST018 is even less efficient and
runs at 21.47MHz, and yet I get 60fps even after emulating the SNES
CPU+PPU @ 10+MHz each as well.
... I'm stuck. I can't proceed until we figure out what in the holy fuck
is going on here. So ... if anyone can help, please do. If we can't fix
this, the GBA emulation is dead.
I was able to profile on Windows, and I've included that in this WIP
under out/log.txt.
But it looks normal to me. But yeah, there's NO. FUCKING. WAY. This code
should be running this slowly.
2012-03-18 12:35:53 +00:00
|
|
|
#include <gb/gb.hpp>
|
2010-12-28 01:53:15 +00:00
|
|
|
|
|
|
|
#define MEMORY_CPP
|
2012-04-26 10:51:13 +00:00
|
|
|
namespace GameBoy {
|
2010-12-28 01:53:15 +00:00
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
Unmapped unmapped;
|
2010-12-28 01:53:15 +00:00
|
|
|
Bus bus;
|
|
|
|
|
|
|
|
uint8_t& Memory::operator[](unsigned addr) {
|
|
|
|
return data[addr];
|
|
|
|
}
|
|
|
|
|
|
|
|
void Memory::allocate(unsigned size_) {
|
|
|
|
free();
|
|
|
|
size = size_;
|
|
|
|
data = new uint8_t[size]();
|
|
|
|
}
|
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
void Memory::copy(const uint8_t* data_, unsigned size_) {
|
2010-12-28 01:53:15 +00:00
|
|
|
free();
|
|
|
|
size = size_;
|
|
|
|
data = new uint8_t[size];
|
|
|
|
memcpy(data, data_, size);
|
|
|
|
}
|
|
|
|
|
|
|
|
void Memory::free() {
|
|
|
|
if(data) {
|
|
|
|
delete[] data;
|
|
|
|
data = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
Memory::Memory() {
|
|
|
|
data = 0;
|
|
|
|
size = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
Memory::~Memory() {
|
|
|
|
free();
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
|
|
|
uint8 Bus::read(uint16 addr) {
|
Update to v082r10 release.
byuu says:
Emulated the Game Genie for the NES and Game Boy, and wrote a new cheat
editor that doesn't reach into specific emulation cores so that it would
work.
Before you ask: yes, long-term I'd like Super Game Boy mode to accept
Game Boy codes. But that's not high on the priority list.
Renamed the mappers toward board names, LZ...->BandaiFCG,
LS161...->AOROM, added CNROM emulation (Adventure Island, Gradius, etc.)
Added the tools menu load/save state stuff, but note that the NES
doesn't have save state support yet (waiting for the interface to
stabilize a bit more first.)
Note: this will be the last release to have the ui-gameboy folder, it's
been deleted locally from my end, as the new multi-GUI does all that it
does and more now.
2011-09-15 12:23:13 +00:00
|
|
|
uint8 data = mmio[addr]->mmio_read(addr);
|
|
|
|
|
2014-01-13 09:35:46 +00:00
|
|
|
if(cheat.enable()) {
|
|
|
|
if(auto result = cheat.find(addr, data)) return result();
|
Update to v082r10 release.
byuu says:
Emulated the Game Genie for the NES and Game Boy, and wrote a new cheat
editor that doesn't reach into specific emulation cores so that it would
work.
Before you ask: yes, long-term I'd like Super Game Boy mode to accept
Game Boy codes. But that's not high on the priority list.
Renamed the mappers toward board names, LZ...->BandaiFCG,
LS161...->AOROM, added CNROM emulation (Adventure Island, Gradius, etc.)
Added the tools menu load/save state stuff, but note that the NES
doesn't have save state support yet (waiting for the interface to
stabilize a bit more first.)
Note: this will be the last release to have the ui-gameboy folder, it's
been deleted locally from my end, as the new multi-GUI does all that it
does and more now.
2011-09-15 12:23:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return data;
|
2010-12-28 01:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void Bus::write(uint16 addr, uint8 data) {
|
2010-12-29 11:03:42 +00:00
|
|
|
mmio[addr]->mmio_write(addr, data);
|
|
|
|
}
|
2010-12-28 01:53:15 +00:00
|
|
|
|
2010-12-29 11:03:42 +00:00
|
|
|
void Bus::power() {
|
2011-01-29 09:48:44 +00:00
|
|
|
for(unsigned n = 0x0000; n <= 0xffff; n++) mmio[n] = &unmapped;
|
2010-12-28 01:53:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|