This is an emulator of the intel 8080, one of the first 8 bit microprocessors. At a high level, my emulator reads a sequence of instructions (a program) from a file, keeping track of its location in the file using a program counter, and executes the program's instructions sequentially. It simulates a full CPU, from the registers to the I/O to the memory.
You shouldn't use this program with illegally obtained roms, for what I assume are obvious reasons.
Since the emulator is written in raw C, the user only needs a C compiler to get started (note - though the program is compiler agnostic, the provided makefile only works with gcc). Further, while the processor is only 8 bits, there are instructions that rely on bit arithmetic using 16 bit values that consist of two concatentated 8 bit values. This program has only been tested on little endian CPUs. Therefore 16 bit instructions may either malfunction or fail to execute on big endian CPUs due to the most and least significant bits getting swapped.
After cloning the repo using git, open up a terminal and type "make" within your cloned "src" directory. After making, type "./disas
The user can run arbitrary 8080 code by splitting the 8080 code into four different files (each of which should contain 2 kilobytes of code) and typing "./emu
Every cycle the emulator reads the instruction at the current program counter, runs that instruction, and then outputs that instruction's effects in a message that resembles the following:
Number of steps: 64800
0x360023 at current PC 0x1a5f
Current Processor state:
C=1 P=1 S=1 Z=0
A:0x29 B:0x00 C:0x00 D:0x1c E:0x00 H:0x29 L:0xbd SP:0x23fc
MVI M, 00\
In order, this reflects the current instruction's encoding (in hex) and the current program counter, the current flag state and the current register state (including the stack pointer). Finally, the message includes the disassembly of the current instruction.
This emulator is licensed under a standard open MIT license