dual tape ez is a simple tape machine. Every cell holds an instruction and a number.
About
About
|
Author
|
Charles McMarrow
|
User
|
User:Ch44d
|
Conceived
|
8/18/2021
|
Birthday
|
10/30/2021
|
Instructions
Name
|
Instruction
|
Description
|
Halt
|
h
|
Stop the program.
|
Out Number
|
n
|
Outputs the number from item_1.
|
Out Character
|
c
|
Outputs the number as a UTF-8 character from item_1.
|
In Number
|
i
|
Read number from console into item_1. Falls back to 0 if error.
|
In Character
|
o
|
Read UTF-8 character from console into item_1. Falls back to "\0" if error.
|
Add
|
a
|
item_1 = item_2 + item_1
|
Subtract
|
s
|
item_1 = item_2 - item_1
|
Jump
|
j
|
pc = current value in memory
|
Jump Dynamic
|
k
|
pc = value from memory address in item_1
|
Jump Zero
|
z
|
pc = item_1 if item_2 == 0
|
Jump Greater
|
g
|
pc = item_1 if item_2 >= 0
|
Read
|
r
|
item_2 = item_1; item_1 = current value in memory
|
Read Dynamic
|
t
|
item_2 = item_1; item_1 = value from memory address in item_1
|
Read Dynamic Instruction
|
y
|
item_2 = item_1; item_1 = value from memory instruction address in item_1
|
Write
|
w
|
current location in memory = item_1
|
Write Dynamic
|
e
|
value from memory address in item_1 = item_2
|
Write Dynamic Instruction
|
d
|
value from memory instruction address in item_1 = item_2 if item_2 is a valid instruction
|
NOP
|
.
|
No operation performed.
|
Registers
Register
|
Description
|
pc
|
Holds the current program counter. At program start pc is set to the label "@". If Label "@" is not present an error will be thrown.
|
item_1
|
Set to 0 at program start.
|
item_2
|
Set to 0 at program start.
|
Memory
A single memory cell holds two items, instruction and data. The default instruction value is "." and the default data value is 0. Memory range is negative infinity to infinity.
Syntax
Syntax
|
<CODE> ::= {(([LABEL] INSTRUCTION [LABEL | NUMBER | CHARACTER | COMMENT] [COMMENT]) | COMMENT | "") NEWLINE}
|
<LABEL> ::= "@" {Any UTF-8 Character excluding white space}
|
<INSTRUCTION> ::= "n" | "x"
|
<COMMENT> ::= "#" {Any UTF-8 Character excluding NEWLINE}
|
<NEWLINE> ::= "\n"
|
<CHARACTER> ::= "c" (Normal UTF-8 Character)
|
<NUMBER> ::= An Integer
|
Sister Language
dual_tape
Programs
@ i # Truth Machine
r @zero
z
@one_loop r 1
n
j @one_loop
@zero r 0
n
h
Hello World
@hello_str . cH # Hello World
. ce
. cl
. cl
. co
. 32
. cW
. co
. cr
. cl
. cd
. c!
. 10
. 0
@ r @ptr
t
t
r @exit
z
r @ptr
t
t
c
r @ptr
t
r 1
a
@ptr w @hello_str
j @
@exit h