Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Commit c616886

Browse files
author
Bill Lord
committed
input: fix a couple bugs with halt-until-next-input
1 parent 42c2cbe commit c616886

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/main.cpp

+7-4
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,22 @@ int main(int argc, char* argv[]) {
4646
for (int i = 0; i < NUMBER_OF_KEYS; i++) {
4747
if (event.key.code == KEYMAP[i]) {
4848
cpu.keyInput(i);
49+
break;
4950
}
5051
}
5152
}
5253
}
5354
}
5455

55-
if (cpu.state.running) {
56-
if (delayTimer.getElapsedTime().asSeconds() > TIMER_FREQUENCY) {
56+
if (delayTimer.getElapsedTime().asSeconds() > TIMER_FREQUENCY) {
57+
if (cpu.state.running) {
5758
cpu.tickTimers();
58-
display.draw(cpu.state.vram);
59-
delayTimer.restart();
6059
}
60+
display.draw(cpu.state.vram);
61+
delayTimer.restart();
62+
}
6163

64+
if (cpu.state.running) {
6265
if (cpuTimer.getElapsedTime().asSeconds() > CPU_FREQUENCY) {
6366
try {
6467
for (int i = 0; i < NUMBER_OF_KEYS; i++) {

0 commit comments

Comments
 (0)