mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-11 18:49:16 +00:00
Add emulation of WAI instruction.
This commit is contained in:
parent
5cca703020
commit
4c7a15f524
@ -202,7 +202,7 @@ OP_SMB4_ZP,"smb4",ZP,2,emul_smb4,false
|
||||
OP_INY,"iny",IMPLIED,1,emul_iny,false
|
||||
OP_CMP_IMM,"cmp",IMMEDIATE,2,emul_cmp,false
|
||||
OP_DEX,"dex",IMPLIED,1,emul_dex,false
|
||||
OP_WAI,"wai",IMPLIED,1,NULL,false
|
||||
OP_WAI,"wai",IMPLIED,1,emul_wai,false
|
||||
OP_CPY_ABS,"cpy",ABSOLUTE,3,emul_cpy,false
|
||||
OP_CMP_ABS,"cmp",ABSOLUTE,3,emul_cmp,false
|
||||
OP_DEC_ABS,"dec",ABSOLUTE,3,emul_dec,false
|
||||
|
|
@ -1014,3 +1014,11 @@ emul_tya(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
instruction_status_adjust_negative(e, e->regs.A);
|
||||
}
|
||||
|
||||
/* WAI - wait for interrupt */
|
||||
void
|
||||
emul_wai(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->state = STOPPED;
|
||||
e->stopreason = WAI;
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,7 @@ rk65c02_init(bus_t *b)
|
||||
|
||||
e.bus = b;
|
||||
e.state = STOPPED;
|
||||
e.stopreason = HOST;
|
||||
e.regs.P = P_UNDEFINED|P_IRQ_DISABLE;
|
||||
/* reset also clears the decimal flag */
|
||||
e.regs.P &= ~P_DECIMAL;
|
||||
@ -32,7 +33,25 @@ rk65c02_init(bus_t *b)
|
||||
}
|
||||
|
||||
/*
|
||||
* Do interrupt'ey things and start the interrupt service routine.
|
||||
* Assert the IRQ line.
|
||||
*/
|
||||
void
|
||||
rk65c02_assert_irq(rk65c02emu_t *e)
|
||||
{
|
||||
/*
|
||||
* Clearly this is too simpleton'ish, because more than one device
|
||||
* might want to assert the interrupt line (on hardware level it is
|
||||
* active low, so can just be pulled down by any device connected
|
||||
* to it.
|
||||
*/
|
||||
e->irq = true;
|
||||
|
||||
if ((e->state == STOPPED) && (e->stopreason == WAI))
|
||||
rk65c02_start(e);
|
||||
}
|
||||
|
||||
/*
|
||||
* Respond to interrupt and start the interrupt service routine.
|
||||
*/
|
||||
void
|
||||
rk65c02_irq(rk65c02emu_t *e)
|
||||
|
@ -11,6 +11,7 @@ typedef enum {
|
||||
|
||||
typedef enum {
|
||||
STP, /* due to 65C02 STP instruction */
|
||||
WAI, /* waiting for interrupt */
|
||||
BREAKPOINT, /* due to breakpoint set */
|
||||
WATCHPOINT, /* due to watchpoint set */
|
||||
STEPPED, /* stepped appropriate number of instructions */
|
||||
|
Loading…
Reference in New Issue
Block a user