1
0
Fork 0
mirror of https://github.com/ethauvin/chip-8.git synced 2025-04-28 01:58:13 -07:00

Added mnemonic and pause/pause to resume.

This commit is contained in:
Erik C. Thauvin 2020-08-24 00:10:18 -07:00
parent 8cd6a16568
commit dc9bc73529
2 changed files with 8 additions and 4 deletions

View file

@ -45,7 +45,7 @@ class MyFxApp : Application() {
// Computer is paused // Computer is paused
// Update the pause button label // Update the pause button label
pauseButton?.text = if (newVal) "Resume" else "Pause" pauseButton?.text = if (newVal) "_Resume" else "_Pause"
// Display the disassembly // Display the disassembly
updateDisassembly(disassembly!!, computer.disassemble()) updateDisassembly(disassembly!!, computer.disassemble())
@ -187,10 +187,14 @@ class MyFxApp : Application() {
exitProcess(0) exitProcess(0)
} }
KeyCode.P -> { KeyCode.P -> {
computer.pause() if (computer.paused) {
computer.start()
} else {
computer.pause()
}
} }
else -> { else -> {
if (computer.paused) computer.start() if (computer.paused && event.code != KeyCode.ALT) computer.start()
else { else {
try { try {
val key = Integer.parseInt(event.code.char, 16) val key = Integer.parseInt(event.code.char, 16)

View file

@ -26,7 +26,7 @@
</padding> </padding>
<Button text="Open rom..." alignment="CENTER" id="loadRom"> <Button text="Open rom..." alignment="CENTER" id="loadRom">
</Button> </Button>
<Button text="Pause" id="pause"> <Button text="_Pause" id="pause">
</Button> </Button>
<HBox maxWidth="Infinity" spacing="10"> <HBox maxWidth="Infinity" spacing="10">
<Label text="Clock speed"/> <Label text="Clock speed"/>