Git Product home page Git Product logo

intel8080's Introduction

Intel8080 Emulator

Project to develop as close to cycle-accurate of an Intel 8080 emulator as I can. It passes the full test suite found here.

I created this for use with my Space Invaders emulator.

Usage

Dependencies

  • A c++ compiler
  • CMake version 3.26+
  • CMake build generator

Adding to project

Using CMake's FetchContent, add this to your CMakeLists.txt file:

include(FetchContent)
FetchContent_Declare(
        Intel8080
        GIT_REPOSITORY "https://github.com/harrow22/Intel8080.git"
)
set(INTEL8080_TESTS OFF)
FetchContent_MakeAvailable(Intel8080)

Then you can just link it to your executable using target_link_libraries.

Documentation

See header file

Running Tests

With CMake

git clone https://github.com/harrow22/Intel8080.git
cd Intel8080/
cmake -S . -B build -G your_generator -DCMAKE_BUILD_TYPE=RELEASE
cmake --build build --config Release
build/tests/Intel8080_test.exe <ARGUMENTS>...

By default, it will write output to stdout. Running it on my i5-8250U on Windows 11 produces this,

*** TEST: TST8080.COM
MICROCOSM ASSOCIATES 8080/8085 CPU DIAGNOSTIC
 VERSION 1.0  (C) 1980

 CPU IS OPERATIONAL
*** 651 instructions executed on 4924 cycles (expected=4924, diff=0) in 6 ms

*** TEST: 8080PRE.COM
8080 Preliminary tests complete
*** 1061 instructions executed on 7817 cycles (expected=7817, diff=0) in 1 ms

*** TEST: CPUTEST.COM

DIAGNOSTICS II V1.2 - CPU TEST
COPYRIGHT (C) 1981 - SUPERSOFT ASSOCIATES

ABCDEFGHIJKLMNOPQRSTUVWXYZ
CPU IS 8080/8085
BEGIN TIMING TEST
END TIMING TEST
CPU TESTS OK

*** 33971311 instructions executed on 255653383 cycles (expected=255653383, diff=0) in 2.820 sec

*** TEST: 8080EXM.COM
8080 instruction exerciser
dad <b,d,h,sp>................  PASS! crc is:14474ba6
aluop nn......................  PASS! crc is:9e922f9e
aluop <b,c,d,e,h,l,m,a>.......  PASS! crc is:cf762c86
<daa,cma,stc,cmc>.............  PASS! crc is:bb3f030c
<inr_,dcr_> a...................  PASS! crc is:adb6460e
<inr_,dcr_> b...................  PASS! crc is:83ed1345
<inx,dcx> b...................  PASS! crc is:f79287cd
<inr_,dcr_> c...................  PASS! crc is:e5f6721b
<inr_,dcr_> d...................  PASS! crc is:15b5579a
<inx,dcx> d...................  PASS! crc is:7f4e2501
<inr_,dcr_> e...................  PASS! crc is:cf2ab396
<inr_,dcr_> h...................  PASS! crc is:12b2952c
<inx,dcx> h...................  PASS! crc is:9f2b23c0
<inr_,dcr_> l...................  PASS! crc is:ff57d356
<inr_,dcr_> m...................  PASS! crc is:92e963bd
<inx,dcx> sp..................  PASS! crc is:d5702fab
lhld nnnn.....................  PASS! crc is:a9c3d5cb
shld nnnn.....................  PASS! crc is:e8864f26
lxi <b,d,h,sp>,nnnn...........  PASS! crc is:fcf46e12
ldax <b,d>....................  PASS! crc is:2b821d5f
mvi <b,c,d,e,h,l,m,a>,nn......  PASS! crc is:eaa72044
mov <bcdehla>,<bcdehla>.......  PASS! crc is:10b58cee
sta nnnn / lda nnnn...........  PASS! crc is:ed57af72
<rlc,rrc,ral,rar>.............  PASS! crc is:e0d89235
stax <b,d>....................  PASS! crc is:2b0471e9
Tests complete
*** 2919050698 instructions executed on 23803381171 cycles (expected=23803381171, diff=0) in 3.33 min

Done. Total time elapsed 3.35 min

which, admittedly, is pretty slow compared to some, but I wasn't necessarily developing this for speed.

Command line arguments

  • -debug - the processor state will be output during M1 cycle of each instruction
  • -v - (requires -debug) the state of the processor's bus lines will be output during every read/write cycle

Warning

If you redirect stdout to a file with -debug enabled, it will output many GBs of data

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.