Skip to content

Commit

Permalink
famiyirl: ora ora ora ora
Browse files Browse the repository at this point in the history
Signed-off-by: Matthias Gatto <[email protected]>
  • Loading branch information
cosmo-ray committed Apr 29, 2024
1 parent 8b38f47 commit e7ad2a2
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
46 changes: 36 additions & 10 deletions modules/famiyirl/init.c
Original file line number Diff line number Diff line change
Expand Up @@ -473,20 +473,46 @@ static int process_inst(void)
cpu.cycle_cnt += 2;
}
break;
case ORA_ab:
case ORA_zp:
case ORA_im:
{
char res;
if (opcode == ORA_ab) {
int addr = get_mem(++cpu.pc);

addr |= get_mem(++cpu.pc) << 8;
res = get_mem(addr);
cpu.cycle_cnt += 2;
} else if (opcode == ORA_zp) {
int addr = get_mem(++cpu.pc);

res = get_mem(addr);
cpu.cycle_cnt += 1;
} else {
res = get_mem(++cpu.pc);

}
char old_sign = cpu.a | 0x80;
SET_ZERO(!cpu.a);
SET_NEGATIVE(!!(0x80 & cpu.a));
cpu.cycle_cnt += 2;
}
break;
case SBC_ab:
case SBC_im:
{
char res;
if (opcode == SBC_ab) {
int addr = get_mem(++cpu.pc);

addr |= get_mem(++cpu.pc) << 8;
res = get_mem(addr);
cpu.cycle_cnt += 2;
} else {
res = get_mem(++cpu.pc);
char res;
if (opcode == SBC_ab) {
int addr = get_mem(++cpu.pc);

addr |= get_mem(++cpu.pc) << 8;
res = get_mem(addr);
cpu.cycle_cnt += 2;
} else {
res = get_mem(++cpu.pc);

}
}
char old_sign = cpu.a & 0x80;
int check_carry = cpu.a - res - 1 + (cpu.flag & CARY_FLAG);

Expand Down
4 changes: 3 additions & 1 deletion modules/famiyirl/opcode.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
OPCODE(BIT_ab, 0x2c) //break / interrupt
OPCODE(ORA, 0x01) //or with accumulator
OPCODE(ORA_zp, 0x05) //or with accumulator
OPCODE(ORA_im, 0x09) //or with accumulator
OPCODE(ORA_ab, 0x0D) //or with accumulator
OPCODE(ASL_a, 0x0a) //arithmetic shift left
OPCODE(PHP, 0x08) //push processor status (SR)
OPCODE(BPL, 0x10) //branch on plus (negative clear)
Expand Down

0 comments on commit e7ad2a2

Please sign in to comment.