Minor changes
This commit is contained in:
parent
64917e3504
commit
3738e41d2d
2 changed files with 7 additions and 9 deletions
|
@ -3,7 +3,7 @@
|
||||||
#include "vcpu.h"
|
#include "vcpu.h"
|
||||||
#include <stdio.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"
|
//#define ROM "../roms/games/pong_1player.ch8"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
|
|
14
src/vcpu.c
14
src/vcpu.c
|
@ -212,17 +212,15 @@ void VCPUExecute(){
|
||||||
if(State.V[State.X]&0x0F == State.keypress&0xF){
|
if(State.V[State.X]&0x0F == State.keypress&0xF){
|
||||||
State.PC+=2;
|
State.PC+=2;
|
||||||
}
|
}
|
||||||
State.keypress=-1;
|
|
||||||
}
|
}
|
||||||
|
State.keypress=-1;
|
||||||
}else if(State.NN==0xA1){ // Skip if not keypress in VX
|
}else if(State.NN==0xA1){ // Skip if not keypress in VX
|
||||||
|
State.PC+=2; // First skip
|
||||||
if(State.keypress >=0){
|
if(State.keypress >=0){
|
||||||
if(State.V[State.X]&0x0F != State.keypress&0xF){
|
if(State.V[State.X]&0x0F == State.keypress&0x0F)
|
||||||
State.PC+=2;
|
State.PC+=2; // Ignore skip if pressed
|
||||||
}
|
|
||||||
State.keypress=-1;
|
|
||||||
}
|
}
|
||||||
else
|
State.keypress=-1;
|
||||||
State.PC+=2;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -237,8 +235,8 @@ void VCPUExecute(){
|
||||||
State.V[State.X]=State.keypress&0xF;
|
State.V[State.X]=State.keypress&0xF;
|
||||||
if(State.V[State.X]&0x0F != State.keypress&0xF){
|
if(State.V[State.X]&0x0F != State.keypress&0xF){
|
||||||
State.PC+=2;
|
State.PC+=2;
|
||||||
State.keypress=-1;
|
|
||||||
}
|
}
|
||||||
|
State.keypress=-1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
State.PC-=2; // Go back to last instruction (loop until key is pressed)
|
State.PC-=2; // Go back to last instruction (loop until key is pressed)
|
||||||
|
|
Loading…
Add table
Reference in a new issue