o irq button to bsnes menu

o trigger irq from bsnes engine
o add visual feedback in snes poc
This commit is contained in:
David Voswinkel 2009-05-20 00:45:44 +02:00
parent 5dd4904f9c
commit 8929a96e6e
8 changed files with 33 additions and 6 deletions

View File

@ -14,6 +14,8 @@
; Main Code ; Main Code
;============================================================================ ;============================================================================
.EQU PalNum $0000 ; Use some RAM
.BANK 0 SLOT 0 .BANK 0 SLOT 0
.ORG 0 .ORG 0
.SECTION "MainCode" .SECTION "MainCode"
@ -46,17 +48,17 @@ Start_do:
; Setup Video modes and other stuff, then turn on the screen ; Setup Video modes and other stuff, then turn on the screen
jsr SetupVideo jsr SetupVideo
sei
cop
prints "Init done" prints "Init done"
stz $3001
cop
lda #$81 lda #$81
sta $4200 sta $4200
Infinity: Infinity:
lda PalNum
clc
adc #$01
and #$ff ; If > palette starting color > 24 (00011100), make 0
sta PalNum
jmp Infinity ; bwa hahahahaha jmp Infinity ; bwa hahahahaha
@ -111,6 +113,10 @@ NMIHandler:
rti rti
IRQHandler: IRQHandler:
stz $2121
lda PalNum
sta $2122
sta $2122
prints "IRQHandler" prints "IRQHandler"
rti rti

View File

@ -64,6 +64,10 @@ void SNES::term() {
snesinterface.term(); snesinterface.term();
} }
void SNES::irq() {
cpu.triggerIRQ();
}
void SNES::power() { void SNES::power() {
snes_region = max(0, min(2, snes.config.region)); snes_region = max(0, min(2, snes.config.region));
snes_expansion = max(0, min(1, snes.config.expansion_port)); snes_expansion = max(0, min(1, snes.config.expansion_port));

View File

@ -60,6 +60,7 @@ public:
virtual void term(); virtual void term();
virtual void power(); virtual void power();
virtual void reset(); virtual void reset();
virtual void irq();
virtual void frame(); virtual void frame();
virtual void scanline(); virtual void scanline();

View File

@ -12,6 +12,7 @@ void MainWindow::setup() {
system_power_off = system_power->addAction("Off"); system_power_off = system_power->addAction("Off");
system_power_off->setCheckable(true); system_power_off->setCheckable(true);
system_reset = system->addAction("&Reset"); system_reset = system->addAction("&Reset");
system_irq = system->addAction("&Irq");
system->addSeparator(); system->addSeparator();
system_port1 = system->addMenu("Controller Port 1"); system_port1 = system->addMenu("Controller Port 1");
system_port1_none = system_port1->addAction("&None"); system_port1_none = system_port1->addAction("&None");
@ -150,6 +151,7 @@ void MainWindow::setup() {
connect(system_power_on, SIGNAL(triggered()), this, SLOT(powerOn())); connect(system_power_on, SIGNAL(triggered()), this, SLOT(powerOn()));
connect(system_power_off, SIGNAL(triggered()), this, SLOT(powerOff())); connect(system_power_off, SIGNAL(triggered()), this, SLOT(powerOff()));
connect(system_reset, SIGNAL(triggered()), this, SLOT(reset())); connect(system_reset, SIGNAL(triggered()), this, SLOT(reset()));
connect(system_irq, SIGNAL(triggered()), this, SLOT(irq()));
connect(system_port1_none, SIGNAL(triggered()), this, SLOT(setPort1None())); connect(system_port1_none, SIGNAL(triggered()), this, SLOT(setPort1None()));
connect(system_port1_joypad, SIGNAL(triggered()), this, SLOT(setPort1Joypad())); connect(system_port1_joypad, SIGNAL(triggered()), this, SLOT(setPort1Joypad()));
connect(system_port1_multitap, SIGNAL(triggered()), this, SLOT(setPort1Multitap())); connect(system_port1_multitap, SIGNAL(triggered()), this, SLOT(setPort1Multitap()));
@ -251,6 +253,7 @@ void MainWindow::loadCartridge() {
void MainWindow::powerOn() { utility.modifySystemState(Utility::PowerOn); } void MainWindow::powerOn() { utility.modifySystemState(Utility::PowerOn); }
void MainWindow::powerOff() { utility.modifySystemState(Utility::PowerOff); } void MainWindow::powerOff() { utility.modifySystemState(Utility::PowerOff); }
void MainWindow::reset() { utility.modifySystemState(Utility::Reset); } void MainWindow::reset() { utility.modifySystemState(Utility::Reset); }
void MainWindow::irq() { utility.modifySystemState(Utility::Irq); }
void MainWindow::setPort1None() { snes.config.controller_port1 = SNES::Input::DeviceNone; utility.updateControllers(); syncUi(); } void MainWindow::setPort1None() { snes.config.controller_port1 = SNES::Input::DeviceNone; utility.updateControllers(); syncUi(); }
void MainWindow::setPort1Joypad() { snes.config.controller_port1 = SNES::Input::DeviceJoypad; utility.updateControllers(); syncUi(); } void MainWindow::setPort1Joypad() { snes.config.controller_port1 = SNES::Input::DeviceJoypad; utility.updateControllers(); syncUi(); }

View File

@ -25,6 +25,7 @@ public:
QAction *system_power_on; QAction *system_power_on;
QAction *system_power_off; QAction *system_power_off;
QAction *system_reset; QAction *system_reset;
QAction *system_irq;
QMenu *system_port1; QMenu *system_port1;
QAction *system_port1_none; QAction *system_port1_none;
QAction *system_port1_joypad; QAction *system_port1_joypad;
@ -86,6 +87,7 @@ public slots:
void powerOn(); void powerOn();
void powerOff(); void powerOff();
void reset(); void reset();
void irq();
void setPort1None(); void setPort1None();
void setPort1Joypad(); void setPort1Joypad();
void setPort1Multitap(); void setPort1Multitap();

View File

@ -54,6 +54,7 @@ public:
string loadCartridge; string loadCartridge;
string pauseEmulation; string pauseEmulation;
string resetSystem; string resetSystem;
string triggerIrq;
string powerCycleSystem; string powerCycleSystem;
string lowerSpeed; string lowerSpeed;
string raiseSpeed; string raiseSpeed;
@ -204,6 +205,7 @@ public:
attach(input.uiGeneral.loadCartridge = "none", "input.uiGeneral.loadCartridge"); attach(input.uiGeneral.loadCartridge = "none", "input.uiGeneral.loadCartridge");
attach(input.uiGeneral.pauseEmulation = "keyboard00.pause", "input.uiGeneral.pauseEmulation"); attach(input.uiGeneral.pauseEmulation = "keyboard00.pause", "input.uiGeneral.pauseEmulation");
attach(input.uiGeneral.resetSystem = "none", "input.uiGeneral.resetSystem"); attach(input.uiGeneral.resetSystem = "none", "input.uiGeneral.resetSystem");
attach(input.uiGeneral.triggerIrq = "none", "input.uiGeneral.triggerIrq");
attach(input.uiGeneral.powerCycleSystem = "none", "input.uiGeneral.powerCycleSystem"); attach(input.uiGeneral.powerCycleSystem = "none", "input.uiGeneral.powerCycleSystem");
attach(input.uiGeneral.lowerSpeed = "keyboard00.divide", "input.uiGeneral.lowerSpeed"); attach(input.uiGeneral.lowerSpeed = "keyboard00.divide", "input.uiGeneral.lowerSpeed");
attach(input.uiGeneral.raiseSpeed = "keyboard00.multiply", "input.uiGeneral.raiseSpeed"); attach(input.uiGeneral.raiseSpeed = "keyboard00.multiply", "input.uiGeneral.raiseSpeed");

View File

@ -154,6 +154,15 @@ void Utility::modifySystemState(system_state_t state) {
showMessage("System was reset."); showMessage("System was reset.");
} break; } break;
case Irq: {
if(cartridge.loaded() == false || application.power == false) break;
application.pause = false;
snes.irq();
showMessage("Irq was send.");
} break;
} }
winMain->syncUi(); winMain->syncUi();

View File

@ -26,7 +26,7 @@ public:
bool loadCartridgeSufamiTurbo(const char*, const char *, const char*); bool loadCartridgeSufamiTurbo(const char*, const char *, const char*);
void unloadCartridge(); void unloadCartridge();
enum system_state_t { LoadCartridge, UnloadCartridge, PowerOn, PowerOff, PowerCycle, Reset }; enum system_state_t { LoadCartridge, UnloadCartridge, PowerOn, PowerOff, PowerCycle, Reset, Irq };
void modifySystemState(system_state_t state); void modifySystemState(system_state_t state);
//window.cpp //window.cpp