esolang

MC14500B

A real chip with a 1-bit register and sixteen 4-bit instructions, written as one hex digit each.

Motorola · Turing complete: no · ●○○ easy · esolangs.org

Tested with 3 known programs · Test method

Run it

Expected: 0

The idea

The MC14500B is a 1-bit microcontroller that Motorola designed. It has one 1-bit register, a 1-bit data bus and sixteen instructions of 4 bits each. The specification writes a program as a string of hex digits, one per instruction, and gives a short implementation in which the data bus is a single bit.

Read the story

So the whole memory is two bits. The only ways to change the path are a jump back to the start and two instructions that skip the next one, so a program that loops runs until a skip carries it past its jump.

The machine

DigitNameDoes
1 2LD, LDCLoad the data bit, or its complement, into R
3 5 7AND, OR, XNORCombine R with the data bit
4 6ANDC, ORCNot (R and data), not (R or data)
8 9STO, STOCStore R, or its complement, in the data bit
AIENRead the next input bit into R
BOENPrint R
CJMPGo back to the start
DRTNSkip the next instruction
ESKZSkip the next instruction if R is 0
0 FNOPO, NOPFSet a flag that nothing reads

R and the data bit start at 0. When the input runs out, the signal stays at the last bit.

Example

The truth machine is four digits.

The truth machine is four digits. It reads a bit and prints it. A 1 lets the jump run, so it reads and prints again; a 0 skips the jump and the program ends. Given the signal 1, 1, 1, 0 it prints each one.

Expected: 1110

Without input R can still be set, since the data bit is 0 and LDC loads its complement.

Expected: 1011

Further

Also in Turing tarpits

Write your own in Run Convert a program from MC14500B

Implementation

JavaScript interpreter, source and command line

A JavaScript interpreter, used in the browser and on the command line. Id: mc14500b.

Command line

shib run mc14500b -e 'ABEC' --input '0'
shib manual mc14500b

Source

Module
langs/wiki/ports.js
Interpreter
langs/wiki/mc14500b.js

Docs: Kernel instructions · The .shib format · Command line · Adding a language

Source esolangs.org (CC0) · Edit on esolangs.org