2015-11-21 07:36:48 +00:00
|
|
|
auto CPU::wram_addr(uint16 addr) const -> uint {
|
2011-10-27 00:00:17 +00:00
|
|
|
addr &= 0x1fff;
|
|
|
|
if(addr < 0x1000) return addr;
|
2011-10-27 13:30:19 +00:00
|
|
|
auto bank = status.wram_bank + (status.wram_bank == 0);
|
|
|
|
return (bank * 0x1000) + (addr & 0x0fff);
|
2011-10-27 00:00:17 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
auto CPU::mmio_joyp_poll() -> void {
|
|
|
|
uint button = 0, dpad = 0;
|
2010-12-31 05:43:47 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
button |= interface->inputPoll(0, 0, (uint)Input::Start) << 3;
|
|
|
|
button |= interface->inputPoll(0, 0, (uint)Input::Select) << 2;
|
|
|
|
button |= interface->inputPoll(0, 0, (uint)Input::B) << 1;
|
|
|
|
button |= interface->inputPoll(0, 0, (uint)Input::A) << 0;
|
2010-12-31 05:43:47 +00:00
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
dpad |= interface->inputPoll(0, 0, (uint)Input::Down) << 3;
|
|
|
|
dpad |= interface->inputPoll(0, 0, (uint)Input::Up) << 2;
|
|
|
|
dpad |= interface->inputPoll(0, 0, (uint)Input::Left) << 1;
|
|
|
|
dpad |= interface->inputPoll(0, 0, (uint)Input::Right) << 0;
|
2010-12-31 05:43:47 +00:00
|
|
|
|
Update to v097r12 release.
byuu says:
Nothing WS-related this time.
First, I fixed expansion port device mapping. On first load, it was
mapping the expansion port device too late, so it ended up not taking
effect. I had to spin out the logic for that into
Program::connectDevices(). This was proving to be quite annoying while
testing eBoot (SNES-Hook simulation.)
Second, I fixed the audio->set(Frequency, Latency) functions to take
(uint) parameters from the configuration file, so the weird behavior
around changing settings in the audio panel should hopefully be gone
now.
Third, I rewrote the interface->load,unload functions to call into the
(Emulator)::System::load,unload functions. And I have those call out to
Cartridge::load,unload. Before, this was inverted, and Cartridge::load()
was invoking System::load(), which I felt was kind of backward.
The Super Game Boy really didn't like this change, however. And it took
me a few hours to power through it. Before, I had the Game Boy core
dummying out all the interface->(load,save)Request calls, and having the
SNES core make them for it. This is because the folder paths and IDs
will be different between the two cores.
I've redesigned things so that ICD2's Emulator::Interface overloads
loadRequest and saveRequest, and translates the requests into new
requests for the SuperFamicom core. This allows the Game Boy code to do
its own loading for everything without a bunch of Super Game Boy special
casing, and without any awkwardness around powering on with no cartridge
inserted.
This also lets the SNES side of things simply call into higher-level
GameBoy::interface->load,save(id, stream) functions instead of stabbing
at the raw underlying state inside of various Game Boy core emulation
classes. So things are a lot better abstracted now.
2016-02-08 03:17:59 +00:00
|
|
|
if(system.revision() != System::Revision::SuperGameBoy) {
|
2014-01-28 10:04:58 +00:00
|
|
|
//D-pad pivot makes it impossible to press opposing directions at the same time
|
|
|
|
//however, Super Game Boy BIOS is able to set these bits together
|
|
|
|
if(dpad & 4) dpad &= ~8; //disallow up+down
|
|
|
|
if(dpad & 2) dpad &= ~1; //disallow left+right
|
|
|
|
}
|
2013-12-07 09:12:37 +00:00
|
|
|
|
2010-12-31 05:43:47 +00:00
|
|
|
status.joyp = 0x0f;
|
2011-01-06 10:16:07 +00:00
|
|
|
if(status.p15 == 1 && status.p14 == 1) status.joyp -= status.mlt_req;
|
2010-12-31 05:43:47 +00:00
|
|
|
if(status.p15 == 0) status.joyp &= button ^ 0x0f;
|
|
|
|
if(status.p14 == 0) status.joyp &= dpad ^ 0x0f;
|
2016-06-05 22:10:01 +00:00
|
|
|
if(status.joyp != 0x0f) raise(Interrupt::Joypad);
|
2010-12-31 05:43:47 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
auto CPU::mmio_read(uint16 addr) -> uint8 {
|
2011-10-27 00:00:17 +00:00
|
|
|
if(addr >= 0xc000 && addr <= 0xfdff) return wram[wram_addr(addr)];
|
2010-12-29 11:03:42 +00:00
|
|
|
if(addr >= 0xff80 && addr <= 0xfffe) return hram[addr & 0x7f];
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
if(addr == 0xff00) { //JOYP
|
2013-12-07 09:12:37 +00:00
|
|
|
mmio_joyp_poll();
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
return 0xc0
|
|
|
|
| (status.p15 << 5)
|
2010-12-30 07:18:47 +00:00
|
|
|
| (status.p14 << 4)
|
2010-12-31 05:43:47 +00:00
|
|
|
| (status.joyp << 0);
|
2010-12-30 07:18:47 +00:00
|
|
|
}
|
|
|
|
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
if(addr == 0xff01) { //SB
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
return 0x00;
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff02) { //SC
|
|
|
|
return (status.serial_transfer << 7)
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
| 0x7e
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
| (status.serial_clock << 0);
|
|
|
|
}
|
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
if(addr == 0xff04) { //DIV
|
2016-01-11 10:31:30 +00:00
|
|
|
return status.div >> 8;
|
2010-12-30 07:18:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff05) { //TIMA
|
|
|
|
return status.tima;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff06) { //TMA
|
|
|
|
return status.tma;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff07) { //TAC
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
return 0xf8
|
|
|
|
| (status.timer_enable << 2)
|
2010-12-30 07:18:47 +00:00
|
|
|
| (status.timer_clock << 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff0f) { //IF
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
return 0xe0
|
|
|
|
| (status.interrupt_request_joypad << 4)
|
2010-12-30 07:18:47 +00:00
|
|
|
| (status.interrupt_request_serial << 3)
|
|
|
|
| (status.interrupt_request_timer << 2)
|
|
|
|
| (status.interrupt_request_stat << 1)
|
|
|
|
| (status.interrupt_request_vblank << 0);
|
|
|
|
}
|
|
|
|
|
2011-10-27 00:00:17 +00:00
|
|
|
if(addr == 0xff4d) { //KEY1
|
|
|
|
return (status.speed_double << 7);
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff55) { //HDMA5
|
2013-12-10 12:12:54 +00:00
|
|
|
return (status.dma_completed << 7)
|
|
|
|
| (((status.dma_length / 16) - 1) & 0x7f);
|
2011-10-27 00:00:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff56) { //RP
|
|
|
|
return 0x02;
|
|
|
|
}
|
|
|
|
|
2011-10-27 13:30:19 +00:00
|
|
|
if(addr == 0xff6c) { //???
|
|
|
|
return 0xfe | status.ff6c;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff70) { //SVBK
|
|
|
|
return status.wram_bank;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff72) { //???
|
|
|
|
return status.ff72;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff73) { //???
|
|
|
|
return status.ff73;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff74) { //???
|
|
|
|
return status.ff74;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff75) { //???
|
|
|
|
return 0x8f | status.ff75;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff76) { //???
|
2016-01-08 09:23:46 +00:00
|
|
|
return 0xff;
|
2011-10-27 13:30:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff77) { //???
|
2016-01-08 09:23:46 +00:00
|
|
|
return 0xff;
|
2011-10-27 13:30:19 +00:00
|
|
|
}
|
2011-10-27 00:00:17 +00:00
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
if(addr == 0xffff) { //IE
|
Update to v097r02 release.
byuu says:
Note: balanced/performance profiles still broken, sorry.
Changelog:
- added nall/GNUmakefile unique() function; used on linking phase of
higan
- added nall/unique_pointer
- target-tomoko and {System}::Video updated to use
unique_pointer<ClassName> instead of ClassName* [1]
- locate() updated to search multiple paths [2]
- GB: pass gekkio's if_ie_registers and boot_hwio-G test ROMs
- FC, GB, GBA: merge video/ into the PPU cores
- ruby: fixed ~AudioXAudio2() typo
[1] I expected this to cause new crashes on exit due to changing the
order of destruction of objects (and deleting things that weren't
deleted before), but ... so far, so good. I guess we'll see what crops
up, especially on OS X (which is already crashing for unknown reasons on
exit.)
[2] right now, the search paths are: programpath(), {configpath(),
"higan/"}, {localpath(), "higan/"}; but we can add as many more as we
want, and we can also add platform-specific versions.
2016-01-25 11:27:18 +00:00
|
|
|
return 0xe0
|
|
|
|
| (status.interrupt_enable_joypad << 4)
|
2010-12-30 07:18:47 +00:00
|
|
|
| (status.interrupt_enable_serial << 3)
|
|
|
|
| (status.interrupt_enable_timer << 2)
|
|
|
|
| (status.interrupt_enable_stat << 1)
|
|
|
|
| (status.interrupt_enable_vblank << 0);
|
|
|
|
}
|
|
|
|
|
2016-01-08 09:23:46 +00:00
|
|
|
return 0xff;
|
2010-12-29 11:03:42 +00:00
|
|
|
}
|
|
|
|
|
2015-11-21 07:36:48 +00:00
|
|
|
auto CPU::mmio_write(uint16 addr, uint8 data) -> void {
|
2011-10-27 00:00:17 +00:00
|
|
|
if(addr >= 0xc000 && addr <= 0xfdff) { wram[wram_addr(addr)] = data; return; }
|
2010-12-29 11:03:42 +00:00
|
|
|
if(addr >= 0xff80 && addr <= 0xfffe) { hram[addr & 0x7f] = data; return; }
|
2010-12-30 07:18:47 +00:00
|
|
|
|
|
|
|
if(addr == 0xff00) { //JOYP
|
|
|
|
status.p15 = data & 0x20;
|
|
|
|
status.p14 = data & 0x10;
|
2011-09-15 12:41:49 +00:00
|
|
|
interface->joypWrite(status.p15, status.p14);
|
2010-12-30 07:18:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff01) { //SB
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
status.serial_data = data;
|
2010-12-30 07:18:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff02) { //SC
|
Update to v074r11 release.
byuu says:
Changelog:
- debugger compiles on all three profiles
- libsnes compiles on all three platforms (no API changes to libsnes)
- memory.cpp : namespace memory removed (wram -> cpu, apuram -> smp,
vram, oam, cgram -> ppu)
- sa1.cpp : namespace memory removed (SA-1 specific functions merged
inline to SA1::bus_read,write)
- GameBoy: added serial link support with interrupts and proper 8192hz
timing, but obviously it acts as if no other GB is connected to it
- GameBoy: added STAT OAM interrupt, and better STAT d1,d0 mode values
- UI: since Qt is dead, I've renamed the config files back to bsnes.cfg
and bsnes-geometry.cfg
- SA1: IRAM was not syncing to CPU on SA-1 side
- PPU/Accuracy and PPU/Performance needed Sprite oam renamed to Sprite
sprite; so that I could add uint8 oam[544]
- makes more sense anyway, OAM = object attribute memory, obj or
sprite are better names for Sprite rendering class
- more cleanup
2011-01-24 09:03:17 +00:00
|
|
|
status.serial_transfer = data & 0x80;
|
|
|
|
status.serial_clock = data & 0x01;
|
|
|
|
if(status.serial_transfer) status.serial_bits = 8;
|
2010-12-30 07:18:47 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff04) { //DIV
|
|
|
|
status.div = 0;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff05) { //TIMA
|
|
|
|
status.tima = data;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff06) { //TMA
|
|
|
|
status.tma = data;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff07) { //TAC
|
|
|
|
status.timer_enable = data & 0x04;
|
|
|
|
status.timer_clock = data & 0x03;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff0f) { //IF
|
|
|
|
status.interrupt_request_joypad = data & 0x10;
|
|
|
|
status.interrupt_request_serial = data & 0x08;
|
|
|
|
status.interrupt_request_timer = data & 0x04;
|
|
|
|
status.interrupt_request_stat = data & 0x02;
|
|
|
|
status.interrupt_request_vblank = data & 0x01;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-10-27 00:00:17 +00:00
|
|
|
if(addr == 0xff4d) { //KEY1
|
|
|
|
status.speed_switch = data & 0x01;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff51) { //HDMA1
|
|
|
|
status.dma_source = (status.dma_source & 0x00ff) | (data << 8);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff52) { //HDMA2
|
2013-12-10 12:12:54 +00:00
|
|
|
status.dma_source = (status.dma_source & 0xff00) | (data & 0xf0);
|
2011-10-27 00:00:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff53) { //HDMA3
|
|
|
|
status.dma_target = (status.dma_target & 0x00ff) | (data << 8);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff54) { //HDMA4
|
2013-12-10 12:12:54 +00:00
|
|
|
status.dma_target = (status.dma_target & 0xff00) | (data & 0xf0);
|
2011-10-27 00:00:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff55) { //HDMA5
|
|
|
|
status.dma_mode = data & 0x80;
|
|
|
|
status.dma_length = ((data & 0x7f) + 1) * 16;
|
2013-12-10 12:12:54 +00:00
|
|
|
status.dma_completed = !status.dma_mode;
|
|
|
|
|
|
|
|
if(status.dma_mode == 0) {
|
|
|
|
do {
|
2016-01-11 10:31:30 +00:00
|
|
|
for(auto n : range(16)) {
|
2013-12-10 12:12:54 +00:00
|
|
|
dma_write(status.dma_target++, dma_read(status.dma_source++));
|
|
|
|
}
|
|
|
|
add_clocks(8 << status.speed_double);
|
|
|
|
status.dma_length -= 16;
|
|
|
|
} while(status.dma_length);
|
|
|
|
}
|
2011-10-27 00:00:17 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff56) { //RP
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff6c) { //???
|
|
|
|
status.ff6c = data & 0x01;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff72) { //???
|
|
|
|
status.ff72 = data;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff73) { //???
|
|
|
|
status.ff73 = data;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff74) { //???
|
|
|
|
status.ff74 = data;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff75) { //???
|
|
|
|
status.ff75 = data & 0x70;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(addr == 0xff70) { //SVBK
|
|
|
|
status.wram_bank = data & 0x07;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2010-12-30 07:18:47 +00:00
|
|
|
if(addr == 0xffff) { //IE
|
|
|
|
status.interrupt_enable_joypad = data & 0x10;
|
|
|
|
status.interrupt_enable_serial = data & 0x08;
|
|
|
|
status.interrupt_enable_timer = data & 0x04;
|
|
|
|
status.interrupt_enable_stat = data & 0x02;
|
|
|
|
status.interrupt_enable_vblank = data & 0x01;
|
|
|
|
return;
|
|
|
|
}
|
2010-12-29 11:03:42 +00:00
|
|
|
}
|