VTL

From Esolang
Jump to: navigation, search

VTL is an esoteric programming language created by David Catt (user:David.werecat) which loads code into modifiable memory and an extended section.

Instructions

Each instruction is split into two parts, the OpCode and the Param. The OpCode is the first three bits of the instruction, and the Param is the other 5 bits. Code is executed in a 256 byte long segment. There is a pointer register that points into that segment. The current "value" is the instruction pointed to by the pointer register. If a second file is specified to the interpreter, it is loaded into the extended section. The extended section can be any size. When execution flow jumps to the extended section, the pointer register still indexes the code segment. When the execution reaches the end of the code segment or extended section, it loops back to the start. Possible OpCodes are as follows:

OpCode Description
000 Move the pointer register forward by Param
001 Move the pointer register backward by Param
010 Increment the value by Param
011 Decrement the value by Param
100 Jump forward Param+1 instructions if the value is 0
101 Jump forward Param+1 instructions if the value is not 0
110 Execute an extended instruction specified by Param
111 Terminate the program with exit status Param

Extended Instructions are as follows:

Param Description
00000 Clear the console
00001 Beep
00010 Set the value to random
00011 Read a character from the console into value
00100 Write a character from value to the console
00101 Push the value into stack 1
00110 Push the value into stack 2
00111 Pop the value from stack 1
01000 Pop the value from stack 2
01001 Set the value to the value pointed to by value
01010 Set the value to 0
01011 Binary not on value
01100 Jump to the extender grid
01101 Return from the extender grid
01110 Start executing instructions
01111 Stop executing instructions
1xxxx Waits for 2^xxxx miliseconds


External resources