buttery8/README.md
2026-04-07 10:48:11 -04:00

98 lines
2.8 KiB
Markdown

# 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)