New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

eighty-eighty-js

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

eighty-eighty-js

A nice little Intel 8080 emulator for Node.js and Browser!

  • 1.0.8
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
decreased by-66.67%
Maintainers
1
Weekly downloads
 
Created
Source

EightyEighty.js

A nice little Intel 8080 emulator for Node.js and Browser!

NPM VERSION NPM DOWNLOADS DEPENDENCIES

AboutInstallationUsageResourcesLicense

About

Originally I wrote this because I was interested in how emulators work, and what a CPU actually does.
But, after several days of work, I managed to put together a pretty good codebase, therefore I've decided to make this emulator available as a library of its own, so that anyone could embed it in their web pages or applications!

I mostly followed the tutorial here: http://emulator101.com

Try it out

I've made a little website to showcase this library: arcade.skayo.dev

Installation

With npm:
$ npm install eighty-eighty-js

With pnpm (recommended):
$ pnpm install eighty-eighty-js

With yarn:
$ yarn add eighty-eighty-js

or you can directly add it to your website via unpkg:

<script src="https://unpkg.com/eighty-eighty-js"></script>

Usage

If this project gains more attention I'll add some documentation!

You'll probably need to install typed-numbers too!

import { Cpu, Memory, Device } from 'eighty-eighty-js';
import { promises as fs } from 'fs';
import { u8 } from 'typed-numbers';

// Read ROM
const programBuffer = await fs.readFile('./example-rom.bin');

// Init Memory
const mem = new Memory();

// Load ROM into Memory
mem.load(programBuffer, 0x100);

// Device that handles inputs and outputs
const device: Device = {
	input(port: u8) {
		console.log('INPUT', port);
		return u8(0);
	},

	output(port: u8, byte: u8) {
		console.log('OUTPUT', port, byte);
	},
};

// Init CPU
const cpu = new Cpu(mem, device);

// Execution Loop
while (true) {
	// Check if halted
	if (cpu.halted) break;
	
	cpu.next(); // CPU operation without any delays
	// OR
	await cpu.step(); // Simulates real Intel 8080 speed
}

Resources

These resources helped a lot while developing the emulator:

License

MIT License

Keywords

FAQs

Package last updated on 10 Oct 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc