key press instructions

This commit is contained in:
Jairinho 2022-02-28 13:00:58 -03:00
parent 232661bbbe
commit 43c17693a9
No known key found for this signature in database
GPG Key ID: 954589B18A21D5B6
2 changed files with 18 additions and 0 deletions

View File

@ -129,7 +129,9 @@ func (emulator *Emulator) Cycle() {
case 0xE:
switch instruction & 0x00FF {
case 0x9E: // SKP Vx
emulator.SkipKeyPressed(x)
case 0xA1: // SKNP Vx
emulator.SkipKeyNotPressed(x)
}
case 0xF:
switch instruction & 0x00FF {

View File

@ -227,3 +227,19 @@ func (emulator *Emulator) Draw(x uint8, y uint8, n uint8) {
}
}
}
// Skip next instruction if key with the value of Vx is pressed.
//
// Checks the keyboard, and if the key corresponding to the value of Vx
// is currently in the down position, PC is increased by 2.
func (emulator *Emulator) SkipKeyPressed(x uint8) {
// TODO: implement input
}
// Skip next instruction if key with the value of Vx is not pressed.
//
// Checks the keyboard, and if the key corresponding to the value of Vx
// is currently in the up position, PC is increased by 2.
func (emulator *Emulator) SkipKeyNotPressed(x uint8) {
// TODO: implement input
}