2010-08-09 13:28:56 +00:00
|
|
|
//====================
|
|
|
|
//direct data transfer
|
|
|
|
//====================
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::dma_normal() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
while(mmio.dtc--) {
|
Update to v098r11 release.
byuu says:
Changelog:
- fixed nall/path.hpp compilation issue
- fixed ruby/audio/xaudio header declaration compilation issue (again)
- cleaned up xaudio2.hpp file to match my coding syntax (12.5% of the
file was whitespace overkill)
- added null terminator entry to nall/windows/utf8.hpp argc[] array
- nall/windows/guid.hpp uses the Windows API for generating the GUID
- this should stop all the bug reports where two nall users were
generating GUIDs at the exact same second
- fixed hiro/cocoa compilation issue with uint# types
- fixed major higan/sfc Super Game Boy audio latency issue
- fixed higan/sfc CPU core bug with pei, [dp], [dp]+y instructions
- major cleanups to higan/processor/r65816 core
- merged emulation/native-mode opcodes
- use camel-case naming on memory.hpp functions
- simplify address masking code for memory.hpp functions
- simplify a few opcodes themselves (avoid redundant copies, etc)
- rename regs.* to r.* to match modern convention of other CPU cores
- removed device.order<> concept from Emulator::Interface
- cores will now do the translation to make the job of the UI easier
- fixed plurality naming of arrays in Emulator::Interface
- example: emulator.ports[p].devices[d].inputs[i]
- example: vector<Medium> media
- probably more surprises
Major show-stoppers to the next official release:
- we need to work on GB core improvements: LY=153/0 case, multiple STAT
IRQs case, GBC audio output regs, etc.
- we need to re-add software cursors for light guns (Super Scope,
Justifier)
- after the above, we need to fix the turbo button for the Super Scope
I really have no idea how I want to implement the light guns. Ideally,
we'd want it in higan/video, so we can support the NES Zapper with the
same code. But this isn't going to be easy, because only the SNES knows
when its output is interlaced, and its resolutions can vary as
{256,512}x{224,240,448,480} which requires pixel doubling that was
hard-coded to the SNES-specific behavior, but isn't appropriate to be
exposed in higan/video.
2016-05-25 11:13:02 +00:00
|
|
|
uint8 data = r.mdr;
|
2010-08-09 13:28:56 +00:00
|
|
|
uint32 dsa = mmio.dsa++;
|
|
|
|
uint32 dda = mmio.dda++;
|
|
|
|
|
|
|
|
//source and destination cannot be the same
|
|
|
|
if(mmio.sd == DMA::SourceBWRAM && mmio.dd == DMA::DestBWRAM) continue;
|
|
|
|
if(mmio.sd == DMA::SourceIRAM && mmio.dd == DMA::DestIRAM ) continue;
|
|
|
|
|
|
|
|
switch(mmio.sd) {
|
2013-05-05 09:21:30 +00:00
|
|
|
case DMA::SourceROM:
|
|
|
|
if((dsa & 0x408000) == 0x008000 || (dsa & 0xc00000) == 0xc00000) {
|
2015-12-14 09:41:06 +00:00
|
|
|
data = bus_read(dsa, data);
|
2013-05-05 09:21:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
case DMA::SourceBWRAM:
|
|
|
|
if((dsa & 0x40e000) == 0x006000 || (dsa & 0xf00000) == 0x400000) {
|
2015-12-14 09:41:06 +00:00
|
|
|
data = bus_read(dsa, data);
|
2013-05-05 09:21:30 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
case DMA::SourceIRAM:
|
|
|
|
data = iram.read(dsa & 0x07ff);
|
|
|
|
break;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
switch(mmio.dd) {
|
2013-05-05 09:21:30 +00:00
|
|
|
case DMA::DestBWRAM:
|
|
|
|
if((dda & 0x40e000) == 0x006000 || (dda & 0xf00000) == 0x400000) {
|
|
|
|
bus_write(dda, data);
|
|
|
|
}
|
|
|
|
break;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2013-05-05 09:21:30 +00:00
|
|
|
case DMA::DestIRAM:
|
|
|
|
iram.write(dda & 0x07ff, data);
|
|
|
|
break;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mmio.dma_irqfl = true;
|
|
|
|
if(mmio.dma_irqen) mmio.dma_irqcl = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
//((byte & 6) << 3) + (byte & 1) explanation:
|
|
|
|
//transforms a byte index (0-7) into a planar index:
|
|
|
|
//result[] = { 0, 1, 16, 17, 32, 33, 48, 49 };
|
|
|
|
//works for 2bpp, 4bpp and 8bpp modes
|
|
|
|
|
|
|
|
//===========================
|
|
|
|
//type-1 character conversion
|
|
|
|
//===========================
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::dma_cc1() -> void {
|
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
|
|
|
cpubwram.dma = true;
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.chdma_irqfl = true;
|
|
|
|
if(mmio.chdma_irqen) {
|
|
|
|
mmio.chdma_irqcl = 0;
|
Update to v098r11 release.
byuu says:
Changelog:
- fixed nall/path.hpp compilation issue
- fixed ruby/audio/xaudio header declaration compilation issue (again)
- cleaned up xaudio2.hpp file to match my coding syntax (12.5% of the
file was whitespace overkill)
- added null terminator entry to nall/windows/utf8.hpp argc[] array
- nall/windows/guid.hpp uses the Windows API for generating the GUID
- this should stop all the bug reports where two nall users were
generating GUIDs at the exact same second
- fixed hiro/cocoa compilation issue with uint# types
- fixed major higan/sfc Super Game Boy audio latency issue
- fixed higan/sfc CPU core bug with pei, [dp], [dp]+y instructions
- major cleanups to higan/processor/r65816 core
- merged emulation/native-mode opcodes
- use camel-case naming on memory.hpp functions
- simplify address masking code for memory.hpp functions
- simplify a few opcodes themselves (avoid redundant copies, etc)
- rename regs.* to r.* to match modern convention of other CPU cores
- removed device.order<> concept from Emulator::Interface
- cores will now do the translation to make the job of the UI easier
- fixed plurality naming of arrays in Emulator::Interface
- example: emulator.ports[p].devices[d].inputs[i]
- example: vector<Medium> media
- probably more surprises
Major show-stoppers to the next official release:
- we need to work on GB core improvements: LY=153/0 case, multiple STAT
IRQs case, GBC audio output regs, etc.
- we need to re-add software cursors for light guns (Super Scope,
Justifier)
- after the above, we need to fix the turbo button for the Super Scope
I really have no idea how I want to implement the light guns. Ideally,
we'd want it in higan/video, so we can support the NES Zapper with the
same code. But this isn't going to be easy, because only the SNES knows
when its output is interlaced, and its resolutions can vary as
{256,512}x{224,240,448,480} which requires pixel doubling that was
hard-coded to the SNES-specific behavior, but isn't appropriate to be
exposed in higan/video.
2016-05-25 11:13:02 +00:00
|
|
|
cpu.r.irq = 1;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::dma_cc1_read(uint addr) -> uint8 {
|
2010-08-09 13:28:56 +00:00
|
|
|
//16 bytes/char (2bpp); 32 bytes/char (4bpp); 64 bytes/char (8bpp)
|
2015-11-14 00:52:51 +00:00
|
|
|
uint charmask = (1 << (6 - mmio.dmacb)) - 1;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
if((addr & charmask) == 0) {
|
|
|
|
//buffer next character to I-RAM
|
2015-11-14 00:52:51 +00:00
|
|
|
uint bpp = 2 << (2 - mmio.dmacb);
|
|
|
|
uint bpl = (8 << mmio.dmasize) >> mmio.dmacb;
|
|
|
|
uint bwmask = bwram.size() - 1;
|
|
|
|
uint tile = ((addr - mmio.dsa) & bwmask) >> (6 - mmio.dmacb);
|
|
|
|
uint ty = (tile >> mmio.dmasize);
|
|
|
|
uint tx = tile & ((1 << mmio.dmasize) - 1);
|
|
|
|
uint bwaddr = mmio.dsa + ty * 8 * bpl + tx * bpp;
|
|
|
|
|
|
|
|
for(auto y : range(8)) {
|
2010-08-09 13:28:56 +00:00
|
|
|
uint64 data = 0;
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto byte : range(bpp)) {
|
2012-07-08 02:57:34 +00:00
|
|
|
data |= (uint64)bwram.read((bwaddr + byte) & bwmask) << (byte << 3);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
bwaddr += bpl;
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
uint8 out[] = {0, 0, 0, 0, 0, 0, 0, 0};
|
|
|
|
for(auto x : range(8)) {
|
2010-08-09 13:28:56 +00:00
|
|
|
out[0] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
out[1] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
if(mmio.dmacb == 2) continue;
|
|
|
|
out[2] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
out[3] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
if(mmio.dmacb == 1) continue;
|
|
|
|
out[4] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
out[5] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
out[6] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
out[7] |= (data & 1) << (7 - x); data >>= 1;
|
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto byte : range(bpp)) {
|
|
|
|
uint p = mmio.dda + (y << 1) + ((byte & 6) << 3) + (byte & 1);
|
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
|
|
|
iram.write(p & 0x07ff, out[byte]);
|
2010-08-09 13:28:56 +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
|
|
|
return iram.read((mmio.dda + (addr & charmask)) & 0x07ff);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
//===========================
|
|
|
|
//type-2 character conversion
|
|
|
|
//===========================
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::dma_cc2() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
//select register file index (0-7 or 8-15)
|
2015-11-14 00:52:51 +00:00
|
|
|
const uint8* brf = &mmio.brf[(dma.line & 1) << 3];
|
|
|
|
uint bpp = 2 << (2 - mmio.dmacb);
|
|
|
|
uint addr = mmio.dda & 0x07ff;
|
2010-08-09 13:28:56 +00:00
|
|
|
addr &= ~((1 << (7 - mmio.dmacb)) - 1);
|
|
|
|
addr += (dma.line & 8) * bpp;
|
|
|
|
addr += (dma.line & 7) * 2;
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto byte : range(bpp)) {
|
2010-08-09 13:28:56 +00:00
|
|
|
uint8 output = 0;
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto bit : range(8)) {
|
2010-08-09 13:28:56 +00:00
|
|
|
output |= ((brf[bit] >> byte) & 1) << (7 - bit);
|
|
|
|
}
|
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
|
|
|
iram.write(addr + ((byte & 6) << 3) + (byte & 1), output);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
dma.line = (dma.line + 1) & 15;
|
|
|
|
}
|