added my checklist

This commit is contained in:
Butter 2026-04-07 10:48:11 -04:00
parent 8a989e9980
commit b6b07c036f
4 changed files with 106 additions and 5 deletions

2
Cargo.lock generated
View File

@ -33,7 +33,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb"
[[package]]
name = "buttery_chip8"
name = "buttery8"
version = "0.1.0"
dependencies = [
"minifb",

View File

@ -1,8 +1,8 @@
[package]
name = "buttery_chip8"
name = "buttery8"
version = "0.1.0"
edition = "2024"
[dependencies]
minifb = "0.27"
rand = "0.10"
rand = "0.10"

98
README.md Normal file
View File

@ -0,0 +1,98 @@
# The buttery chip-8
Just a personal project for me to get the hang of emulator development.
Load a .ch8 rom with `buttery8 filename.ch8`.
# TODO
## Project Setup
- [x] Initialize Rust project
- [x] Set up `Cargo.toml` with dependencies
- [x] Set up window/display library (I went with [minifb](https://docs.rs/minifb/latest/minifb/))
- [ ] Set up audio library
- [x] CLI ROM loading via command line argument
## CPU / Core
- [x] Define CPU struct (registers, memory, stack, timers, PC, I)
- [x] Load ROM into memory at 0x200
- [x] Load fontset into memory at 0x050
- [x] Fetch / decode / execute loop
- [ ] Proper cycle timing
## Opcodes
- [x] `00E0` - CLS (clear display)
- [x] `00EE` - RET (return from subroutine)
- [x] `1nnn` - JP addr
- [x] `2nnn` - CALL addr
- [x] `3xkk` - SE Vx, byte
- [x] `4xkk` - SNE Vx, byte
- [x] `5xy0` - SE Vx, Vy
- [x] `6xkk` - LD Vx, byte
- [x] `7xkk` - ADD Vx, byte
- [x] `8xy0` - LD Vx, Vy
- [x] `8xy1` - OR Vx, Vy
- [x] `8xy2` - AND Vx, Vy
- [x] `8xy3` - XOR Vx, Vy
- [x] `8xy4` - ADD Vx, Vy (with carry)
- [x] `8xy5` - SUB Vx, Vy (with borrow)
- [x] `8xy6` - SHR Vx
- [x] `8xy7` - SUBN Vx, Vy (with borrow)
- [x] `8xyE` - SHL Vx
- [x] `9xy0` - SNE Vx, Vy
- [x] `Annn` - LD I, addr
- [x] `Bnnn` - JP V0, addr
- [x] `Cxkk` - RND Vx, byte
- [x] `Dxyn` - DRW Vx, Vy, nibble (draw sprite)
- [x] `Ex9E` - SKP Vx (skip if key pressed)
- [x] `ExA1` - SKNP Vx (skip if key not pressed)
- [x] `Fx07` - LD Vx, DT (read delay timer)
- [ ] `Fx0A` - LD Vx, K (wait for key press)
- [x] `Fx15` - LD DT, Vx (set delay timer)
- [x] `Fx18` - LD ST, Vx (set sound timer)
- [x] `Fx1E` - ADD I, Vx
- [x] `Fx29` - LD F, Vx (set I to font sprite)
- [x] `Fx33` - LD B, Vx (BCD conversion)
- [x] `Fx55` - LD [I], Vx (store registers to memory)
- [x] `Fx65` - LD Vx, [I] (read registers from memory)
## Display
- [x] 64x32 pixel framebuffer
- [x] XOR sprite drawing
- [x] Set VF on sprite collision
- [x] Render framebuffer to window
- [ ] Correct draw timing / refresh rate
## Input
- [x] Map keyboard to CHIP-8 hex keypad (0x0-0xF)
- [ ] Key pressed state
- [ ] Key released state
- [ ] Blocking wait for keypress (`Fx0A`)
## Timers
- [ ] Delay timer counts down at 60hz
- [ ] Sound timer counts down at 60hz
- [ ] Buzzer sounds while sound timer > 0
## Audio
- [ ] Generate beep / tone while sound timer active
## Testing & Compatibility
- [x] Pass `1-chip8-logo.ch8`
- [x] Pass `2-ibm-logo.ch8`
- [x] Pass `3-corax+.ch8`
- [x] Pass `4-flags.ch8`
- [ ] Pass `5-quirks.ch8`
- [ ] Pass `6-keypad.ch8`
- [ ] Pass `7-beep.ch8`
- [ ] Pass `8-scrolling.ch8`
- [ ] Test with real ROMs / games
## Polish
- [ ] Configurable CPU speed / cycles per frame
- [ ] Configurable color palette
- [ ] Window scaling / resize support
- [ ] Pause / resume
- [ ] Reset / reload ROM
- [ ] SUPER-CHIP / CHIP-48 quirks mode (optional)
- [ ] XO-CHIP support (optional)

View File

@ -139,7 +139,9 @@ impl Cpu {
self.reg[x] = result;
self.reg[0xF] = not_borrow;
}
0xE => {
0xE => { //8xyE - SHL Vx {, Vy}
//Set Vx = Vx SHL 1.
//If the most-significant bit of Vx is 1, then VF is set to 1, otherwise to 0. Then Vx is multiplied by 2.
self.reg[x] = self.reg[y];
let msb = (self.reg[x] >> 7) & 1;
self.reg[x] <<= 1;
@ -205,7 +207,8 @@ impl Cpu {
0x29 => {
self.index = ((self.reg[x] * 5) + 0x050) as u16;
}
0x33 => {
0x33 => { // BCD conversion isn't something I've encountered before
// Very interesting op
let vx = self.reg[x];
let hundreds = vx / 100;
let tens = (vx / 10) % 10;