npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

z80js

v0.9.4

Published

z80 cpu emulator library

Downloads

2

Readme

z80js

z80js is a Javascript Z80 disassembler and program debugger.

It's highly inspired by libz80 C library by Gabriel Gambetta but apart from my complete Go port https://github.com/viert/z80 this one is done from scratch with more accurate timings, smarter code generation and designed to pass well-known z80 fuse tests (included).

All officially documented Z80 instructions http://www.zilog.com/manage_directlink.php?filepath=docs/z80/um0080&extn=.pdf are implemented and passing tests.

z80js is designed to work in browsers and being developed to become a part of http://t.z80online.net online Z80 assembler/debugger

Building

  • git clone
  • npm i to install dependencies
  • npm run build to build dist/z80bundle.js

Using the library

z80bundle exports Z80 class which can be instantiated like let cpu = new Z80(mem, port, debug)

mem has to be a memory instance with methods read8(addr) and write8(addr, value) reading and writing data from/to memory correspondingly. An example memory class can be found in src/memory.js and is absolutely ready to go memory class used in tests.

port is an I/O device instance capable to read and write data from/to devices. Must have ioread(port) and iowrite(port, data) methods. An example class can be found in src/port.js however this one simulates a single device responding with data being passed via the high byte of a port, i.e. if you read from a port 0xFE34, it will return FE. This is basically how fuse tests are testing port instructions.

debug is a boolean to switch the debug mode on and off. In debug mode the library logs a lot of debug data during running commands.

After creating a cpu instance just run cpu.execute() - this will run a single cpu instruction located where PC register points.

cpu.disassemble(addr) disassembles an instruction by address addr. If no argument is given, the next instruction is being disassembled (i.e. addr equals cpu's PC register). For convenience disassemble method returns an object with fields dasm containing the disassembled code string and nextAddr for you to know what the address of the following instruction is.