Skip to main content

4bit CPU emulator

Project description

td4-py

This repository is a 4bit CPU emulator written by Python.
The original is CPUの創りかた.

features

  • Input/output from plain text or td4 format files

Install

https://pypi.org/project/td4

pip3 install td4

Usage

Supports the input of files in plain text or td4 format.

Input from files

plain text.

td4 program.txt

td4 format text.

td4 Knight2K.td4

Support file format

It also supports several patterns of input from plain text.

Pattern 1

Opcode(LowerCase) + Space + Operand

out 0011
out 0110
out 1100
out 1000
out 1000
out 1100
out 0110
out 0011
out 0001
jmp 0000

Pattern2

Opcode(UpperCase) + Space + Operand

OUT 0111
ADD A,0001
JNC 0111
ADD A,0001
JNC 0011
OUT 0110
ADD A,0001
JNC 0110
ADD A,0001
JNC 1000
OUT 0000
OUT 0100
ADD 0001
JNC 1010
OUT 1000
JMP 1111

Pattern3

Opcode(binary) + Operand

10110011
10110110
10111100
10111000
10111000
10111100
10110110
10110011
10110001
10010000

Pattern4

Opcode(binary) + Space + Operand

1011 0011
1011 0110
1011 1100
1011 1000
1011 1000
1011 1100
1011 0110
1011 0011
1011 0001
1001 0000

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

td4-1.0.0.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

td4-1.0.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file td4-1.0.0.tar.gz.

File metadata

  • Download URL: td4-1.0.0.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for td4-1.0.0.tar.gz
Algorithm Hash digest
SHA256 831ec9a341416128a7055fe78e4264812cec7ef3c79de942bc53f6a9d4dc1199
MD5 abc1a45bf82c860fdcb9ab7b4c2a09f5
BLAKE2b-256 f5457e5ccdc05b5ec1def18e7437142913f66de6308b04489cfba4f57da4aa3e

See more details on using hashes here.

File details

Details for the file td4-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: td4-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.6

File hashes

Hashes for td4-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8648f4e9584cc03d8cce1ebd52d94f741d3b87fcdffd5f597ed26a6ae76a6cd5
MD5 f739515828faa2a413ae178c0f835e34
BLAKE2b-256 6dc1099ee4cf824aef2d687ae0830d9246346f74000f5c90dedb6c4581cc4fb3

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page