chip_8_cpu_emulator

Crates.iochip_8_cpu_emulator
lib.rschip_8_cpu_emulator
version0.1.0
sourcesrc
created_at2023-02-19 10:28:43.838367
updated_at2023-02-19 10:28:43.838367
descriptionchip 8 cpu emulator written rust
homepage
repository
max_upload_size
id788751
size28,774
Janath jsk (janathsrikrishnan)

documentation

README

Chip 8 emulator writen in rust

steps:

  1. import the chip_8_cpu_emulator.
    chip_8_cpu_emulator = "0.0.1"
            (or)
    chip_8_cpu_emulator = "*"
  1. then use in your project, by adding
    use chip_8_cpu_emulator::cpu::CPU
  1. configure the cpu and run.

    let mut cpu = CPU {
        registers: [0; 16],
        memory: [0; 0x1000],
        pc: 0,
        sp: 0,
        stack: [0; 16],
        i_reg: 0,
    };

    /* initializing the registers */
    cpu.registers[0] = 5;
    cpu.registers[1] = 10;
    cpu.registers[2] = 10;
    cpu.registers[3] = 10;
    
    /* store the program in memory */
    cpu.memory[0] = 0x81; cpu.memory[1] = 0x18;        // left shift reg_x
    cpu.memory[2] = 0x80; cpu.memory[3] = 0x08;        // left shift reg_x
    cpu.memory[4] = 0x00; cpu.memory[5] = 0x00;        // end of the program

  1. Finally run the cpu with method.
    cpu.run();
Commit count: 0

cargo fmt