Screwtape

From Esolang
Jump to navigation Jump to search
This is still a work in progress. It may be changed in the future.

Screwtape is an esoteric programming language designed as a format for a tape reader. The tape reader, or virtual machine, is in one of several states as its head moves over the tape.

Virtual Machine Description

So the virtual machine has a tape, full of 2^16 bytes, which stores both the code and data. Registers are: acc - an accumulator, head - tape head, which is usually incremented. There's also an array tracks of pointers to various addresses in the tape. Currently incomplete, much subject to change

States

State Description
Exec Reads bytes from the tape as instructions
Outpn Outputs bytes from the tape until reaching a null byte, upon which state switches to exec
Outpd Outputs bytes from the tape while decrementing acc, until acc is equal to 0
Inp Reads characters from inp to the tape while decrementing acc, until acc is equal to 0

Instructions

These are executed when the state is exec

Instruction Description
k kill execution
o go to output mode*
i go to input mode
+ increment accumulator
- decrement accumulator
t Sets the location of the track with number of acc to pointed by the next two bytes in little endian
p Plays the track with ID of acc
s Set accumulator