i8051

Crates.ioi8051
lib.rsi8051
version0.13.0
created_at2025-09-20 13:04:44.44524+00
updated_at2025-12-27 20:13:29.240446+00
descriptionAn emulator for the i8051 (MCS-51) microcontroller.
homepage
repositoryhttps://github.com/mmastrac/i8051
max_upload_size
id1847715
size97,731
Matt Mastracci (mmastrac)

documentation

README

i8051 Emulator

This crate provides a fast, unsafe-free emulator for the i8051 microcontroller.

The 8051 (a.k.a. the MCS-51) is a 8-bit microcontroller that was very common in the 1980s and 1990s, and is still used in many modern devices.

There are a number of different variants of the 8051, and this crate supports a CPU like the original 8051, but with a zero-flag extension.

Usage

use i8051::Cpu;

let mut cpu = Cpu::new();
let mut ram = RAM::new();
let mut code = ROM::new(fs::read(&args.rom_file).unwrap());
let mut ports = Ports { ram: [0; 128] };

loop {
    if !cpu.step(&mut ram, &mut code, &mut ports) {
        break;
    }
}

Debugging

The i8051-debug-tui crate provides a terminal UI debugger for the i8051 emulator.

Debugger

Supported Instructions

The instruction set is from the standard MCS-51.

Commit count: 12

cargo fmt