Rainbow Assembly

From Esolang
Jump to navigation Jump to search

Rainbow Assembly is a Turing complete tiny assembly language with only 8 instructions.
The earliest version is Rainbow-1, which was created on 03/25/2026 (MM/DD/YYYY)

Instruction set

// - comment - Used to write comments in code, gets ignored by assembler.
00 - halt - Halts the program.
01 - str - Stores given data into register.
02 - stm - Stores data from register into given memory address.
03 - sfm - Stores data from given memory address into register.
04 - add - Adds given data to register.
05 - sub - Subtracts given data from register.
06 - ifz - If the data in the given memory address is zero, skip a line, if false, continue.
07 - jmp - Jump to given program memory address.

Example programs

This is a list of example programs written using Rainbow-1 assembly.

Subtraction

Sets value in register and subtracts until zero.

00 - //program starts at address 00
01 - 01 5 //str 5
02 - 02 50 //stm 50
03 - 05 1 //sub 1
04 - 02 50 //stm 50
05 - 06 50 //ifz 50
06 - 07 03 //jmp 03
07 - 00 //halt

I couldn't think of any other example programs, feel free to add them and maybe fix some of the formatting here.