Skip to content

Commit

Permalink
famiyirl: add ROL_ab
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed May 1, 2024
1 parent d324c8d commit 8f5e0cb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
15 changes: 15 additions & 0 deletions modules/famiyirl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,21 @@ static int process_inst(void)
cpu.cycle_cnt += 2;
}
break;
case ROL_ab:
{
int addr = get_mem(++cpu.pc);

addr |= get_mem(++cpu.pc) << 8;
int val = get_mem(addr);
char new_c = val & 0x1;
val = (val << 1) | cpu.flag & 0x1;
set_mem(addr, val);
SET_CARY(new_c);
SET_NEGATIVE(!!(0x80 & val));
SET_ZERO(!val);
cpu.cycle_cnt += 6;
}
break;
case EOR_IM:
{
unsigned char addr = get_mem(++cpu.pc);
Expand Down
1 change: 1 addition & 0 deletions modules/famiyirl/opcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
OPCODE(JSR, 0x20)
OPCODE(AND_xindir_zp, 0x21) //and (with accumulator)
OPCODE(ROL_a, 0x2a) //rotate left
OPCODE(ROL_ab, 0x2e) //rotate left
OPCODE(PLP, 0x28) //pull processor status (SR)
OPCODE(AND_im, 0x29) //and (with accumulator)
OPCODE(BMI, 0x30) //branch on minus (negative set)
Expand Down

0 comments on commit 8f5e0cb

Please sign in to comment.