Byte Syze

From Esolang
Jump to: navigation, search

Byte Syze is a very simple programming language devised by User:Smjg. Source code takes the form of a binary file.

In it, every instruction, value or memory address is a byte in syze. Moreover, there is no distinction between code space and data space.

The 256-byte memory space is initialised to the program code; if the program is shorter than 256 bytes then the remainder of the memory space is initialised to zero. A program may not be longer than 256 bytes.

There are also four registers: data register (DR), address register (AR), instruction register (IR) (program counter) and switch register (SR), also each a single byte and initialised to zero.

Execution consists of repeatedly reading the byte pointed to the IR, incrementing the IR, and then executing the read instruction, until byte 255 is read as an instruction and executed.

Instructions

Instruction
(ASCII)
Mnemonic
name
Description
< Load Copies the value at the memory address indexed by AR into DR.
> Store Copies the value from DR into the memory address indexed by AR.
* Point Swaps the values contained in DR and AR.
! Jump Swaps the values contained in AR and IR.
\ Switch Swaps the values contained in DR and SR.
+ Add Adds together the value in DR and the value at the memory address indexed by AR. Stores the result in DR.
- Subtract Subtracts the value at the memory address indexed by AR from the value in DR. Stores the result in DR.
( Input Receives a byte from the standard input and stores it in DR. If EOF of the standard input is reached, DR will receive the value 0.
) Output Writes the byte stored in DR to the standard output.
? Conditional If the value contained in DR is 0, increments IR by 1.
anything else Nop

Computational class

The memory model restricts the number of possible program states to no more than 22080 (the actual number is probably much less than this). As such, Byte Syze cannot be Turing complete. At best, it is a finite-state automaton.

External link