# basic-computer

> basic-computer

Latest version **1.1.4** (published 2020-01-09) · ISC license · 0 weekly downloads

## Install

```sh
npm install basic-computer
pnpm add basic-computer
yarn add basic-computer
bun add basic-computer
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.4 |
| Published | 2020-01-09 |
| First published | 2019-12-13 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 394 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | matt.c.yates |

## Links

- npm: https://www.npmjs.com/package/basic-computer
- Repository: https://github.com/M-C-Yates/basic-computer
- Homepage: https://github.com/M-C-Yates/basic-computer#readme
- Issues: https://github.com/M-C-Yates/basic-computer/issues
- npm.io page: https://npm.io/package/basic-computer

## Dependencies (5)

- [jest](https://npm.io/package/jest.md) ^24.9.0
- [ts-jest](https://npm.io/package/ts-jest.md) ^24.1.0
- [typescript](https://npm.io/package/typescript.md) ^3.7.2
- [@types/jest](https://npm.io/package/@types/jest.md) ^24.0.22
- [@types/node](https://npm.io/package/@types/node.md) ^13.1.4

## Recent versions

- 1.1.4 (latest) — 2020-01-09
- 1.1.3 — 2020-01-09
- 1.1.2 — 2020-01-06
- 1.1.1 — 2020-01-06
- 1.1.0 — 2020-01-06
- 1.0.11 — 2020-01-06
- 1.0.9 — 2020-01-06
- 1.0.8 — 2020-01-06
- 1.0.7 — 2020-01-06
- 1.0.5 — 2020-01-06
- 1.0.4 — 2020-01-06
- 1.0.3 — 2020-01-06
- 1.0.2 — 2020-01-06
- 1.0.1 — 2020-01-06
- 1.0.0 — 2019-12-13

## README

<h1 align="center">basic-computer</h1>

![](https://github.com/M-C-Yates/basic-computer/workflows/test/badge.svg)

> An implementation of John C. Scotts 8-bit computer written in typescript.

## Specs

- `Memory`: 256 bytes
- 4x general purpose registers
- 8-bit word-size

## Install

```sh
npm install
```

## Usage

```sh
npm run start
```

## Run tests

```sh
npm run test
```

## Instructions

| instruction code | shorthand | description                                                                                                     |
| :--------------: | :-------: | --------------------------------------------------------------------------------------------------------------- |
|    1000 rarb     |    ADD    | Adds contents of ra and rb together, then places result into rb.                                                |
|    1001 rarb     |    SHR    | Shifts contents of ra to the right by one bit, then places result the into rb.                                  |
|    1010 rarb     |    SHL    | shifts contents of ra to the left by one bit, then places the result into rb.                                   |
|    1011 rarb     |    NOT    | Performs a NOT operation between the bytes stored in ra and rb,<br> then places the result into rb.             |
|    1100 rarb     |    AND    | Performs a AND operation between the bytes stored in ra and rb,<br> then places the result into rb.             |
|    1101 rarb     |    OR     | Performs a OR operation between the bytes stored in ra and rb,<br> then places the result into rb.              |
|    1110 rarb     |    XOR    | Performs a XOR operation between the bytes stored in ra and rb,<br> then places the result into rb.             |
|    1111 rarb     |    CMP    | Compares the bytes stored in ra and rb,<br> discards output byte, places result of comparison in flag register. |
|    0000 rarb     |    LD     | Loads contents of ram address stored from ra into rb.                                                           |
|    0001 rarb     |    ST     | Stores contents of rb into ram address from ra.                                                                 |
|    0010 00rb     |   DATA    | Loads the byte following this instruction into rb.                                                              |
|    0011 00rb     |   JMPR    | Jump to the address stored in rb.                                                                               |
|    0100 0000     |    JMP    | Jump to the address indicated in the byte following this instruction.                                           |
|    0101 caez     |   JCAEZ   | Jump if any tested flag is on using JMP, else move IAR forward two bytes.                                       |
|    0110 0000     |    CLF    | Clears the flag register.                                                                                       |

## Cpu methods

## License

This project is [MIT](https://github.com/M-C-Yates/basic-computer/blob/master/LICENSE) licensed.

---
_Source: https://npm.io/package/basic-computer · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
