4-bit virtual CPU
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

24 lines
557 B

// SPDX-License-Identifier: MIT
// Copyright Murad Karammaev, Nikita Kuzmin
mod cpu;
mod instruction;
use cpu::*;
fn main() {
let mut cpu = Cpu::new(&[
0b01001111, // R0 = 0xF
0b01010011, // R1.l = 0x3
0b11100100, // ADD
0b00100000, // [0] = R0
0b11111000, // R0 = 0
0b11110101, // HALT
]);
loop {
if cpu.step() {
break;
}
}
cpu.visualize();
}