1
0
mirror of https://github.com/pevans/erc-c.git synced 2024-09-30 02:54:41 +00:00

Missing status modifications in a number of instructions

This commit is contained in:
Peter Evans 2017-12-08 23:26:46 -06:00
parent b0aa6d400a
commit 3954b1647f
3 changed files with 23 additions and 0 deletions

View File

@ -17,6 +17,8 @@ DEFINE_INST(adc)
{
CARRY_BIT();
cpu->A += oper + carry;
mos6502_modify_status(cpu, NEGATIVE | OVERFLOW | CARRY | ZERO, cpu->A);
}
/*
@ -59,6 +61,7 @@ DEFINE_INST(dec)
{
if (cpu->last_addr) {
vm_segment_set(cpu->memory, cpu->last_addr, oper - 1);
mos6502_modify_status(cpu, NEGATIVE | ZERO, oper - 1);
}
}
@ -68,6 +71,7 @@ DEFINE_INST(dec)
DEFINE_INST(dex)
{
cpu->X--;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->X);
}
/*
@ -76,6 +80,7 @@ DEFINE_INST(dex)
DEFINE_INST(dey)
{
cpu->Y--;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->Y);
}
/*
@ -87,6 +92,7 @@ DEFINE_INST(inc)
{
if (cpu->last_addr) {
vm_segment_set(cpu->memory, cpu->last_addr, oper + 1);
mos6502_modify_status(cpu, NEGATIVE | ZERO, oper + 1);
}
}
@ -96,6 +102,7 @@ DEFINE_INST(inc)
DEFINE_INST(inx)
{
cpu->X++;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->X);
}
/*
@ -104,6 +111,7 @@ DEFINE_INST(inx)
DEFINE_INST(iny)
{
cpu->Y++;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->Y);
}
/*
@ -116,4 +124,6 @@ DEFINE_INST(sbc)
{
CARRY_BIT();
cpu->A = cpu->A - oper - carry;
mos6502_modify_status(cpu, NEGATIVE | OVERFLOW | CARRY | ZERO, cpu->A);
}

View File

@ -15,6 +15,7 @@
DEFINE_INST(and)
{
cpu->A &= oper;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->A);
}
/*
@ -42,6 +43,8 @@ DEFINE_INST(asl)
} else {
cpu->A = oper;
}
mos6502_modify_status(cpu, NEGATIVE | CARRY | ZERO, oper);
}
/*
@ -75,6 +78,7 @@ DEFINE_INST(bit)
DEFINE_INST(eor)
{
cpu->A ^= oper;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->A);
}
/*
@ -98,6 +102,9 @@ DEFINE_INST(lsr)
} else {
cpu->A = oper;
}
// NEGATIVE is intentionally not included here.
mos6502_modify_status(cpu, CARRY | ZERO, oper);
}
/*
@ -107,6 +114,7 @@ DEFINE_INST(lsr)
DEFINE_INST(ora)
{
cpu->A |= oper;
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->A);
}
/*
@ -133,6 +141,8 @@ DEFINE_INST(rol)
} else {
cpu->A = oper;
}
mos6502_modify_status(cpu, NEGATIVE | CARRY | ZERO, oper);
}
/*
@ -158,4 +168,6 @@ DEFINE_INST(ror)
} else {
cpu->A = oper;
}
mos6502_modify_status(cpu, NEGATIVE | CARRY | ZERO, oper);
}

View File

@ -58,6 +58,7 @@ DEFINE_INST(php)
DEFINE_INST(pla)
{
cpu->A = mos6502_pop_stack(cpu);
mos6502_modify_status(cpu, NEGATIVE | ZERO, cpu->A);
}
/*