Commit 1cc66501 authored by KurtJD's avatar KurtJD
Browse files

Add new opcode test ROM and implement VF reset quirk

parent 84862432
......@@ -121,6 +121,7 @@ Also includes flags for disabling specific S-CHIP "quirks" (which are all enable
`-6` Allow sprite wrapping
`-7` Disable collision enumeration
`-8` Disable collision check with bottom of screen
`-9` Enable VF reset on logical OR, AND, XOR
## Controls
......
......@@ -29,7 +29,7 @@
#define NUM_KEYS 16
#define NUM_REGISTERS 16
#define NUM_USER_FLAGS 16
#define NUM_QUIRKS 9
#define NUM_QUIRKS 10
#define NUM_BITPLANES 3
#define NUM_FONT_BYTES 80
#define NUM_BIG_FONT_BYTES 160
......
......@@ -452,21 +452,42 @@ void chip8_execute(CHIP8 *chip8)
break;
/* OR Vx, Vy (8xy1)
Set Vx = Vx OR Vy. */
Set Vx = Vx OR Vy.
Legacy: Set VF = 0.
S-CHIP: Leave VF alone. */
case 0x01:
chip8->V[x] |= chip8->V[y];
if (!chip8->quirks[9])
{
chip8->V[0x0F] = 0;
}
break;
/* AND Vx, Vy (8xy2)
Set Vx = Vx AND Vy. */
Set Vx = Vx AND Vy.
Legacy: Set VF = 0.
S-CHIP: Leave VF alone. */
case 0x02:
chip8->V[x] &= chip8->V[y];
if (!chip8->quirks[9])
{
chip8->V[0x0F] = 0;
}
break;
/* XOR Vx, Vy (8xy3)
Set Vx = Vx XOR Vy. */
Set Vx = Vx XOR Vy.
Legacy: Set VF = 0.
S-CHIP: Leave VF alone. */
case 0x03:
chip8->V[x] ^= chip8->V[y];
if (!chip8->quirks[9])
{
chip8->V[0x0F] = 0;
}
break;
/* ADD Vx, Vy (8xy4)
......
......@@ -38,7 +38,7 @@ unsigned long cpu_freq = CPU_FREQ_DEFAULT;
unsigned long timer_freq = TIMER_FREQ_DEFAULT;
unsigned long refresh_freq = REFRESH_FREQ_DEFAULT;
bool play_sound = false;
bool quirks[NUM_QUIRKS] = {1, 1, 1, 1, 1, 1, 1, 1, 1};
bool quirks[NUM_QUIRKS] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1};
bool load_dmp = false;
// Color/Display
......@@ -285,6 +285,7 @@ bool handle_args(int argc, char **argv)
case '6':
case '7':
case '8':
case '9':
quirks[opt - '0'] = false;
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment