Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chip8js

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chip8js - npm Package Compare versions

Comparing version 0.1.2 to 0.1.4

.travis.yml

2

package.json
{
"name": "chip8js",
"version": "0.1.2",
"version": "0.1.4",
"description": "A Chip-8 emulator written in JavaScript (Node.js).",

@@ -5,0 +5,0 @@ "author": {

@@ -1,2 +0,2 @@

# Chip8.js
# Chip8.js [![Build Status](https://travis-ci.org/taniarascia/chip8.svg?branch=master)](https://travis-ci.org/taniarascia/chip8) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)

@@ -7,13 +7,10 @@ A Chip-8 emulator written in JavaScript (Node.js).

Chip8.js is an ongoing project by Tania Rascia to write a Chip-8 emulator in JavaScript. The main motivation is to learn lower level programming concepts, detailed [here](#concepts), and to increase familiarity with the JavaScript and the Node.js environment.
## Table of Contents
- [Concepts](#concepts)
- [Motivation](#concepts)
- [Installation](#installation)
- [Instructions](#instructions)
- [Usage](#usage)
- [Load ROM](#load-rom)
- [View hex dump](#view-hex-dump)
- [Project Structure](#project-structure)
- [Documentation](#documentation)
- [Reference](#reference)
- [Automated Testing](#automated-testing)

@@ -26,6 +23,8 @@ - [Instruction tests](#instruction-tests)

## Concepts
## Motivation
Concepts I learned while writing this program:
Chip8.js is an ongoing project to write a Chip-8 emulator in JavaScript. The main motivation is to learn lower level programming concepts, detailed [here](#concepts), and to increase familiarity with the Node.js environment.
Here are some of the concepts I learned while writing this program:
- The base system: specifically base 2 (binary), base 10 (decimal), base 16 (hexadecimal), how they interact with each other and the concept of abstract numbers in programming

@@ -39,5 +38,5 @@ - Bits, nibbles, bytes, ASCII encoding, and big and little endian values

- How a CPU can utilize memory, stack, program counters, stack pointers, memory addresses, and registers
- How a CPU implements fetch, decode, execute
- How a CPU implements fetch, decode, and execute
Articles I wrote based on aforementioned concepts:
And here are some articles I wrote based on those concepts:

@@ -51,9 +50,25 @@ - [Understanding Bits, Bytes, Bases, and Writing a Hex Dump in JavaScript (Node)](https://www.taniarascia.com/bits-bytes-bases-and-a-hex-dump-javascript/)

The only dependency of Chip8.js is [jest](https://jestjs.io/) for testing. Run `yarn` to install.
You can add the module directly from the [chip8js](https://www.npmjs.com/package/chip8js) npm package.
```bash
yarn add chip8js
# npm i --save chip8js
```
And require the `RomBuffer` and `CPU` classes.
```js
// index.js
const { RomBuffer, CPU } = require('chip8js')
```
Or you can clone the repo. The only dependency of Chip8.js is [jest](https://jestjs.io/) for testing. Run `yarn` to install.
```bash
git clone git@github.com:taniarascia/chip8.git
cd chip8
yarn
```
## Instructions
## Usage

@@ -85,44 +100,7 @@ Chip-8 compatible ROMs can be saved in the `roms/` directory. A copy of *Connect 4* is shipped with Chip8.js (at `roms/CONNECT4`) for example and testing purposes.

000030 6132 6200 d02f d12f 720f 321e 1234 d021
000040 d121 7201 600a a29f d021 d121 a29f dde1
000050 fc0a dde1 4c05 127e 3c04 126a 7bff 7dfb
000060 3d0a 127a 6b06 6d2d 127a 3c06 1298 7b01
000070 7d05 3d32 127a 6b00 6d0f dde1 1250 a2b4
000080 fb1e f065 40fc 1298 8a00 70fb f055 8983
000090 a29e 3900 a2a1 dda4 a29f dde1 1250 60f0
0000a0 f060 9090 6080 8080 8080 8080 8080 8080
0000b0 8080 8080 1a1a 1a1a 1a1a 1a1a 1a1a 1a1a
0000c0 1a1a
...
```
## Project Structure
## Reference
The source code is contained in the `classes/` and `constants/` directories. Chip8.js comes with a single ROM, a few helper scripts, and unit tests.
```bash
chip8/
classes/
CPU.js
Disassembler.js
RomBuffer.js
constants/
fontSet.js
instructionSet.js
roms/
CONNECT4
scripts/
hexdump.js
<more>
tests/
cpu.test.js
instructions.test.js
.gitignore
index.js
LICENSE
package.json
README.md
yarn.lock
```
## Documentation
In progress.

@@ -161,5 +139,5 @@

#### constants/instructionSet.js (instruction 06)
```js
// constants/instructionSet.js
```js
{

@@ -181,5 +159,5 @@ key: 6,

#### tests/instructions.test.js (test 06)
```js
// tests/instructions.test.js
```js
test('test instruction 06: 3xkk - SE Vx, byte', () => {

@@ -201,5 +179,5 @@ expect(Disassembler.disassemble(0x3abb).instruction).toHaveProperty('id', 'SE_VX_NN')

#### classes/CPU.js (instruction 06)
```js
// classes/CPU.js
```js
case 'SE_VX_NN':

@@ -224,5 +202,5 @@ // Skip next instruction if Vx = kk.

#### tests/cpu.test.js (test 06)
```js
// tests/cpu.test.js
```js
test('test cpu 06: 3xkk - SE Vx, byte', () => {

@@ -253,6 +231,8 @@ cpu.load({ data: [0x3abb] })

## Author
I'm [Tania Rascia](https://www.taniarascia.com). I write articles and tutorials about programming.
## License
The code is open source and available under the [MIT License](LICENSE).
Written by [Tania Rascia](https://www.taniarascia.com).
The code is open source and available under the [MIT License](LICENSE).
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