Skip to content

Commit 362a56a

Browse files
committed
bandaid overflow quirk for now
1 parent 99bb08e commit 362a56a

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

shared/opcodes.cc

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ inline void execDXYN() {
177177

178178
for (unsigned char yline = 0; yline < height; yline++) {
179179
pixel = chip8.memory[chip8.I + yline];
180+
180181
for(unsigned char xline = 0; xline < 8; xline++) {
181182
if((pixel & (0x80 >> xline)) != 0) {
182183

@@ -185,6 +186,7 @@ inline void execDXYN() {
185186
wrapping to the top of the screen if you (y % HEIGHT) */
186187
unsigned char true_x = (x + xline) % WIDTH;
187188
unsigned char true_y = (y + yline);
189+
188190
if(chip8.vwrap) true_y = true_y % HEIGHT;
189191

190192
/* OOB check is needed when vwrap is turned off
@@ -255,8 +257,12 @@ inline void execFX1E() {
255257
and 0 when there isn't. */
256258
unsigned short sum;
257259
sum = chip8.I + chip8.V[OP_X];
258-
if (sum > 0xFFF) chip8.V[0xF] = 1;
259-
else chip8.V[0xF] = 0;
260+
261+
// TODO: Add quirk toggle for this behavior
262+
// Commented out to fix compatibility issues with: AnimalRace
263+
//if (sum > 0xFFF) chip8.V[0xF] = 1;
264+
//else chip8.V[0xF] = 0;
265+
260266
chip8.I += chip8.V[OP_X];
261267
chip8.PC += 2;
262268
}

0 commit comments

Comments
 (0)