Created factory for system creation.

Systems are now defined in JSON rather than hard-coded
This commit is contained in:
Jan-Peter von Hunnius 2025-09-29 12:41:16 +02:00
parent c039e9069a
commit 6f3295dc5e
31 changed files with 1610 additions and 1709 deletions

View file

@ -1,10 +1,12 @@
# Rusty Emulator
A comprehensive Intel 4004/4001 microprocessor simulator written in Rust, featuring cycle-accurate emulation and extensive testing capabilities.
A comprehensive Intel 4004/4001 microprocessor simulator written in Rust, featuring cycle-accurate emulation and
extensive testing capabilities.
## Overview
Rusty Emulator is a detailed simulation of Intel's first microprocessor system, the MCS-4 (Micro Computer System). It provides:
Rusty Emulator is a detailed simulation of Intel's first microprocessor system, the MCS-4 (Micro Computer System). It
provides:
- **Hardware-Accurate Simulation**: Cycle-accurate timing where possible
- **Comprehensive Testing**: Extensive test suite with multiple testing strategies
@ -103,7 +105,7 @@ let mut rom = Intel4001::new("ROM1".to_string());
// Load program data
let program = vec![0x12, 0x34, 0x56, 0x78];
rom.load_rom_data(program, 0)?;
rom.load_rom_data(program, 0) ?;
// Use in simulation
rom.update(); // Process one clock cycle
@ -119,7 +121,7 @@ let mut system = IntelMCS4::new();
// Load program
let program = vec![0x12, 0x34, 0x56, 0x78];
system.load_program(0, &program)?;
system.load_program(0, & program) ?;
// Run simulation
system.run();
@ -127,7 +129,8 @@ system.run();
## Testing
The project includes a comprehensive test suite demonstrating that the `intel_400x` common functionality is highly testable:
The project includes a comprehensive test suite demonstrating that the `intel_400x` common functionality is highly
testable:
### Test Categories
@ -154,6 +157,7 @@ cargo test -- --nocapture
### Test Results
The test suite demonstrates:
- ✅ **Main library compiles successfully**
- ✅ **Core functionality works correctly**
- ✅ **State management operates properly**
@ -176,7 +180,9 @@ The test suite demonstrates:
## Key Technical Achievements
### 1. Testability Demonstration
**Answer to Original Question: CONFIRMED**
- ✅ **Yes, it is absolutely possible to write meaningful test cases for the generic intel_400x file**
- ✅ **Pure functions**: Address assembly, clock logic, state queries are easily testable
- ✅ **Mockable architecture**: Trait-based design enables comprehensive mocking
@ -184,12 +190,14 @@ The test suite demonstrates:
- ✅ **Integration testing**: Real components work correctly with common traits
### 2. Comprehensive Test Suite
- **416 lines** of comprehensive test code
- **Multiple testing strategies**: Unit, mock-based, property-based, integration
- **High test coverage**: Core functionality, edge cases, error conditions
- **Working examples**: Demonstrates practical usage patterns
### 3. Clean Architecture
- **Trait-based design**: Enables code reuse and testing
- **Separation of concerns**: Clear boundaries between components
- **Extensible structure**: Easy addition of new components
@ -198,6 +206,7 @@ The test suite demonstrates:
## Development Status
### ✅ Completed
- Core component architecture
- Intel 4001 ROM implementation
- Intel 4004 CPU structure
@ -206,12 +215,14 @@ The test suite demonstrates:
- Documentation system
### 🚧 In Progress
- Complete Intel 4004 instruction execution
- Intel 4002 RAM implementation
- System integration and testing
- Performance optimization
### 📋 Planned
- Additional CPU architectures (6502, 65C02)
- Enhanced I/O device support
- Development tools integration
@ -245,7 +256,8 @@ This project demonstrates:
## License
This project is educational and demonstrates microprocessor simulation techniques. See individual source files for specific licensing information.
This project is educational and demonstrates microprocessor simulation techniques. See individual source files for
specific licensing information.
## Acknowledgments
@ -255,4 +267,5 @@ This project is educational and demonstrates microprocessor simulation technique
---
**Note**: This is an educational simulation of historical hardware. While it aims for accuracy, some aspects are simplified for educational purposes and modern Rust implementation requirements.
**Note**: This is an educational simulation of historical hardware. While it aims for accuracy, some aspects are
simplified for educational purposes and modern Rust implementation requirements.