Add autopoller and IRQ/NMI tracing
This commit is contained in:
parent
5bc96b8aee
commit
9682df9e33
2 changed files with 17 additions and 2 deletions
|
@ -69,14 +69,17 @@ void CPU::enter() {
|
|||
if(status.interrupt_pending) {
|
||||
status.interrupt_pending = false;
|
||||
if(status.nmi_pending) {
|
||||
if(dma_trace_fn) dma_trace_fn("-- NMI occured --");
|
||||
status.nmi_pending = false;
|
||||
regs.vector = (regs.e == false ? 0xffea : 0xfffa);
|
||||
op_irq();
|
||||
} else if(status.irq_pending) {
|
||||
if(dma_trace_fn) dma_trace_fn("-- IRQ occured --");
|
||||
status.irq_pending = false;
|
||||
regs.vector = (regs.e == false ? 0xffee : 0xfffe);
|
||||
op_irq();
|
||||
} else if(status.reset_pending) {
|
||||
if(dma_trace_fn) dma_trace_fn("-- RESET occured --");
|
||||
status.reset_pending = false;
|
||||
add_clocks(186);
|
||||
regs.pc.l = bus.read(0xfffc, false);
|
||||
|
|
|
@ -6,9 +6,9 @@ void CPU::step_auto_joypad_poll() {
|
|||
//cache enable state at first iteration
|
||||
if(status.auto_joypad_counter == 0) status.auto_joypad_latch = status.auto_joypad_poll;
|
||||
status.auto_joypad_active = status.auto_joypad_counter <= 15;
|
||||
|
||||
if(status.auto_joypad_active && status.auto_joypad_latch) {
|
||||
if(status.auto_joypad_counter == 0) {
|
||||
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
input.port2->latch(1);
|
||||
|
@ -23,6 +23,12 @@ void CPU::step_auto_joypad_poll() {
|
|||
status.joy2 = (status.joy2 << 1) | (bool)(port1 & 1);
|
||||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
if(status.auto_joypad_counter == 15) {
|
||||
char buf[512];
|
||||
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
if(dma_trace_fn) dma_trace_fn(buf);
|
||||
}
|
||||
}
|
||||
|
||||
status.auto_joypad_counter++;
|
||||
|
@ -40,6 +46,7 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
|||
status.auto_joypad_active = false;
|
||||
} else {
|
||||
if(status.auto_joypad_counter == 1) {
|
||||
if(dma_trace_fn) dma_trace_fn("-- Start automatic polling --");
|
||||
status.auto_joypad_active = true;
|
||||
interface->notifyLatched();
|
||||
input.port1->latch(1);
|
||||
|
@ -58,8 +65,13 @@ void CPU::step_auto_joypad_poll_NEW(bool polarity) {
|
|||
status.joy3 = (status.joy3 << 1) | (bool)(port0 & 2);
|
||||
status.joy4 = (status.joy4 << 1) | (bool)(port1 & 2);
|
||||
}
|
||||
if(status.auto_joypad_counter == 34)
|
||||
if(status.auto_joypad_counter == 34) {
|
||||
status.auto_joypad_active = false;
|
||||
char buf[512];
|
||||
sprintf(buf, "-- End automatic polling [%04x %04x %04x %04x] --",
|
||||
status.joy1, status.joy2, status.joy3, status.joy4);
|
||||
if(dma_trace_fn) dma_trace_fn(buf);
|
||||
}
|
||||
}
|
||||
status.auto_joypad_counter++;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue