Added console for displaying the system state
Corrected behaviour and tests
This commit is contained in:
parent
8193bcda46
commit
0278a96a8d
24 changed files with 1074 additions and 2918 deletions
|
|
@ -6,18 +6,30 @@ This directory contains binary program files for the Intel MCS-4 emulator.
|
|||
|
||||
### fibonacci.bin
|
||||
- **Size:** 33 bytes (16 instructions × 2 bytes each + 1 extra byte)
|
||||
- **Description:** Fibonacci sequence generator
|
||||
- **Description:** Basic Fibonacci sequence generator (stores results in RAM)
|
||||
- **Algorithm:** Calculates first 8 Fibonacci numbers using registers and RAM
|
||||
- **Instructions Used:** LDM, LD, WRM, IAC, ADD, JCN, NOP
|
||||
- **Output:** Results stored in RAM locations 0-7 (not visible to user)
|
||||
|
||||
### fibonacci_output.bin ✨ **RECOMMENDED**
|
||||
- **Size:** 55 bytes (27 instructions × 2 bytes each + 1 extra byte)
|
||||
- **Description:** Enhanced Fibonacci sequence generator with output port visibility
|
||||
- **Algorithm:** Calculates first 8 Fibonacci numbers and outputs them to output ports
|
||||
- **Instructions Used:** LDM, LD, WRM, IAC, ADD, JCN, NOP, SRC
|
||||
- **Output:** Each Fibonacci number visible on output ports 0-7 during execution
|
||||
- **Features:** Real-time visibility of calculation progress
|
||||
|
||||
## Usage
|
||||
|
||||
Programs are automatically loaded by the emulator. Use the `--file` option to specify a different program:
|
||||
|
||||
```bash
|
||||
# Use default fibonacci program
|
||||
# Use default fibonacci program (RAM-based)
|
||||
cargo run -- --system basic
|
||||
|
||||
# Use enhanced fibonacci program with output ports ✨
|
||||
cargo run -- --system basic --file programs/fibonacci_output.bin
|
||||
|
||||
# Use specific program
|
||||
cargo run -- --system basic --file programs/myprogram.bin
|
||||
```
|
||||
|
|
@ -31,4 +43,19 @@ cargo run -- --system basic --file programs/myprogram.bin
|
|||
|
||||
## Program Format
|
||||
|
||||
MCS-4 programs are stored as raw binary data where each instruction is represented as 8-bit bytes. Multi-byte instructions (like addresses) use big-endian format.
|
||||
MCS-4 programs are stored as raw binary data where each instruction is represented as 8-bit bytes. Multi-byte instructions (like addresses) use big-endian format.
|
||||
|
||||
## Program Development Tips
|
||||
|
||||
### Making Programs Visible
|
||||
- **Use Output Ports:** Write results to output ports (0x14-0x17) for visibility
|
||||
- **SRC Instruction:** Select output port with `SRC` before `WRM`
|
||||
- **Real-time Output:** Numbers appear on output ports during execution
|
||||
- **System Monitoring:** Watch RAM contents and output port states in real-time
|
||||
|
||||
### Example Output Port Usage
|
||||
```asm
|
||||
LDM 5 ; Load value 5
|
||||
SRC 0 ; Select output port 0
|
||||
WRM ; Write to output port 0 (now visible to user)
|
||||
```
|
||||
BIN
programs/fibonacci_output.bin
Normal file
BIN
programs/fibonacci_output.bin
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue