bsnes/higan/sfc/coprocessor/icd2/mmio.cpp

74 lines
1.7 KiB
C++
Raw Normal View History

auto ICD2::read(uint24 addr, uint8 data) -> uint8 {
addr &= 0x40ffff;
//LY counter
if(addr == 0x6000) {
uint y = min((uint8)143, GameBoy::ppu.status.ly);
return (y & ~7) | writeBank;
}
//command ready port
if(addr == 0x6002) {
data = packetSize > 0;
if(data) {
for(auto n : range(16)) r7000[n] = packet[0][n];
packetSize--;
for(auto n : range(packetSize)) packet[n] = packet[n + 1];
}
return data;
}
//ICD2 revision
if(addr == 0x600f) {
return 0x21;
}
//command port
if((addr & 0x40fff0) == 0x7000) {
return r7000[addr & 15];
}
//VRAM port
if(addr == 0x7800) {
data = output[readBank * 512 + readAddress];
readAddress = (readAddress + 1) & 511;
return data;
}
return 0x00;
}
auto ICD2::write(uint24 addr, uint8 data) -> void {
addr &= 0xffff;
//VRAM port
if(addr == 0x6001) {
readBank = data & 3;
readAddress = 0;
return;
}
//control port
//d7: 0 = halt, 1 = reset
//d5,d4: 0 = 1-player, 1 = 2-player, 2 = 4-player, 3 = ???
//d1,d0: 0 = frequency divider (clock rate adjust)
if(addr == 0x6003) {
if((r6003 & 0x80) == 0x00 && (data & 0x80) == 0x80) {
Update to v098r06 release. byuu says: Changelog: - emulation cores now refresh video from host thread instead of cothreads (fix AMD crash) - SFC: fixed another bug with leap year months in SharpRTC emulation - SFC: cleaned up camelCase on function names for armdsp,epsonrtc,hitachidsp,mcc,nss,sharprtc classes - GB: added MBC1M emulation (requires manually setting mapper=MBC1M in manifest.bml for now, sorry) - audio: implemented Emulator::Audio mixer and effects processor - audio: implemented Emulator::Stream interface - it is now possible to have more than two audio streams: eg SNES + SGB + MSU1 + Voicer-Kun (eventually) - audio: added reverb delay + reverb level settings; exposed balance configuration in UI - video: reworked palette generation to re-enable saturation, gamma, luminance adjustments - higan/emulator.cpp is gone since there was nothing left in it I know you guys are going to say the color adjust/balance/reverb stuff is pointless. And indeed it mostly is. But I like the idea of allowing some fun special effects and configurability that isn't system-wide. Note: there seems to be some kind of added audio lag in the SGB emulation now, and I don't really understand why. The code should be effectively identical to what I had before. The only main thing is that I'm sampling things to 48000hz instead of 32040hz before mixing. There's no point where I'm intentionally introducing added latency though. I'm kind of stumped, so if anyone wouldn't mind taking a look at it, it'd be much appreciated :/ I don't have an MSU1 test ROM, but the latency issue may affect MSU1 as well, and that would be very bad.
2016-04-22 13:35:51 +00:00
reset(true);
}
switch(data & 3) {
case 0: frequency = cpu.frequency / 4; break; //fast (glitchy, even on real hardware)
case 1: frequency = cpu.frequency / 5; break; //normal
case 2: frequency = cpu.frequency / 7; break; //slow
case 3: frequency = cpu.frequency / 9; break; //very slow
}
r6003 = data;
return;
}
if(addr == 0x6004) { r6004 = data; return; } //joypad 1
if(addr == 0x6005) { r6005 = data; return; } //joypad 2
if(addr == 0x6006) { r6006 = data; return; } //joypad 3
if(addr == 0x6007) { r6007 = data; return; } //joypad 4
}