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 🙏

© 2026 – Pkg Stats / Ryan Hefner

ljd-16-bit-cpu

v0.4.0

Published

LJD 16-bit processor

Readme

LJD 16-bit processor

For other implementations, see https://github.com/lj-ditrapani/16-bit-computer-specification.

Design:

  • 16-bit CPU
  • 16 X 16-bit registers and program counter (PC)
  • Harvard architecture
  • 2^16 = 65,536 Program memory addresses (16-bit resolution)
  • 2^16 = 65,536 Data memory addresses (16-bit resolution)
  • Program & data memory are word-addressable
  • A word is 16 bits (2 bytes)
  • All instructions are 16 bits long
  • 16 instructions (4-bit op-code)

The processor instruction set architecture (ISA) can be found in ISA.md.

npm package

https://www.npmjs.com/package/ljd-16-bit-cpu

npm install --save ljd-16-bit-cpu

Usage

From browser:

<script type="module">
import { makeCpu, makeDebugCpu } from "/browser/ljd_16_bit_cpu.js"
// do stuff
</script>

From node.js:

const { makeCpu, makeDebugCpu } = require('ljd-16-bit-cpu')
// do stuff

Run a program

// programRom is a array of 16-bit integers with length <= 65,536
const cpuWithIoRam = makeCpu(programRom, dataRom)
const cpu = cpuWithIoRam.cpu
const ioRam = cpu.run(1000)

Step through a program

const cpuWithIoRam = makeDebugCpu(programRom, dataRom)
const cpu = cpuWithIoRam.cpu
cpu.step()
cpu.step()
// ...

Example program in hex

// This program adds the values in dataRom[0] and dataRom[1]
// then stores the result in ioRam[512]
// 27 + 73 = 100
// Address $FA00 is the beginning of screen RAM == ioRam[512]

const programRom = [
  0x100A,       // HBY 0x00 RA
  0x200A,       // LBY 0x00 RA
  0x3A01,       // LOD RA R1
  0x201A,       // LBY 0x01 RA
  0x3A02,       // LOD RA R2
  0x5123,       // ADD R1 R2 R3
  0x1FAA,       // HBY 0xFA RA
  0x200A,       // LBY 0x00 RA
  0x4A30,       // STR RA R3
  0x0000        // END
]

const dataRom = [27, 73, 0]
const cpuWithIoRam = makeCpu(programRom, dataRom)
const cpu = cpuWithIoRam.cpu
const ioRam = cpu.run(1000)
console.log(ioRam[512])      // prints 100

API Documentation

https://lj-ditrapani.github.io/16-bit-cpu-ts/

Developing

Format, lint, test, build

npm run all

This produces lib/ljd_16_bit_cpu.js for node environment and browser/ljd_16_bit_cpu.js for browser environments respectively.

Manual browser test

Run manual test in browser; prints 100 to dev console.

npm run browser-test

Then open localhost:8000/manual-test.html in your browser. Open the developer console to see the 100.

firefox localhost:8000/manual-test.html

Manual node test

Run manual test on node; prints 100.

node manual-test.js

Update dependencies

npm run ncu

Publish

npm login
npm version patch/minor/major
npm publish

Author: Lyall Jonathan Di Trapani