mirror of
https://github.com/ethauvin/chip-8.git
synced 2025-04-25 16:57:12 -07:00
Merge branch 'master' of github.com:cbeust/chip-8
This commit is contained in:
commit
71507afe80
2 changed files with 12 additions and 7 deletions
12
README.md
12
README.md
|
@ -1,8 +1,8 @@
|
||||||
# chip8
|
# Chipsk-8
|
||||||
## A [Chip-8](http://www.cs.columbia.edu/~sedwards/classes/2016/4840-spring/designs/Chip8.pdf) emulator written in Kotlin
|
## A [Chip-8](http://www.cs.columbia.edu/~sedwards/classes/2016/4840-spring/designs/Chip8.pdf) emulator written in Kotlin
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="https://github.com/cbeust/chip8/blob/master/pics/space-invaders-2.gif?raw=true"/>
|
<img src="https://github.com/cbeust/chip-8/blob/master/pics/space-invaders-2.gif?raw=true"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
# How to run
|
# How to run
|
||||||
|
@ -35,7 +35,7 @@ timerFuture = executor.scheduleAtFixedRate(timerTick, 0, 16L, TimeUnit.MILLISECO
|
||||||
```
|
```
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="50%" src="https://github.com/cbeust/chip8/blob/master/pics/tetris-1.png?raw=true"/>
|
<img width="50%" src="https://github.com/cbeust/chip-8/blob/master/pics/tetris-1.png?raw=true"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
The next two bytes are then masked and turned into instructions. All the op codes can be found in the `[Ops.kt](https://github.com/cbeust/chip8/blob/master/src/main/kotlin/com/beust/chip8/Ops.kt)` file. Here is an example:
|
The next two bytes are then masked and turned into instructions. All the op codes can be found in the `[Ops.kt](https://github.com/cbeust/chip8/blob/master/src/main/kotlin/com/beust/chip8/Ops.kt)` file. Here is an example:
|
||||||
|
@ -66,18 +66,18 @@ interface Display {
|
||||||
For example, here is a text based renderer:
|
For example, here is a text based renderer:
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="50%" src="https://github.com/cbeust/chip8/blob/master/pics/space-invaders-text.png?raw=true"/>
|
<img width="50%" src="https://github.com/cbeust/chip-8/blob/master/pics/space-invaders-text.png?raw=true"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
The emulator window will resize gracefully:
|
The emulator window will resize gracefully:
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="20%" src="https://github.com/cbeust/chip8/blob/master/pics/space-invaders-small.png?raw=true"/>
|
<img width="20%" src="https://github.com/cbeust/chip-8/blob/master/pics/space-invaders-small.png?raw=true"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
You can also easily alter other aspects of the renderer:
|
You can also easily alter other aspects of the renderer:
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img width="50%" src="https://github.com/cbeust/chip8/blob/master/pics/space-invaders-colors.png?raw=true"/>
|
<img width="50%" src="https://github.com/cbeust/chip-8/blob/master/pics/space-invaders-colors.png?raw=true"/>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ package com.beust.chip8
|
||||||
import com.beust.jcommander.JCommander
|
import com.beust.jcommander.JCommander
|
||||||
import com.beust.jcommander.Parameter
|
import com.beust.jcommander.Parameter
|
||||||
import javafx.application.Application
|
import javafx.application.Application
|
||||||
|
import javafx.application.Platform
|
||||||
import javafx.beans.property.SimpleBooleanProperty
|
import javafx.beans.property.SimpleBooleanProperty
|
||||||
import javafx.beans.property.SimpleStringProperty
|
import javafx.beans.property.SimpleStringProperty
|
||||||
import javafx.event.EventHandler
|
import javafx.event.EventHandler
|
||||||
|
@ -97,6 +98,10 @@ class MyFxApp : Application() {
|
||||||
}
|
}
|
||||||
|
|
||||||
primaryStage.title = "CHIP-8"
|
primaryStage.title = "CHIP-8"
|
||||||
|
primaryStage.onCloseRequest = EventHandler {
|
||||||
|
Platform.exit()
|
||||||
|
exitProcess(0)
|
||||||
|
}
|
||||||
val url = this::class.java.classLoader.getResource("main.fxml")
|
val url = this::class.java.classLoader.getResource("main.fxml")
|
||||||
val loader = FXMLLoader(url)
|
val loader = FXMLLoader(url)
|
||||||
val res = url.openStream()
|
val res = url.openStream()
|
||||||
|
@ -190,7 +195,7 @@ class MyFxApp : Application() {
|
||||||
try {
|
try {
|
||||||
val key = Integer.parseInt(event.code.char, 16)
|
val key = Integer.parseInt(event.code.char, 16)
|
||||||
keyListener.onKey(key)
|
keyListener.onKey(key)
|
||||||
} catch(ex: NumberFormatException) {
|
} catch (ex: NumberFormatException) {
|
||||||
println("Can't parse key " + event.code.char + ", ignoring")
|
println("Can't parse key " + event.code.char + ", ignoring")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue