# To Do

## Documentation
- [x] Update README.md for accuracy

## Code Quality & Performance
- [ ] Replace O(n) modulo algorithm in `src/math.6502.asm` with bitwise operations or lookup tables
- [ ] Fix excessive loop unrolling in collision detection (`src/player_bullet.6502.asm`)
- [ ] Replace magic number sprite tile IDs with named constants (player sprite #83, enemy sprite #84, bullet sprite #85)
- [ ] Replace magic number `eor #$fe` in `src/enemy.6502.asm:109` with named constant or explanatory comment
- [ ] Define `PLAYER_MAX_X` and `PLAYER_MIN_X` constants instead of inline calculations like `#256-8`
- [ ] Add inline comments to assembly files explaining non-obvious 6502 patterns
- [x] Fix label typo in `src/player.6502.asm:69` (`.check_up` missing colon)
- [ ] Add module header comments explaining purpose of each .6502.asm file
- [ ] Document the macro-based variable allocation system

## Bugs
- [ ] Player lives counter stays in the corner after game is over
- [ ] Star background is not restored after text is cleared

## Init cleanup
- As part of game state transitions the code re-inits sprite data etc.
- [ ] Separate sprite initialization and object initialization
- [ ] Call sprite init during game startup
- [ ] Call object init during game state transition

## Game state machine
- [x] Game title state
- [ ] Game start state
- [x] Game play state
- [x] Game over state
- [x] Game high score state
- [ ] Select player count state
- [ ] Game title display "STARCLEAR\nPRESS START TO PLAY" text
- [ ] Game over display "GAME OVER" text

## Graphics
- [x] Player ship
- [x] Enemy ships
- [ ] Title screen
- [x] Player bullet
- [x] Enemy bullet
- [ ] Explosion animation

## Highscore system
- [ ] Player score is displayed on screen
- [ ] Highest score is displayed on title screen

## Advanced enemy movement
- [x] Enemies move down on the screen when they hit the side
- [ ] Think of some more interesting enemy movement behavior
- [ ] Enemies can collide with the player (kills the player)

## Game difficulty system
- [ ] Increase enemy speed with each wave
- [ ] Reduce bullet spawn time with each wave
- [ ] Increase enemy bullet speed with each wave

## Multiplayer
- [ ] Game can be started with 1 or 2 players
- [ ] 2 players are drawn on the screen

## Memory management
- [ ] Separate `newvar` macro into zero-page and RAM

## Expand test coverage
- [ ] Collision detection
- [ ] Sprite management and OAM buffer operations
- [ ] Game state machine transitions (title → playing → game over → high score)
- [ ] Player movement logic and boundary checking
- [ ] Enemy movement patterns and formation behavior
- [ ] Player bullet spawn and lifecycle
- [ ] Enemy bullet spawn and lifecycle
- [ ] Wave system state transitions
- [ ] Player lives and respawn logic

## Python Test Quality Improvements
- [ ] Refactor tests to use pytest fixtures for CPU setup
- [ ] Add pytest parametrization for exhaustive value testing
- [ ] Use proper pytest assertions with descriptive failure messages
- [ ] Add error handling to `test/aslmap.py` symbol parser
- [ ] Optimize file I/O - load ROM/map files once, not per iteration
- [ ] Add docstrings to test functions explaining what's being validated
- [ ] Create conftest.py for shared test utilities
- [ ] Add test coverage reporting

## Code Quality Tooling
- [ ] Add .editorconfig for consistent formatting across assembly/Python files
- [ ] Create Python requirements-dev.txt for development dependencies (pytest, black, flake8)
- [ ] Add Makefile target for running Python linters locally

## Tile quantization script
- Script to convert a 256x240 GIF (e.g. tile screen graphic) into tile graphics and an array of tile indexes
- [ ] Convert 256x240 GIF into 8x8 tiles
- [ ] Remove duplicate tiles
- [ ] Output CHR ROM data
- [ ] Output tile indexes

## Enemy wave system
- [x] Enemies respawn after all are inactive
- [x] Change palette on enemies to indicate new wave
- [x] Enemy wave number is displayed between waves
- [ ] Wait for all enemy bullets to go inactive before spawning player

# Complete

## Performance testing
- [x] Measure NMI handler CPU cycle count

## Player lives system
- [x] Player has lives
- [x] Player lives are displayed on screen
- [x] Game is over when player is inactive and no lives left

## Cleanup
- [x] Separate enemy bullet code from enemy code in `enemy.s`
- [x] Separate player bullet code from player code in `player.s`
- [x] Move magic numbers into a `constants.s` file

## GIF to NES CHR converter script
- [x] Convert GIF to CHR format
- [x] Include as part of build.sh
- [x] Output palette data based on GIF colors

## Profiling
- [x] Script to calculate remaining zero-page memory
- [x] Script to calculate remaining cartridge ROM

## Enemy bullet logic
- [x] Enemies occasionally shoot bullets
- [x] Enemy bullets move down the screen
- [x] Enemy bullets can collide with player

## Basic player logic
- [x] Controller input handling
- [x] One player drawn on screen
- [x] Player movement is limited to bottom half of screen
- [x] Player position does not wrap around the screen

## Player bullet logic
- [x] Player shoots up to 4 bullets
- [x] Player bullets move up
- [x] Player bullets kill enemies

## Basic enemy logic
- [x] Enemies display on the screen
- [x] Enemies move in grid formation
- [x] A grid of enemies spawn when game starts

## Build system

## Python unit testing framework

## NES ROM header for emulators

## PPU initialization

## Random number generator

## Background initialization
