Rust Unit Tests
Run the test suite from thecore/ directory:
- Memory subsystem - Flash, RAM, VRAM, memory-mapped ports
- Bus address decoding - Address routing and wait states
- eZ80 CPU instructions - Instruction execution and flag behavior
- ADL mode - 24-bit addressing mode operations
- TI-84 CE memory map - Hardware register layout verification
Running Specific Tests
Run a specific test by name:Test Output
Show test output (normally hidden):CEmu Parity Tools
Test tools intools/cemu-test/ compare CEmu (reference emulator) behavior with our Rust implementation.
Prerequisites
-
Clone CEmu (one-time setup):
-
Build CEmu core:
-
Obtain a TI-84 Plus CE ROM file - Place
TI-84 CE.romin the project root.
Building the Tools
parity_check- State verification at cycle milestonestrace_gen- CPU instruction trace generator
parity_check
Verifies RTC timing, MathPrint flag, and key state at cycle milestones.Usage
Monitored Addresses
| Address | Description |
|---|---|
| 0xD000C4 | MathPrint flag (bit 5: 1=MathPrint, 0=Classic) |
| 0xF80020 | RTC control register (bit 6: load in progress) |
| 0xF80040 | RTC load status (0x00=complete, 0xF8=pending) |
Expected Behavior
- RTC load stays pending (0xF8) until ~24M cycles at 48MHz
- MathPrint flag should be set (0x20) after boot completes
Output Format
trace_gen
Generates CPU instruction traces for direct comparison with Rust emulator.Usage
Output Format
Space-separated trace format:step- Instruction numbercycles- Total cycles executedPC- Program counterSP- Stack pointerAF- Accumulator + FlagsBC, DE, HL, IX, IY- Register pairsADL- ADL mode (0=Z80, 1=eZ80)IFF1, IFF2- Interrupt enable flagsIM- Interrupt mode (Mode0/Mode1/Mode2)HALT- Halted stateopcode- Opcode bytes (hex)
Comparing Traces
Generate both traces and compare:Analyzing Divergence
When divergence is found:- Identify the first diverging step - Note the step number and PC
- Check register differences - Which registers diverged?
- Check cycle differences - Does cycle count match?
- Examine the instruction - What instruction executed at that PC?
- Review instruction implementation - Check the CPU implementation for that opcode
Full Trace Comparison
For detailed I/O-level debugging, usefulltrace and fullcompare:
- PC/opcode mismatches
- Cycle differences
- Register state divergences
- I/O operation differences
Testing Workflow
Recommended testing workflow:1. Run Unit Tests First
2. Verify Boot
3. Generate Parity Trace
4. Compare with CEmu
Generate CEmu trace and compare:5. Investigate Divergence Immediately
If divergence is found, investigate before continuing other work.Continuous Integration
For CI/CD pipelines:Test Coverage
Current test status (from milestones):- 277/455 tests passing (178 pre-existing failures)
- Boot test passing - 168.14M cycles to idle loop at PC=085B80
- All 7 CEmu parity phases complete
See Also
- Debugging Tools - Debug commands and trace generation
- CEmu Parity - CEmu setup and parity verification
- ROM Loading - Loading programs for testing