2012-04-29 06:16:44 +00:00
|
|
|
#include <sfc/sfc.hpp>
|
2010-08-09 13:28:56 +00:00
|
|
|
|
2012-04-26 10:51:13 +00:00
|
|
|
namespace SuperFamicom {
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
SA1 sa1;
|
|
|
|
|
|
|
|
#include "serialization.cpp"
|
|
|
|
#include "bus/bus.cpp"
|
|
|
|
#include "dma/dma.cpp"
|
|
|
|
#include "memory/memory.cpp"
|
|
|
|
#include "mmio/mmio.cpp"
|
|
|
|
|
2016-02-09 11:51:12 +00:00
|
|
|
auto SA1::Enter() -> void {
|
|
|
|
while(true) scheduler.synchronize(), sa1.main();
|
|
|
|
}
|
|
|
|
|
|
|
|
auto SA1::main() -> void {
|
|
|
|
if(mmio.sa1_rdyb || mmio.sa1_resb) {
|
|
|
|
//SA-1 co-processor is asleep
|
|
|
|
tick();
|
|
|
|
synchronizeCPU();
|
|
|
|
return;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
2016-02-09 11:51:12 +00:00
|
|
|
|
|
|
|
if(status.interrupt_pending) {
|
|
|
|
status.interrupt_pending = false;
|
2016-03-26 01:56:15 +00:00
|
|
|
interrupt();
|
2016-02-09 11:51:12 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-03-26 01:56:15 +00:00
|
|
|
instruction();
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2016-03-26 01:56:15 +00:00
|
|
|
auto SA1::interrupt() -> void {
|
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
|
|
|
read(r.pc.d);
|
2016-03-26 01:56:15 +00:00
|
|
|
io();
|
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
|
|
|
if(!r.e) writeSP(r.pc.b);
|
|
|
|
writeSP(r.pc.h);
|
|
|
|
writeSP(r.pc.l);
|
|
|
|
writeSP(r.e ? (r.p & ~0x10) : r.p);
|
|
|
|
r.pc.w = r.vector;
|
|
|
|
r.pc.b = 0x00;
|
|
|
|
r.p.i = 1;
|
|
|
|
r.p.d = 0;
|
Update to v083r08 release.
byuu says:
Fixed SA-1 IRQ regression for Super Mario RPG
Added turbo B,A to NES+GB; B,A,X,Y to SNES (please don't ask for turbo
L,R; you never use those keys rapidly.)
Re-added video color adjustments, which are now done in full 8-bit
colorspace for more precision
Gamma ramp option is gone. It's now the gamma option, which now only
affects the lower-half of the colors.
A value of 1.0 gives you the original, washed out colors. 1.75 is what
the gamma ramp checkbox used to do (roughly).
The new default is 1.5, which still prevents color washout, but isn't as
overly dark as before.
I wanted to make the core/interface stuff abstract the complexity of
setting up a new C++ class, but it really didn't make anything easier.
It was all one-line stubs to internal functions, and there was just too
many platform-specific things that needed to be captured, so I did away
with that. Made a base class for the ui/interface stuff to get rid of
a lot of switch(mode()) stuff, still a work in progress.
2011-10-29 07:32:20 +00:00
|
|
|
}
|
|
|
|
|
2016-03-26 01:56:15 +00:00
|
|
|
auto SA1::lastCycle() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
if(mmio.sa1_nmi && !mmio.sa1_nmicl) {
|
|
|
|
status.interrupt_pending = true;
|
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
|
|
|
r.vector = mmio.cnv;
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.sa1_nmifl = true;
|
|
|
|
mmio.sa1_nmicl = 1;
|
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
|
|
|
r.wai = false;
|
|
|
|
} else if(!r.p.i) {
|
2010-08-09 13:28:56 +00:00
|
|
|
if(mmio.timer_irqen && !mmio.timer_irqcl) {
|
|
|
|
status.interrupt_pending = true;
|
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
|
|
|
r.vector = mmio.civ;
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.timer_irqfl = true;
|
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
|
|
|
r.wai = false;
|
2010-08-09 13:28:56 +00:00
|
|
|
} else if(mmio.dma_irqen && !mmio.dma_irqcl) {
|
|
|
|
status.interrupt_pending = true;
|
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
|
|
|
r.vector = mmio.civ;
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.dma_irqfl = true;
|
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
|
|
|
r.wai = false;
|
2010-08-09 13:28:56 +00:00
|
|
|
} else if(mmio.sa1_irq && !mmio.sa1_irqcl) {
|
|
|
|
status.interrupt_pending = true;
|
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
|
|
|
r.vector = mmio.civ;
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.sa1_irqfl = true;
|
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
|
|
|
r.wai = false;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-03-26 01:56:15 +00:00
|
|
|
auto SA1::interruptPending() const -> bool {
|
2010-08-09 13:28:56 +00:00
|
|
|
return status.interrupt_pending;
|
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::tick() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
step(2);
|
2015-12-14 09:41:06 +00:00
|
|
|
if(++status.tick_counter == 0) synchronizeCPU();
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//adjust counters:
|
|
|
|
//note that internally, status counters are in clocks;
|
|
|
|
//whereas MMIO register counters are in dots (4 clocks = 1 dot)
|
|
|
|
if(mmio.hvselb == 0) {
|
|
|
|
//HV timer
|
|
|
|
status.hcounter += 2;
|
|
|
|
if(status.hcounter >= 1364) {
|
|
|
|
status.hcounter = 0;
|
|
|
|
if(++status.vcounter >= status.scanlines) status.vcounter = 0;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
//linear timer
|
|
|
|
status.hcounter += 2;
|
|
|
|
status.vcounter += (status.hcounter >> 11);
|
|
|
|
status.hcounter &= 0x07ff;
|
|
|
|
status.vcounter &= 0x01ff;
|
|
|
|
}
|
|
|
|
|
|
|
|
//test counters for timer IRQ
|
|
|
|
switch((mmio.ven << 1) + (mmio.hen << 0)) {
|
2013-05-05 09:21:30 +00:00
|
|
|
case 0: break;
|
|
|
|
case 1: if(status.hcounter == (mmio.hcnt << 2)) trigger_irq(); break;
|
|
|
|
case 2: if(status.vcounter == mmio.vcnt && status.hcounter == 0) trigger_irq(); break;
|
Update to v094r17 release.
byuu says:
This updates higan to use the new Markup::Node changes. This is a really
big change, and one slight typo anywhere could break certain classes of
games from playing.
I don't have ananke hooked up again yet, so I don't have the ability to
test this much. If anyone with some v094 game folders wouldn't mind
testing, I'd help out a great deal.
I'm most concerned about testing one of each SNES special chip game.
Most notably, systems like the SA-1, HitachiDSP and NEC-DSP were using
the fancier lookups, eg node["rom[0]/name"], which I had to convert to
a rather ugly node["rom"].at(0)["name"], which I'm fairly confident
won't work. I'm going to blame that on the fumes from the shelves I just
stained >.> Might work with node.find("rom[0]/name")(0) though ...? But
so ugly ... ugh.
That aside, this WIP adds the accuracy-PPU inlining, so the accuracy
profile should run around 7.5% faster than before.
2015-05-02 13:05:46 +00:00
|
|
|
case 3: if(status.vcounter == mmio.vcnt && status.hcounter == (mmio.hcnt << 2)) trigger_irq(); break;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::trigger_irq() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
mmio.timer_irqfl = true;
|
|
|
|
if(mmio.timer_irqen) mmio.timer_irqcl = 0;
|
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::init() -> void {
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::load() -> void {
|
Update to v075 release.
byuu says:
This release brings improved Super Game Boy emulation, the final SHA256
hashes for the DSP-(1,1B,2,3,4) and ST-(0010,0011) coprocessors, user
interface improvements, and major internal code restructuring.
Changelog (since v074):
- completely rewrote memory sub-system to support 1-byte granularity in
XML mapping
- removed Memory inheritance and MMIO class completely, any address can
be mapped to any function now
- SuperFX: removed SuperFXBus : Bus, now implemented manually
- SA-1: removed SA1Bus : Bus, now implemented manually
- entire bus mapping is now static, happens once on cartridge load
- as a result, read/write handlers now handle MMC mapping; slower
average case, far faster worst case
- namespace memory is no more, RAM arrays are stored inside the chips
they are owned by now
- GameBoy: improved CPU HALT emulation, fixes Zelda: Link's Awakening
scrolling
- GameBoy: added serial emulation (cannot connect to another GB yet),
fixes Shin Megami Tensei - Devichil
- GameBoy: improved LCD STAT emulation, fixes Sagaia
- ui: added fullscreen support (F11 key), video settings allows for
three scale settings
- ui: fixed brightness, contrast, gamma, audio volume, input frequency
values on program startup
- ui: since Qt is dead, config file becomes bsnes.cfg once again
- Super Game Boy: you can now load the BIOS without a game inserted to
see a pretty white box
- ui-gameboy: can be built without SNES components now
- libsnes: now a UI target, compile with 'make ui=ui-libsnes'
- libsnes: added WRAM, APURAM, VRAM, OAM, CGRAM access (cheat search,
etc)
- source: removed launcher/, as the Qt port is now gone
- source: Makefile restructuring to better support new ui targets
- source: lots of other internal code cleanup work
2011-01-27 08:52:34 +00:00
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::unload() -> void {
|
2012-07-08 02:57:34 +00:00
|
|
|
rom.reset();
|
|
|
|
iram.reset();
|
|
|
|
bwram.reset();
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::power() -> void {
|
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
|
|
|
r.a = 0x0000;
|
|
|
|
r.x = 0x0000;
|
|
|
|
r.y = 0x0000;
|
|
|
|
r.s = 0x01ff;
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
2015-11-14 00:52:51 +00:00
|
|
|
auto SA1::reset() -> void {
|
2015-11-10 11:02:29 +00:00
|
|
|
create(SA1::Enter, system.cpuFrequency());
|
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
|
|
|
cpubwram.dma = false;
|
2015-11-14 00:52:51 +00:00
|
|
|
for(auto addr : range(iram.size())) {
|
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, 0x00);
|
2010-08-09 13:28:56 +00:00
|
|
|
}
|
|
|
|
|
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
|
|
|
r.pc.d = 0x000000;
|
|
|
|
r.x.h = 0x00;
|
|
|
|
r.y.h = 0x00;
|
|
|
|
r.s.h = 0x01;
|
|
|
|
r.d = 0x0000;
|
|
|
|
r.db = 0x00;
|
|
|
|
r.p = 0x34;
|
|
|
|
r.e = 1;
|
|
|
|
r.mdr = 0x00;
|
|
|
|
r.wai = false;
|
|
|
|
r.vector = 0x0000;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
status.tick_counter = 0;
|
|
|
|
|
|
|
|
status.interrupt_pending = false;
|
|
|
|
|
|
|
|
status.scanlines = (system.region() == System::Region::NTSC ? 262 : 312);
|
|
|
|
status.vcounter = 0;
|
|
|
|
status.hcounter = 0;
|
|
|
|
|
|
|
|
dma.line = 0;
|
|
|
|
|
|
|
|
//$2200 CCNT
|
|
|
|
mmio.sa1_irq = false;
|
|
|
|
mmio.sa1_rdyb = false;
|
|
|
|
mmio.sa1_resb = true;
|
|
|
|
mmio.sa1_nmi = false;
|
|
|
|
mmio.smeg = 0;
|
|
|
|
|
|
|
|
//$2201 SIE
|
|
|
|
mmio.cpu_irqen = false;
|
|
|
|
mmio.chdma_irqen = false;
|
|
|
|
|
|
|
|
//$2202 SIC
|
|
|
|
mmio.cpu_irqcl = false;
|
|
|
|
mmio.chdma_irqcl = false;
|
|
|
|
|
|
|
|
//$2203,$2204 CRV
|
|
|
|
mmio.crv = 0x0000;
|
|
|
|
|
|
|
|
//$2205,$2206 CNV
|
|
|
|
mmio.cnv = 0x0000;
|
|
|
|
|
|
|
|
//$2207,$2208 CIV
|
|
|
|
mmio.civ = 0x0000;
|
|
|
|
|
|
|
|
//$2209 SCNT
|
|
|
|
mmio.cpu_irq = false;
|
|
|
|
mmio.cpu_ivsw = false;
|
|
|
|
mmio.cpu_nvsw = false;
|
|
|
|
mmio.cmeg = 0;
|
|
|
|
|
|
|
|
//$220a CIE
|
|
|
|
mmio.sa1_irqen = false;
|
|
|
|
mmio.timer_irqen = false;
|
|
|
|
mmio.dma_irqen = false;
|
|
|
|
mmio.sa1_nmien = false;
|
|
|
|
|
|
|
|
//$220b CIC
|
|
|
|
mmio.sa1_irqcl = false;
|
|
|
|
mmio.timer_irqcl = false;
|
|
|
|
mmio.dma_irqcl = false;
|
|
|
|
mmio.sa1_nmicl = false;
|
|
|
|
|
|
|
|
//$220c,$220d SNV
|
|
|
|
mmio.snv = 0x0000;
|
|
|
|
|
|
|
|
//$220e,$220f SIV
|
|
|
|
mmio.siv = 0x0000;
|
|
|
|
|
|
|
|
//$2210
|
|
|
|
mmio.hvselb = false;
|
|
|
|
mmio.ven = false;
|
|
|
|
mmio.hen = false;
|
|
|
|
|
|
|
|
//$2212,$2213 HCNT
|
|
|
|
mmio.hcnt = 0x0000;
|
|
|
|
|
|
|
|
//$2214,$2215 VCNT
|
|
|
|
mmio.vcnt = 0x0000;
|
|
|
|
|
|
|
|
//$2220-2223 CXB, DXB, EXB, FXB
|
2012-05-12 02:34:35 +00:00
|
|
|
mmio.cbmode = 0;
|
|
|
|
mmio.dbmode = 0;
|
|
|
|
mmio.ebmode = 0;
|
|
|
|
mmio.fbmode = 0;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
mmio.cb = 0x00;
|
|
|
|
mmio.db = 0x01;
|
2012-05-12 02:34:35 +00:00
|
|
|
mmio.eb = 0x02;
|
|
|
|
mmio.fb = 0x03;
|
2010-08-09 13:28:56 +00:00
|
|
|
|
|
|
|
//$2224 BMAPS
|
|
|
|
mmio.sbm = 0x00;
|
|
|
|
|
|
|
|
//$2225 BMAP
|
|
|
|
mmio.sw46 = false;
|
|
|
|
mmio.cbm = 0x00;
|
|
|
|
|
|
|
|
//$2226 SWBE
|
|
|
|
mmio.swen = false;
|
|
|
|
|
|
|
|
//$2227 CWBE
|
|
|
|
mmio.cwen = false;
|
|
|
|
|
|
|
|
//$2228 BWPA
|
|
|
|
mmio.bwp = 0x0f;
|
|
|
|
|
|
|
|
//$2229 SIWP
|
|
|
|
mmio.siwp = 0x00;
|
|
|
|
|
|
|
|
//$222a CIWP
|
|
|
|
mmio.ciwp = 0x00;
|
|
|
|
|
|
|
|
//$2230 DCNT
|
|
|
|
mmio.dmaen = false;
|
|
|
|
mmio.dprio = false;
|
|
|
|
mmio.cden = false;
|
|
|
|
mmio.cdsel = false;
|
|
|
|
mmio.dd = 0;
|
|
|
|
mmio.sd = 0;
|
|
|
|
|
|
|
|
//$2231 CDMA
|
|
|
|
mmio.chdend = false;
|
|
|
|
mmio.dmasize = 0;
|
|
|
|
mmio.dmacb = 0;
|
|
|
|
|
|
|
|
//$2232-$2234 SDA
|
|
|
|
mmio.dsa = 0x000000;
|
|
|
|
|
|
|
|
//$2235-$2237 DDA
|
|
|
|
mmio.dda = 0x000000;
|
|
|
|
|
|
|
|
//$2238,$2239 DTC
|
|
|
|
mmio.dtc = 0x0000;
|
|
|
|
|
|
|
|
//$223f BBF
|
|
|
|
mmio.bbf = 0;
|
|
|
|
|
|
|
|
//$2240-$224f BRF
|
|
|
|
for(unsigned i = 0; i < 16; i++) {
|
|
|
|
mmio.brf[i] = 0x00;
|
|
|
|
}
|
|
|
|
|
|
|
|
//$2250 MCNT
|
|
|
|
mmio.acm = 0;
|
|
|
|
mmio.md = 0;
|
|
|
|
|
|
|
|
//$2251,$2252 MA
|
|
|
|
mmio.ma = 0x0000;
|
|
|
|
|
|
|
|
//$2253,$2254 MB
|
|
|
|
mmio.mb = 0x0000;
|
|
|
|
|
|
|
|
//$2258 VBD
|
|
|
|
mmio.hl = false;
|
|
|
|
mmio.vb = 16;
|
|
|
|
|
|
|
|
//$2259-$225b
|
|
|
|
mmio.va = 0x000000;
|
|
|
|
mmio.vbit = 0;
|
|
|
|
|
|
|
|
//$2300 SFR
|
|
|
|
mmio.cpu_irqfl = false;
|
|
|
|
mmio.chdma_irqfl = false;
|
|
|
|
|
|
|
|
//$2301 CFR
|
|
|
|
mmio.sa1_irqfl = false;
|
|
|
|
mmio.timer_irqfl = false;
|
|
|
|
mmio.dma_irqfl = false;
|
|
|
|
mmio.sa1_nmifl = false;
|
|
|
|
|
|
|
|
//$2302,$2303 HCR
|
|
|
|
mmio.hcr = 0x0000;
|
|
|
|
|
|
|
|
//$2304,$2305 VCR
|
|
|
|
mmio.vcr = 0x0000;
|
|
|
|
|
|
|
|
//$2306-$230a MR
|
|
|
|
mmio.mr = 0;
|
|
|
|
|
|
|
|
//$230b
|
|
|
|
mmio.overflow = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|