Minor changes
This commit is contained in:
parent
c50ed6ba73
commit
4ad64d82c3
3 changed files with 19 additions and 1 deletions
11
src/keypad.c
11
src/keypad.c
|
@ -26,3 +26,14 @@ int KeypadIsPressed(unsigned char c){
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int KeypadGetPressed(){
|
||||||
|
int keycode=GetKeyPressed();
|
||||||
|
if(keycode){
|
||||||
|
for(int i=0;i<16;i++){
|
||||||
|
if(map[i]==keycode)
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
|
@ -3,4 +3,5 @@
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
int KeypadIsPressed(unsigned char c);
|
int KeypadIsPressed(unsigned char c);
|
||||||
|
int KeypadGetPressed();
|
||||||
|
|
||||||
|
|
|
@ -220,7 +220,13 @@ void VCPUExecute(){
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0A:
|
case 0x0A:
|
||||||
// TODO
|
int key=KeypadGetPressed();
|
||||||
|
if(key >= 0){
|
||||||
|
State.V[State.X]=key&0x0F;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
State.PC-=2; // Go back to last instruction (loop until key is pressed)
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x15: // Set timer
|
case 0x15: // Set timer
|
||||||
|
|
Loading…
Add table
Reference in a new issue