GithubHelp home page GithubHelp logo

tobiasvl / lua-8080 Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 0.0 22 KB

Intel 8080 emulator core, written in Lua

Home Page: https://tobiasvl.github.io/optable/intel-8080/

License: MIT License

Lua 100.00%
emulator 8080 intel8080 intel-8080 intel-8080-emulator lua lua-library i8080

lua-8080's Introduction

lua-8080

An Intel 8080 emulator core written in Lua.

Requirements

Either the bit32 or BitOp module for bitwise operators.

Usage

This emulator core is modular, like the early microcomputers. It should be able to emulate most 8080-based computers, but you need to "wire it up" yourself, just like the old days.

See main.lua for an example of how to use it in your own programs.

You can also look at these emulators that use this core:

Tests

You can download one of the many Intel 8080 test suites and run them with the main.lua script.

Currently, it passes these tests:

  • 8080PRE.COM: Preliminary test for 8080/8085 CPU Exerciser by Ian Bartholomew and Frank Cringles
  • 8080EXER.COM: 8080/8085 CPU Exerciser by Ian Bartholomew and Frank Cringles
  • TST8080.COM: 8080/8085 CPU Diagnostic, version 1.0, by Microcosm Associates
  • CPUTEST.COM: 8080/Z80 CPU Diagnostic II, by SuperSoft Associates

lua-8080's People

Contributors

tobiasvl avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

lua-8080's Issues

Optimize bus

Turns out my bus implementation is inefficient. Not a good place for a bottleneck...

I still need it to be modular, but the current way I do it, ie. with a memory_map table where the key is a table with start address and length, isn't good – even though the memory map is usually small, pairs is un-JIT-able.

Disassembler misses a DAA

No idea what causes this (I can't reproduce it in a smaller program), but when running 8080EXM.COM the DAA at cycle 86712065 is mistakenly disassembled as a NOP. (It's still executed correctly.)

To reproduce:

tvl@rocinante:~/src/lua-8080 $ luajit main.lua 8080EXM.COM debug
tvl@rocinante:~/src/lua-8080 $ grep -C 2 86712065 debug.log
PC: 0D54, AF: 9A06, BC: 9079, DE: 8D5B, HL: 299D, SP: 0111, CYC: 86712044 (F9 2A A2 0D) - SPHL
PC: 0D55, AF: 9A06, BC: 9079, DE: 8D5B, HL: 299D, SP: 299D, CYC: 86712049 (2A A2 0D 27) - LHLD #A20D
PC: 0D58, AF: 9A06, BC: 9079, DE: 8D5B, HL: A559, SP: 299D, CYC: 86712065 (27 00 00 00) - NOP
PC: 0D59, AF: 0017, BC: 9079, DE: 8D5B, HL: A559, SP: 299D, CYC: 86712069 (00 00 00 22) - NOP
PC: 0D5A, AF: 0017, BC: 9079, DE: 8D5B, HL: A559, SP: 299D, CYC: 86712073 (00 00 22 A2) - NOP

Pass 8080EXER.COM

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>.............  ERROR **** crc expected:bb3f030c found:12da49a1
<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
real    51m46.682s
user    51m31.391s
sys     0m0.531s

Really need to optimize to debug this test...

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.