1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-04 04:51:27 +00:00

Add STZ emulation.

This commit is contained in:
Radosław Kujawa 2017-01-21 21:46:35 +01:00
parent 86c9c6414c
commit c7633feb87
5 changed files with 36 additions and 2 deletions

View File

@ -99,7 +99,7 @@ OP_RTS,"rts",IMPLIED,1,NULL
OP_ADC_IZPX,"adc",IZPX,2,NULL
OP_NOPI_63,"nop",IMMEDIATE,2,NULL
OP_NOPI_64,"nop",IMPLIED,1,NULL
OP_STZ_ZP,"stz",ZP,2,NULL
OP_STZ_ZP,"stz",ZP,2,emul_stz
OP_ADC_ZP,"adc",ZP,2,NULL
OP_ROR_ZP,"ror",ZP,2,NULL
OP_RMB6_ZP,"rmb6",ZP,2,NULL

1 opcode_id mnemonic addressing size emulation
99 OP_ADC_IZPX adc IZPX 2 NULL
100 OP_NOPI_63 nop IMMEDIATE 2 NULL
101 OP_NOPI_64 nop IMPLIED 1 NULL
102 OP_STZ_ZP stz ZP 2 NULL emul_stz
103 OP_ADC_ZP adc ZP 2 NULL
104 OP_ROR_ZP ror ZP 2 NULL
105 OP_RMB6_ZP rmb6 ZP 2 NULL

View File

@ -63,3 +63,14 @@ emul_stp(rk65c02emu_t *e, instruction_t *i)
e->state = STOPPED;
}
/* STZ - store zero */
void
emul_stz(rk65c02emu_t *e, instruction_t *i)
{
instrdef_t id;
id = instruction_decode(i->opcode);
instruction_data_write_1(e, &id, i, 0);
}

View File

@ -8,7 +8,8 @@ TESTS=test_bus test_emulation
TESTROMS=test_emulation_and_imm.rom \
test_emulation_pha.rom test_emulation_pla.rom \
test_emulation_nop.rom \
test_emulation_lda_imm.rom test_emulation_lda_zp.rom
test_emulation_lda_imm.rom test_emulation_lda_zp.rom \
test_emulation_stz_zp.rom
all : $(TESTS) $(TESTROMS)

View File

@ -45,6 +45,23 @@ ATF_TC_BODY(emul_lda, tc)
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_stz);
ATF_TC_BODY(emul_stz, tc)
{
rk65c02emu_t e;
bus_t b;
b = bus_init();
e = rk65c02_init(&b);
/* STZ zp */
bus_write_1(&b, 0x10, 0xAA);
ATF_REQUIRE(rom_start(&e, "test_emulation_stz_zp.rom"));
ATF_CHECK(bus_read_1(&b, 0x10) == 0x00);
bus_finish(&b);
}
ATF_TC_WITHOUT_HEAD(emul_and);
ATF_TC_BODY(emul_and, tc)
{
@ -134,6 +151,8 @@ ATF_TP_ADD_TCS(tp)
ATF_TP_ADD_TC(tp, emul_and);
ATF_TP_ADD_TC(tp, emul_lda);
ATF_TP_ADD_TC(tp, emul_nop);
ATF_TP_ADD_TC(tp, emul_stz);
ATF_TP_ADD_TC(tp, emul_stack);
return (atf_no_error());

View File

@ -0,0 +1,3 @@
start: stz 0x10
stp