1
0
mirror of https://github.com/rkujawa/rk65c02.git synced 2024-12-11 18:49:16 +00:00

Add ORA and EOR emulation.

This commit is contained in:
Radosław Kujawa 2017-01-23 14:53:05 +01:00
parent 6b7298cf8d
commit ee8a16a5ba
2 changed files with 37 additions and 17 deletions

View File

@ -1,14 +1,14 @@
opcode_id,mnemonic,addressing,size,emulation
OP_BRK,"brk",IMPLIED,1,NULL
OP_ORA_IZPX,"ora",IZPX,1,NULL
OP_ORA_IZPX,"ora",IZPX,1,emul_ora
OP_NOPI_3,"nop",IMMEDIATE,2,NULL
OP_NOPI_4,"nop",IMPLIED,1,NULL
OP_TSB_ZP,"tsb",ZP,2,NULL
OP_ORA_ZP,"ora",ZP,2,NULL
OP_ORA_ZP,"ora",ZP,2,emul_ora
OP_ASL_ZP,"asl",ZP,2,NULL
OP_RMB0_ZP,"rmb0",ZP,2,NULL
OP_PHP,"php",IMPLIED,1,emul_php
OP_ORA_IMM,"ora",IMMEDIATE,2,NULL
OP_ORA_IMM,"ora",IMMEDIATE,2,emul_ora
OP_ASL,"asl",ACCUMULATOR,1,NULL
OP_NOPI_C,"nop",IMPLIED,1,NULL
OP_TSB_ABS,"tsb",ABSOLUTE,3,NULL
@ -16,19 +16,19 @@ OP_ORA_ABS,"abs",ABSOLUTE,3,NULL
OP_ASL_ABS,"asl",ABSOLUTE,3,NULL
OP_BBR0_REL,"bbr0",ZPR,2,NULL
OP_BPL_REL,"bpl",RELATIVE,2,NULL
OP_ORA_IZPY,"ora",IZPY,2,NULL
OP_ORA_IZP,"ora",IZP,2,NULL
OP_ORA_IZPY,"ora",IZPY,2,emul_ora
OP_ORA_IZP,"ora",IZP,2,emul_ora
OP_NOPI_14,"nop",IMPLIED,1,NULL
OP_TRB_ZP,"trb",ZP,2,NULL
OP_ORA_ZPX,"ora",ZPX,2,NULL
OP_ORA_ZPX,"ora",ZPX,2,emul_ora
OP_ASL_ZPX,"asl",ZPX,2,NULL
OP_RMB1_ZP,"rmb1",ZP,1,NULL
OP_CLC,"clc",IMPLIED,1,emul_clc
OP_ORA_ABSY,"ora",ABSOLUTEY,3,NULL
OP_ORA_ABSY,"ora",ABSOLUTEY,3,emul_ora
OP_INC,"inc",ACCUMULATOR,1,NULL
OP_NOPI_1C,"nop",IMPLIED,1,NULL
OP_TRB_ABS,"trb",ABSOLUTE,3,NULL
OP_ORA_ABSX,"ora",ABSOLUTEX,3,NULL
OP_ORA_ABSX,"ora",ABSOLUTEX,3,emul_ora
OP_ASL_ABSX,"asl",ABSOLUTEX,3,NULL
OP_BBR1_REL,"bbr1",ZPR,2,NULL
OP_JSR,"jsr",ABSOLUTE,3,NULL
@ -64,35 +64,35 @@ OP_AND_ABSX,"and",ABSOLUTEX,3,NULL
OP_ROL_ABSX,"rol",ABSOLUTEX,3,NULL
OP_BBR3_REL,"bbr3",ZPR,2,NULL
OP_RTI,"rti",IMPLIED,1,NULL
OP_EOR_IZPX,"eor",IZPX,2,NULL
OP_EOR_IZPX,"eor",IZPX,2,emul_eor
OP_NOPI_43,"nop",IMMEDIATE,2,NULL
OP_NOPI_44,"nop",IMPLIED,1,NULL
OP_NOPI_45,"nop",ZP,2,NULL
OP_EOR_ZP,"eor",ZP,2,NULL
OP_EOR_ZP,"eor",ZP,2,emul_eor
OP_LSR_ZP,"lsr",ZP,2,NULL
OP_RMB4_ZP,"rmb4",ZP,2,NULL
OP_PHA,"pha",IMPLIED,1,emul_pha
OP_EOR_IMM,"eor",IMMEDIATE,2,NULL
OP_EOR_IMM,"eor",IMMEDIATE,2,emul_eor
OP_LSR,"lsr",ACCUMULATOR,1,NULL
OP_NOPI_4C,"nop",IMPLIED,1,NULL
OP_JMP_ABS,"jmp",ABSOLUTE,3,NULL
OP_EOR_ABS,"eor",ABSOLUTE,3,NULL
OP_EOR_ABS,"eor",ABSOLUTE,3,emul_eor
OP_LSR_ABS,"lsr",ABSOLUTE,3,NULL
OP_BBR4_REL,"bbr4",ZPR,2,NULL
OP_BVC_REL,"bvc",RELATIVE,2,NULL
OP_EOR_IZPY,"eor",IZPY,2,NULL
OP_EOR_IZP,"eor",IZP,2,NULL
OP_EOR_IZPY,"eor",IZPY,2,emul_eor
OP_EOR_IZP,"eor",IZP,2,emul_eor
OP_NOPI_54,"nop",IMPLIED,1,NULL
OP_NOPI_55,"nop",ZPX,2,NULL
OP_EOR_ZPX,"eor",ZPX,2,NULL
OP_EOR_ZPX,"eor",ZPX,2,emul_eor
OP_LSR_ZPX,"lsr",ZPX,2,NULL
OP_RMB5_ZP,"rmb5",ZP,2,NULL
OP_CLI,"cli",IMPLIED,1,NULL
OP_EOR_ABSY,"eor",ABSOLUTEY,3,NULL
OP_EOR_ABSY,"eor",ABSOLUTEY,3,emul_eor
OP_PHY,"phy",IMPLIED,1,NULL
OP_NOPI_5C,"nop",IMPLIED,1,NULL
OP_NOPI_5D,"nop",ABSOLUTE,3,NULL
OP_EOR_ABSX,"eor",ABSOLUTEX,3,NULL
OP_EOR_ABSX,"eor",ABSOLUTEX,3,emul_eor
OP_LSR_ABSX,"lsr",ABSOLUTEX,3,NULL
OP_BBR5_REL,"bbr5",ZPR,2,NULL
OP_RTS,"rts",IMPLIED,1,NULL

1 opcode_id mnemonic addressing size emulation
2 OP_BRK brk IMPLIED 1 NULL
3 OP_ORA_IZPX ora IZPX 1 NULL emul_ora
4 OP_NOPI_3 nop IMMEDIATE 2 NULL
5 OP_NOPI_4 nop IMPLIED 1 NULL
6 OP_TSB_ZP tsb ZP 2 NULL
7 OP_ORA_ZP ora ZP 2 NULL emul_ora
8 OP_ASL_ZP asl ZP 2 NULL
9 OP_RMB0_ZP rmb0 ZP 2 NULL
10 OP_PHP php IMPLIED 1 emul_php
11 OP_ORA_IMM ora IMMEDIATE 2 NULL emul_ora
12 OP_ASL asl ACCUMULATOR 1 NULL
13 OP_NOPI_C nop IMPLIED 1 NULL
14 OP_TSB_ABS tsb ABSOLUTE 3 NULL
16 OP_ASL_ABS asl ABSOLUTE 3 NULL
17 OP_BBR0_REL bbr0 ZPR 2 NULL
18 OP_BPL_REL bpl RELATIVE 2 NULL
19 OP_ORA_IZPY ora IZPY 2 NULL emul_ora
20 OP_ORA_IZP ora IZP 2 NULL emul_ora
21 OP_NOPI_14 nop IMPLIED 1 NULL
22 OP_TRB_ZP trb ZP 2 NULL
23 OP_ORA_ZPX ora ZPX 2 NULL emul_ora
24 OP_ASL_ZPX asl ZPX 2 NULL
25 OP_RMB1_ZP rmb1 ZP 1 NULL
26 OP_CLC clc IMPLIED 1 emul_clc
27 OP_ORA_ABSY ora ABSOLUTEY 3 NULL emul_ora
28 OP_INC inc ACCUMULATOR 1 NULL
29 OP_NOPI_1C nop IMPLIED 1 NULL
30 OP_TRB_ABS trb ABSOLUTE 3 NULL
31 OP_ORA_ABSX ora ABSOLUTEX 3 NULL emul_ora
32 OP_ASL_ABSX asl ABSOLUTEX 3 NULL
33 OP_BBR1_REL bbr1 ZPR 2 NULL
34 OP_JSR jsr ABSOLUTE 3 NULL
64 OP_ROL_ABSX rol ABSOLUTEX 3 NULL
65 OP_BBR3_REL bbr3 ZPR 2 NULL
66 OP_RTI rti IMPLIED 1 NULL
67 OP_EOR_IZPX eor IZPX 2 NULL emul_eor
68 OP_NOPI_43 nop IMMEDIATE 2 NULL
69 OP_NOPI_44 nop IMPLIED 1 NULL
70 OP_NOPI_45 nop ZP 2 NULL
71 OP_EOR_ZP eor ZP 2 NULL emul_eor
72 OP_LSR_ZP lsr ZP 2 NULL
73 OP_RMB4_ZP rmb4 ZP 2 NULL
74 OP_PHA pha IMPLIED 1 emul_pha
75 OP_EOR_IMM eor IMMEDIATE 2 NULL emul_eor
76 OP_LSR lsr ACCUMULATOR 1 NULL
77 OP_NOPI_4C nop IMPLIED 1 NULL
78 OP_JMP_ABS jmp ABSOLUTE 3 NULL
79 OP_EOR_ABS eor ABSOLUTE 3 NULL emul_eor
80 OP_LSR_ABS lsr ABSOLUTE 3 NULL
81 OP_BBR4_REL bbr4 ZPR 2 NULL
82 OP_BVC_REL bvc RELATIVE 2 NULL
83 OP_EOR_IZPY eor IZPY 2 NULL emul_eor
84 OP_EOR_IZP eor IZP 2 NULL emul_eor
85 OP_NOPI_54 nop IMPLIED 1 NULL
86 OP_NOPI_55 nop ZPX 2 NULL
87 OP_EOR_ZPX eor ZPX 2 NULL emul_eor
88 OP_LSR_ZPX lsr ZPX 2 NULL
89 OP_RMB5_ZP rmb5 ZP 2 NULL
90 OP_CLI cli IMPLIED 1 NULL
91 OP_EOR_ABSY eor ABSOLUTEY 3 NULL emul_eor
92 OP_PHY phy IMPLIED 1 NULL
93 OP_NOPI_5C nop IMPLIED 1 NULL
94 OP_NOPI_5D nop ABSOLUTE 3 NULL
95 OP_EOR_ABSX eor ABSOLUTEX 3 NULL emul_eor
96 OP_LSR_ABSX lsr ABSOLUTEX 3 NULL
97 OP_BBR5_REL bbr5 ZPR 2 NULL
98 OP_RTS rts IMPLIED 1 NULL

View File

@ -39,6 +39,16 @@ emul_dey(rk65c02emu_t *e, void *id, instruction_t *i)
instruction_status_adjust_negative(e, e->regs.Y);
}
/* EOR - logical exclusive OR */
void
emul_eor(rk65c02emu_t *e, void *id, instruction_t *i)
{
e->regs.A ^= instruction_data_read_1(e, (instrdef_t *) id, i);
instruction_status_adjust_zero(e, e->regs.A);
instruction_status_adjust_negative(e, e->regs.A);
}
/* INX - increment X */
void
emul_inx(rk65c02emu_t *e, void *id, instruction_t *i)
@ -95,6 +105,16 @@ emul_nop(rk65c02emu_t *e, void *id, instruction_t *i)
{
}
/* ORA - logical inclusive OR */
void
emul_ora(rk65c02emu_t *e, void *id, instruction_t *i)
{
e->regs.A |= instruction_data_read_1(e, (instrdef_t *) id, i);
instruction_status_adjust_zero(e, e->regs.A);
instruction_status_adjust_negative(e, e->regs.A);
}
/* PHA - push accumulator to stack */
void
emul_pha(rk65c02emu_t *e, void *id, instruction_t *i)