Quick Commands
Run these from thecore/ directory:
cargo boot→cargo run --release --example debug -- bootcargo screen→cargo run --release --example debug -- screencargo trace→cargo run --release --example debug -- trace
Debug Commands
boot
Run boot test with progress reporting. Shows boot progress, detects polling loops, and analyzes final state.- Initial CPU state
- Progress updates every 10M cycles
- Detection of TI-OS idle loop at PC 085B7D-085B80
- Final state: registers, LCD status, screen analysis
- Execution history
trace
Generate trace log for parity comparison with CEmu. Default: 100,000 steps.../traces/ours_<timestamp>.log
screen
Render screen to image file after boot. Default output:screen.png
sips (macOS).
vram
Analyze VRAM content after boot. Shows color histogram and pixel statistics.- LCD state (control register, VRAM base)
- TI-OS display state (cursor position, MathPrint flags)
- LCD timing parameters
- Color histogram
compare
Compare our trace with CEmu trace file. Reports first divergence point and statistics.Trace Comparison with CEmu
For detailed parity testing:Step 1: Generate CEmu Trace
trace_gen tool generates CPU instruction traces from CEmu:
-n steps- Number of steps to trace (default: 1,000,000)-o file- Output file (default: stdout)
Step 2: Generate Rust Trace
Step 3: Compare
- First divergence point
- Register differences (PC, SP, AF, BC, DE, HL, IX, IY)
- Flag differences (ADL, IFF1, IFF2, IM)
- Cycle count differences
Full Trace with I/O Operations
For comprehensive debugging with I/O operation tracking:fulltrace
Generate comprehensive trace with I/O operations in JSON format.../traces/fulltrace_<timestamp>.json
JSON format:
fullcompare
Compare two JSON trace files and report divergence.- First difference in PC, registers, or I/O ops
- Cycle differences
- I/O operation count mismatches
- Detailed divergence analysis
Advanced Debugging
disasm
Disassemble instructions at a specific address.ports
Dump control port values after boot. Useful for comparing with CEmu.mathprint
Trace writes to MathPrint flag (0xD000C4) during boot.watchpoint
Single-step boot and capture PC when 0xD000C4 is written.Environment Variables
DUMP_STEP
Dump memory at specific step during trace:DUMP_STEP=N- Step number to dumpDUMP_ADDR=0xNNN- Address to dump (hex)DUMP_LEN=N- Number of bytes to dump
SERIAL_FLASH
Use serial flash instead of parallel flash:Development Workflow
Recommended workflow for debugging changes:-
After every change, verify boot still works:
-
Generate trace to check for regressions:
-
Compare with CEmu if divergence is suspected:
- Investigate immediately if divergence is found before continuing other work.
See Also
- Testing - Running unit tests and parity checks
- CEmu Parity - CEmu setup and parity verification
- ROM Loading - Loading programs into the emulator