esolang

Rogex

Every command is three hex digits. The program is a hex string with comments around it.

Lebster, 2020 · Turing complete: unknown · ●●○ moderate · esolangs.org

Tested with 6 known programs · Test method

Run it

Expected: Hello, world!

The idea

Lebster made Rogex in 2020. There are 256 memory cells with hex addresses from 00 to ff, and a buffer beside them that does most of the work. A command is one hex digit for the operation and two for its argument, so A48 prints the character 0x48, an H, and B0F saves the address 0x0F.

Read the story

The Python interpreter lowercases the source, cuts the comments and drops every character that is not a hex digit. Spaces and line breaks can go anywhere, even inside a command.

The machine

CommandDoes
000 001 01xRead a line into the buffer as a decimal number, a hex number or one character
100 101 11xPrint the buffer as a decimal number, in hex or as a character
200 201 21xThe same for the cell at the saved address
3xy 4xy 5xy 6xyAdd the buffer to cell xy, subtract it, or multiply or divide the cell by it
7xy 8xy 9xyAdd xy to the buffer, subtract it, or set the buffer to xy
AxyPrint the character xy
BxySave the address xy
C00Stop
DxySet the loop value from a cell
E00 F00If the buffer is the loop value, skip past the matching F00; if it is not, go back to the matching E00

The interpreter prints a prompt before it reads, such as Input Base 16 Number: , so every program that reads shows it. Numbers are whole and have no limit until a division makes a float, which prints as Python prints one. D reads the decimal digits of its address as hex, so D10 takes cell 0x16.

Example

The count sets cell 0 and the loop value to 11, starts the buffer at 1, and loops from E00 to F00,…
Expected: 1 2 3 4 5 6 7 8 9 10
Expected: Input Base 16 Number: 0.25

The count sets cell 0 and the loop value to 11, starts the buffer at 1, and loops from E00 to F00, printing the buffer and a space and adding 1, until the buffer reaches 11. The third program puts 1 in cell 0, reads a hex number into the buffer, divides and prints the reciprocal.

Further

Cell-based

Write your own in Run Convert a program from Rogex

Implementation

JavaScript interpreter, source and command line

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

Command line

shib run rogex -e '010110' --input 'a'
shib manual rogex

Source

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

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

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