mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-12 10:30:23 +00:00
Add CLI and SEI emulation and test case.
This commit is contained in:
parent
ee66f9c78c
commit
f3205e7272
@ -87,7 +87,7 @@ OP_NOPI_55,"nop",ZPX,2,NULL,false
|
||||
OP_EOR_ZPX,"eor",ZPX,2,emul_eor,false
|
||||
OP_LSR_ZPX,"lsr",ZPX,2,emul_lsr,false
|
||||
OP_RMB5_ZP,"rmb5",ZP,2,emul_rmb5,false
|
||||
OP_CLI,"cli",IMPLIED,1,NULL,false
|
||||
OP_CLI,"cli",IMPLIED,1,emul_cli,false
|
||||
OP_EOR_ABSY,"eor",ABSOLUTEY,3,emul_eor,false
|
||||
OP_PHY,"phy",IMPLIED,1,emul_phy,false
|
||||
OP_NOPI_5C,"nop",IMPLIED,1,NULL,false
|
||||
@ -119,7 +119,7 @@ OP_STZ_ZPX,"stz",ZPX,2,emul_stz,false
|
||||
OP_ADC_ZPX,"adc",ZPX,2,NULL,false
|
||||
OP_ROR_ZPX,"ror",ZPX,2,emul_ror,false
|
||||
OP_RMB7_ZP,"rmb7",ZP,2,emul_rmb7,false
|
||||
OP_SEI,"sei",IMPLIED,1,NULL,false
|
||||
OP_SEI,"sei",IMPLIED,1,emul_sei,false
|
||||
OP_ADC_ABSY,"adc",ABSOLUTEY,3,NULL,false
|
||||
OP_PLY,"ply",IMPLIED,1,emul_ply,false
|
||||
OP_NOPI_7C,"nop",IMPLIED,1,NULL,false
|
||||
|
|
@ -72,6 +72,13 @@ emul_clc(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
e->regs.P &= ~P_CARRY;
|
||||
}
|
||||
|
||||
/* CLI - clear interrupt disable flag */
|
||||
void
|
||||
emul_cli(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.P &= ~P_IRQ_DISABLE;
|
||||
}
|
||||
|
||||
/* CLV - clear overflow flag */
|
||||
void
|
||||
emul_clv(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
@ -446,6 +453,13 @@ emul_sec(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
e->regs.P |= P_CARRY;
|
||||
}
|
||||
|
||||
/* SEI - set the interrupt disable flag */
|
||||
void
|
||||
emul_sei(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.P |= P_IRQ_DISABLE;
|
||||
}
|
||||
|
||||
/* STP - stop the processor */
|
||||
void
|
||||
emul_stp(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
|
@ -324,6 +324,25 @@ ATF_TC_BODY(emul_clc_sec, tc)
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(emul_cli_sei);
|
||||
ATF_TC_BODY(emul_cli_sei, tc)
|
||||
{
|
||||
rk65c02emu_t e;
|
||||
bus_t b;
|
||||
|
||||
b = bus_init();
|
||||
e = rk65c02_init(&b);
|
||||
|
||||
/* CLI */
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_cli.rom", tc));
|
||||
ATF_CHECK(!(e.regs.P & P_IRQ_DISABLE));
|
||||
/* SEI */
|
||||
ATF_REQUIRE(rom_start(&e, "test_emulation_sei.rom", tc));
|
||||
ATF_CHECK(e.regs.P & P_IRQ_DISABLE);
|
||||
|
||||
bus_finish(&b);
|
||||
}
|
||||
|
||||
ATF_TC_WITHOUT_HEAD(emul_and);
|
||||
ATF_TC_BODY(emul_and, tc)
|
||||
{
|
||||
@ -682,6 +701,7 @@ ATF_TP_ADD_TCS(tp)
|
||||
ATF_TP_ADD_TC(tp, emul_dec);
|
||||
ATF_TP_ADD_TC(tp, emul_dex_dey);
|
||||
ATF_TP_ADD_TC(tp, emul_clc_sec);
|
||||
ATF_TP_ADD_TC(tp, emul_cli_sei);
|
||||
ATF_TP_ADD_TC(tp, emul_clv);
|
||||
ATF_TP_ADD_TC(tp, emul_inc);
|
||||
ATF_TP_ADD_TC(tp, emul_inx_iny);
|
||||
|
3
test/test_emulation_cli.s
Normal file
3
test/test_emulation_cli.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: cli
|
||||
stp
|
||||
|
3
test/test_emulation_sei.s
Normal file
3
test/test_emulation_sei.s
Normal file
@ -0,0 +1,3 @@
|
||||
start: sei
|
||||
stp
|
||||
|
Loading…
Reference in New Issue
Block a user