1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-13 01:29:57 +00:00

Add TSB and TRB emulation.

This commit is contained in:
Radosław Kujawa 2017-01-29 22:54:06 +01:00
parent 923a9db649
commit 5554de9411
2 changed files with 39 additions and 4 deletions

View File

@ -3,7 +3,7 @@ OP_BRK,"brk",IMPLIED,1,NULL,false
OP_ORA_IZPX,"ora",IZPX,2,emul_ora,false
OP_NOPI_3,"nop",IMMEDIATE,2,NULL,false
OP_NOPI_4,"nop",IMPLIED,1,NULL,false
OP_TSB_ZP,"tsb",ZP,2,NULL,false
OP_TSB_ZP,"tsb",ZP,2,emul_tsb,false
OP_ORA_ZP,"ora",ZP,2,emul_ora,false
OP_ASL_ZP,"asl",ZP,2,emul_asl,false
OP_RMB0_ZP,"rmb0",ZP,2,emul_rmb0,false
@ -11,7 +11,7 @@ OP_PHP,"php",IMPLIED,1,emul_php,false
OP_ORA_IMM,"ora",IMMEDIATE,2,emul_ora,false
OP_ASL,"asl",ACCUMULATOR,1,emul_asl,false
OP_NOPI_C,"nop",IMPLIED,1,NULL,false
OP_TSB_ABS,"tsb",ABSOLUTE,3,NULL,false
OP_TSB_ABS,"tsb",ABSOLUTE,3,emul_tsb,false
OP_ORA_ABS,"ora",ABSOLUTE,3,emul_ora,false
OP_ASL_ABS,"asl",ABSOLUTE,3,emul_asl,false
OP_BBR0_REL,"bbr0",ZPR,2,NULL,true
@ -19,7 +19,7 @@ OP_BPL_REL,"bpl",RELATIVE,2,emul_bpl,true
OP_ORA_IZPY,"ora",IZPY,2,emul_ora,false
OP_ORA_IZP,"ora",IZP,2,emul_ora,false
OP_NOPI_14,"nop",IMPLIED,1,NULL,false
OP_TRB_ZP,"trb",ZP,2,NULL,false
OP_TRB_ZP,"trb",ZP,2,emul_trb,false
OP_ORA_ZPX,"ora",ZPX,2,emul_ora,false
OP_ASL_ZPX,"asl",ZPX,2,emul_asl,false
OP_RMB1_ZP,"rmb1",ZP,1,emul_rmb1,false
@ -27,7 +27,7 @@ OP_CLC,"clc",IMPLIED,1,emul_clc,false
OP_ORA_ABSY,"ora",ABSOLUTEY,3,emul_ora,false
OP_INC,"inc",ACCUMULATOR,1,emul_inc,false
OP_NOPI_1C,"nop",IMPLIED,1,NULL,false
OP_TRB_ABS,"trb",ABSOLUTE,3,NULL,false
OP_TRB_ABS,"trb",ABSOLUTE,3,emul_trb,false
OP_ORA_ABSX,"ora",ABSOLUTEX,3,emul_ora,false
OP_ASL_ABSX,"asl",ABSOLUTEX,3,emul_asl,false
OP_BBR1_REL,"bbr1",ZPR,2,NULL,true

1 opcode_id mnemonic addressing size emulation modify_pc
3 OP_ORA_IZPX ora IZPX 2 emul_ora false
4 OP_NOPI_3 nop IMMEDIATE 2 NULL false
5 OP_NOPI_4 nop IMPLIED 1 NULL false
6 OP_TSB_ZP tsb ZP 2 NULL emul_tsb false
7 OP_ORA_ZP ora ZP 2 emul_ora false
8 OP_ASL_ZP asl ZP 2 emul_asl false
9 OP_RMB0_ZP rmb0 ZP 2 emul_rmb0 false
11 OP_ORA_IMM ora IMMEDIATE 2 emul_ora false
12 OP_ASL asl ACCUMULATOR 1 emul_asl false
13 OP_NOPI_C nop IMPLIED 1 NULL false
14 OP_TSB_ABS tsb ABSOLUTE 3 NULL emul_tsb false
15 OP_ORA_ABS ora ABSOLUTE 3 emul_ora false
16 OP_ASL_ABS asl ABSOLUTE 3 emul_asl false
17 OP_BBR0_REL bbr0 ZPR 2 NULL true
19 OP_ORA_IZPY ora IZPY 2 emul_ora false
20 OP_ORA_IZP ora IZP 2 emul_ora false
21 OP_NOPI_14 nop IMPLIED 1 NULL false
22 OP_TRB_ZP trb ZP 2 NULL emul_trb false
23 OP_ORA_ZPX ora ZPX 2 emul_ora false
24 OP_ASL_ZPX asl ZPX 2 emul_asl false
25 OP_RMB1_ZP rmb1 ZP 1 emul_rmb1 false
27 OP_ORA_ABSY ora ABSOLUTEY 3 emul_ora false
28 OP_INC inc ACCUMULATOR 1 emul_inc false
29 OP_NOPI_1C nop IMPLIED 1 NULL false
30 OP_TRB_ABS trb ABSOLUTE 3 NULL emul_trb false
31 OP_ORA_ABSX ora ABSOLUTEX 3 emul_ora false
32 OP_ASL_ABSX asl ABSOLUTEX 3 emul_asl false
33 OP_BBR1_REL bbr1 ZPR 2 NULL true

View File

@ -648,6 +648,7 @@ void
emul_smb0(rk65c02emu_t *e, void *id, instruction_t *i)
{
emul_smb(e, id, i, 0);
}
void
emul_smb1(rk65c02emu_t *e, void *id, instruction_t *i)
{
@ -740,6 +741,40 @@ emul_tay(rk65c02emu_t *e, void *id, instruction_t *i)
instruction_status_adjust_negative(e, e->regs.Y);
}
/* TRB - test and reset bits */
void
emul_trb(rk65c02emu_t *e, void *id, instruction_t *i)
{
uint8_t val;
val = instruction_data_read_1(e, (instrdef_t *) id, i);
if (e->regs.A & val)
e->regs.P &= ~P_ZERO;
else
e->regs.P |= P_ZERO;
instruction_data_write_1(e, (instrdef_t *) id, i,
val & (e->regs.A ^ 0xFF));
}
/* TSB - test and set bits */
void
emul_tsb(rk65c02emu_t *e, void *id, instruction_t *i)
{
uint8_t val;
val = instruction_data_read_1(e, (instrdef_t *) id, i);
if (e->regs.A & val)
e->regs.P &= ~P_ZERO;
else
e->regs.P |= P_ZERO;
instruction_data_write_1(e, (instrdef_t *) id, i,
val | e->regs.A);
}
/* TSX - transfer stack pointer to X */
void
emul_tsx(rk65c02emu_t *e, void *id, instruction_t *i)