fix(cpu): correct borrow flag comparison in subtraction opcodes

This commit is contained in:
Stevan Freeborn
2026-07-18 15:15:46 -05:00
parent b55dd087ee
commit 30abd7a2bf
+2 -2
View File
@@ -354,14 +354,14 @@ int main(int argc, char *argv[]) {
chip->V[15] = (r > 255) ? 1 : 0;
chip->V[x] = r & 255;
} else if (n == 5) {
chip->V[15] = (chip->V[x] > chip->V[y]) ? 1 : 0;
chip->V[15] = (chip->V[x] >= chip->V[y]) ? 1 : 0;
chip->V[x] = chip->V[x] - chip->V[y];
} else if (n == 6) {
uint8_t flag = chip->V[x] & 1;
chip->V[15] = flag;
chip->V[x] /= 2;
} else if (n == 7) {
chip->V[15] = (chip->V[y] > chip->V[x]) ? 1 : 0;
chip->V[15] = (chip->V[y] >= chip->V[x]) ? 1 : 0;
chip->V[x] = chip->V[y] - chip->V[x];
} else if (n == 14) {
uint8_t flag = (chip->V[x] & 128) >> 7;