#emulator #8080

bin+lib i8080emulator

An Intel 8080 CPU full emulation library for 3rd party platform use

1 unstable release

0.1.0 Jul 25, 2023

#185 in Emulators

MIT license

65KB
2K SLoC

Rust 1K SLoC // 0.0% comments Assembly 708 SLoC // 0.1% comments

Using Rust to implement a full Intel 8080 CPU emulator.

To verify if the emulator works well, run cpudiag program under path diagnosis_program/. I also modified the assembly to avoid the need of writing to ROM.

This library is intended to be reused on different platforms: macOS, iOS, Android and (if possible) Web.

The FFI design is meant to be easy to understand and use.

The most important part of this library is to give you an instance of the CPU representative, within which all the functions(CPU, RAM, IO) are provided.

If we take a look at the interfaces in emulator.h header file, we can see:

  • Cpu8080 opaque struct, we obtain a pointer to it on app platforms and pass it back to this lib for interpretation. e.g. see run method
  • IoCallbacks struct, as the name implies, this is for IO interaction, e.g. we need to read from/write to peripheral devices, every time an IO request made from CPU, we need a way to get back to our devices.
  • Interrupt, we simulate a way to receive interrupts from the outside world, the interrupts always happen asynchronously, a mpsc channel can be used for this purpose, and CPU is the receiver, the sender should be owned by the platforms.
  • Pause/resume the execution, similar to handle interrupts, a mpsc should be used, but with some extra cares:
    • for receiving pause request, we check the request in a non-blocking manner (active state)
    • for receiving resume request, we check the request in a blocking manner (idle state)

How to use

To use this library for app development, just build and copy the static library libemulator.a and include the emulator.h header file in your project.

Apps powered by this library

No runtime deps

Features