Giter Site home page Giter Site logo

thraetaona / exact Goto Github PK

View Code? Open in Web Editor NEW
28.0 3.0 3.0 368 KB

A Bare-Metal Intel 8086 Emulator Written in Raw WebAssembly.

Home Page: https://thraetaona.github.io/EXACT/

License: GNU General Public License v3.0

HTML 7.81% WebAssembly 92.19%
emulator cpu webassembly wasm cpu-emulator assembly wat emulation wast browser

exact's Introduction

EXACT

A Bare-Metal Intel 8086 Emulator Written In Raw WebAssembly.


Abstract

EXACT is an acronym for 'Emulating X86 iAPX CPU on NeT'.
Working demonstration with examples deployed at GitHub Pages.

This project was primarily done for two reasons:

  • In favor of RASM, which is basically a work-in-progress Game Engine written in Rust. Getting fluent in WebAssembly meant writing efficient code and eased its debugging.
  • Experience. an in-depth study of processor that still has alot in common with x86_64 will surely assist in writing optimized code; even though the 8086 lacked any concepts of caches (as an example).

The emulator's source code has been thoroughly documented, except in places where doing so would have been considered extremely verbose or otherwise obivous.

How To Compile And Run

The easiest way to get EXACT up-and-running is by downloading the latest pre-built binaries from the releases section, unpacking the .zip file, running the provided Python script (serve.py) and lastly visiting http://localhost:8086/ using an updated browser that supports WebAssembly.
If done correctly, you should see a page identical to this: https://Thraetaona.github.io/EXACT

Alternatively you could follow the below instructions for a manual build:


First install the official WebAssembly Binary Toolkit ("WABT") using your package manager or from their GitHub Repository.

Next, assemble the source code with:

wat2wasm ./src/8086.wat -o ./src/8086.wasm
The resulting bytecode could optionally be further optimized using:
wasm-opt -O4 --enable-mutable-globals --flatten -iit --dfo --directize --precompute ./src/8086.wasm -o ./src/8086.wasm
(But be aware that aggressive optimizations could result in inaccuracies or unexpected bugs and side effects.)

And finally host the compiled binary along with the HTML file (./src/index.html) at a local or live webserver with application/wasm mimetype; and visit it using a browser supporting the base WebAssembly standard (And the exported mutable globals porposal), such as Google Chrome, Mozilla FireFox or the Chromium-based Microsoft Edge.

You could also add your own or just assemble all the included source files in the ./examples folder using the Netwide Assembler ("NASM") with for f in ./examples/*.asm; do nasm -O0 -f bin "$f";done, if you also host these binary files alongside the previous files, they will appear under the "Examples" dropdown menu in the GUI.

Features

Overview of EXACT

Emulation Capability Current Status
Instructions1 All, including illegal OpCodes
Registers Both User-accessible registers and Reserved Flags are available
RAM Supports up to 2^20 unique segmentated addresses with 16/8 Bit interfaces for interactions
Multimedia (GPU, sound, etc)2 -

1-Interupts or Instructions that require physical hardware access are not implemented.
2-emulating external hardware, a graphical display or interrupts should be easy given that the basis required for them is already finished.

exact's People

Contributors

thraetaona avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

exact's Issues

Potentially dead code

Attempts to load the webpage, whether hosted local or not, loads indefinitely. Whether the page will load at all is questionable. It has been spinning for the last ~15 minutes (most recent attempt made 19:20 yesterday, and killed 19:34, with no known progress).

I am running Python 3.8, Firefox 84.0.2, Windows 10.

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.