summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoic Guegan <loic.guegan@mailbox.org>2023-12-26 09:21:34 +0100
committerLoic Guegan <loic.guegan@mailbox.org>2023-12-26 09:21:34 +0100
commit3738e41d2db8c058c684ab602309c98464d8e6f6 (patch)
treeaf37740c7c3670ca9b40d94540a9f3cfa018e90c
parent64917e3504c32f09a503675f3e43a362508725de (diff)
Minor changes
-rw-r--r--src/main.c2
-rw-r--r--src/vcpu.c14
2 files changed, 7 insertions, 9 deletions
diff --git a/src/main.c b/src/main.c
index ea8d606..88d12bf 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3,7 +3,7 @@
#include "vcpu.h"
#include <stdio.h>
-#define ROM "../roms/chip8-test-suite/6-keypad.ch8"
+#define ROM "../roms/chip8-test-suite/5-quirks.ch8"
//#define ROM "../roms/games/pong_1player.ch8"
int main(int argc, char *argv[])
diff --git a/src/vcpu.c b/src/vcpu.c
index 1f36b68..11181f0 100644
--- a/src/vcpu.c
+++ b/src/vcpu.c
@@ -212,17 +212,15 @@ void VCPUExecute(){
if(State.V[State.X]&0x0F == State.keypress&0xF){
State.PC+=2;
}
- State.keypress=-1;
}
+ State.keypress=-1;
}else if(State.NN==0xA1){ // Skip if not keypress in VX
+ State.PC+=2; // First skip
if(State.keypress >=0){
- if(State.V[State.X]&0x0F != State.keypress&0xF){
- State.PC+=2;
- }
- State.keypress=-1;
+ if(State.V[State.X]&0x0F == State.keypress&0x0F)
+ State.PC+=2; // Ignore skip if pressed
}
- else
- State.PC+=2;
+ State.keypress=-1;
}
break;
@@ -237,8 +235,8 @@ void VCPUExecute(){
State.V[State.X]=State.keypress&0xF;
if(State.V[State.X]&0x0F != State.keypress&0xF){
State.PC+=2;
- State.keypress=-1;
}
+ State.keypress=-1;
}
else
State.PC-=2; // Go back to last instruction (loop until key is pressed)