mirror of
https://github.com/rkujawa/rk65c02.git
synced 2024-12-11 18:49:16 +00:00
Add emulation of LDX, TXA, TYA, TXS, TAX, TAY, TSX.
This commit is contained in:
parent
3b2080403b
commit
5c38e5f05a
@ -137,7 +137,7 @@ OP_STX_ZP,"stx",ZP,2,NULL
|
||||
OP_SMB0_ZP,"smb0",ZP,2,NULL
|
||||
OP_DEY,"dey",IMPLIED,1,emul_dey
|
||||
OP_BIT_IMM,"bit",IMMEDIATE,2,NULL
|
||||
OP_TXA,"txa",IMPLIED,1,NULL
|
||||
OP_TXA,"txa",IMPLIED,1,emul_txa
|
||||
OP_NOPI_8C,"nop",IMPLIED,1,NULL
|
||||
OP_STY_ABS,"sty",ABSOLUTE,3,NULL
|
||||
OP_STA_ABS,"sta",ABSOLUTE,3,NULL
|
||||
@ -151,9 +151,9 @@ OP_STY_ZPX,"sty",ZPX,2,NULL
|
||||
OP_STA_ZPX,"sta",ZPX,2,NULL
|
||||
OP_STX_ZPY,"stx",ZPY,2,NULL
|
||||
OP_SMB1_ZP,"smb1",ZP,2,NULL
|
||||
OP_TYA,"tya",IMPLIED,1,NULL
|
||||
OP_TYA,"tya",IMPLIED,1,emul_tya
|
||||
OP_STA_ABSY,"sta",ABSOLUTEY,3,NULL
|
||||
OP_TXS,"txs",IMPLIED,1,NULL
|
||||
OP_TXS,"txs",IMPLIED,1,emul_txs
|
||||
OP_NOPI_9C,"nop",IMPLIED,1,NULL
|
||||
OP_STZ_ABS,"stz",ABSOLUTE,3,emul_stz
|
||||
OP_STA_ABSX,"sta",ABSOLUTEX,3,NULL
|
||||
@ -161,19 +161,19 @@ OP_STZ_ABSX,"stz",ABSOLUTEX,3,emul_stz
|
||||
OP_BBS1_REL,"bbs1",ZPR,2,NULL
|
||||
OP_LDY_IMM,"ldy",IMMEDIATE,2,NULL
|
||||
OP_LDA_IZPX,"lda",IZPX,2,emul_lda
|
||||
OP_LDX_IMM,"ldx",IMMEDIATE,2,NULL
|
||||
OP_LDX_IMM,"ldx",IMMEDIATE,2,emul_ldx
|
||||
OP_NOPI_A4,"nop",IMPLIED,1,NULL
|
||||
OP_LDY_ZP,"ldy",ZP,2,NULL
|
||||
OP_LDA_ZP,"lda",ZP,2,emul_lda
|
||||
OP_LDX_ZP,"ldx",ZP,2,NULL
|
||||
OP_LDX_ZP,"ldx",ZP,2,emul_ldx
|
||||
OP_SMB2_ZP,"smb2",ZP,2,NULL
|
||||
OP_TAY,"tay",IMPLIED,1,NULL
|
||||
OP_TAY,"tay",IMPLIED,1,emul_tay
|
||||
OP_LDA_IMM,"lda",IMMEDIATE,2,emul_lda
|
||||
OP_TAX,"tax",IMPLIED,1,NULL
|
||||
OP_TAX,"tax",IMPLIED,1,emul_tax
|
||||
OP_NOPI_AC,"nop",IMPLIED,1,NULL
|
||||
OP_LDY_ABS,"ldy",ABSOLUTE,3,NULL
|
||||
OP_LDA_ABS,"lda",ABSOLUTE,3,emul_lda
|
||||
OP_LDX_ABS,"ldx",ABSOLUTE,3,NULL
|
||||
OP_LDX_ABS,"ldx",ABSOLUTE,3,emul_ldx
|
||||
OP_BBS2_REL,"bbs2",ZPR,2,NULL
|
||||
OP_BCS_REL,"bcs",RELATIVE,2,NULL
|
||||
OP_LDA_IZPY,"lda",IZPY,2,emul_lda
|
||||
@ -181,15 +181,15 @@ OP_LDA_IZP,"lda",IZP,2,emul_lda
|
||||
OP_NOPI_B4,"nop",IMPLIED,1,NULL
|
||||
OP_LDY_ZPX,"ldy",ZPX,2,NULL
|
||||
OP_LDA_ZPX,"lda",ZPX,2,emul_lda
|
||||
OP_LDX_ZPY,"ldx",ZPY,1,NULL
|
||||
OP_LDX_ZPY,"ldx",ZPY,1,emul_ldx
|
||||
OP_SMB3_ZP,"smb3",ZP,2,NULL
|
||||
OP_CLV,"clv",IMPLIED,1,NULL
|
||||
OP_LDA_ABSY,"lda",ABSOLUTEY,3,emul_lda
|
||||
OP_TSX,"tsx",IMPLIED,1,NULL
|
||||
OP_TSX,"tsx",IMPLIED,1,emul_tsx
|
||||
OP_NOPI_BC,"nop",IMPLIED,1,NULL
|
||||
OP_LDY_ABSX,"ldy",ABSOLUTEX,3,NULL
|
||||
OP_LDA_ABSX,"lda",ABSOLUTEX,3,emul_lda
|
||||
OP_LDX_ABSY,"ldx",ABSOLUTEY,3,NULL
|
||||
OP_LDX_ABSY,"ldx",ABSOLUTEY,3,emul_ldx
|
||||
OP_BBS3_REL,"bbs3",ZPR,2,NULL
|
||||
OP_CPY_IMM,"cpy",IMMEDIATE,2,NULL
|
||||
OP_CMP_IZPX,"cmp",IZPX,2,NULL
|
||||
|
|
@ -72,6 +72,16 @@ emul_lda(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
instruction_status_adjust_negative(e, e->regs.A);
|
||||
}
|
||||
|
||||
/* LDX - load to X */
|
||||
void
|
||||
emul_ldx(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.X = instruction_data_read_1(e, (instrdef_t *) id, i);
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.X);
|
||||
instruction_status_adjust_negative(e, e->regs.X);
|
||||
}
|
||||
|
||||
/* NOP - do nothing */
|
||||
void
|
||||
emul_nop(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
@ -130,3 +140,60 @@ emul_stz(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
instruction_data_write_1(e, id, i, 0);
|
||||
}
|
||||
|
||||
/* TAX - transfer accumulator to X */
|
||||
void
|
||||
emul_tax(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.X = e->regs.A;
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.X);
|
||||
instruction_status_adjust_negative(e, e->regs.X);
|
||||
}
|
||||
|
||||
/* TAY - transfer accumulator to Y */
|
||||
void
|
||||
emul_tay(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.Y = e->regs.A;
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.Y);
|
||||
instruction_status_adjust_negative(e, e->regs.Y);
|
||||
}
|
||||
|
||||
/* TSX - transfer stack pointer to X */
|
||||
void
|
||||
emul_tsx(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.X = e->regs.SP;
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.X);
|
||||
instruction_status_adjust_negative(e, e->regs.X);
|
||||
}
|
||||
|
||||
/* TXA - transfer X to accumulator */
|
||||
void
|
||||
emul_txa(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.A = e->regs.X;
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.A);
|
||||
instruction_status_adjust_negative(e, e->regs.A);
|
||||
}
|
||||
|
||||
/* TXS - transfer X to stack pointer */
|
||||
void
|
||||
emul_txs(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.SP = e->regs.X;
|
||||
}
|
||||
|
||||
/* TYA - transfer Y to accumulator */
|
||||
void
|
||||
emul_tya(rk65c02emu_t *e, void *id, instruction_t *i)
|
||||
{
|
||||
e->regs.A = e->regs.Y;
|
||||
|
||||
instruction_status_adjust_zero(e, e->regs.A);
|
||||
instruction_status_adjust_negative(e, e->regs.A);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user