Message board for the users of flat assembler.
> Programming Language Design > Challenger Interpreter
Goto page 1, 2, 3 Next
A recent thread about the Befunge programming language inspired me to design another language, similar but with quite different ideology.
The main similarity to Befunge is the instruction flow on the two-dimensional characters plane. However, as opposed to Befunge, this language is register-based, and generally a bit inspired by the architecture of processors like x86 family. Also there are no input and output instructions - as the character plane serves similar role to memory in x86 system, you can use some parts of it to present the output, a bit like you'd be writing to video memory. Well, since this memory is two-dimensional, you could even try some drawing on it. The intepreter displays the contents of character plane in real time, thus you may see everything that happens there at any moment.
Because of it being inspired by both *Funge languages and x86 architecture, I first thought of naming it like Funge-86. However, as this reminded me of year 1986, when a few truly moving events took place, I decided to choose a name after one of those events, which is - in my feeling - less remembered that others, though I recall it clearly that I was watching it happening on TV when I was a small child. So to honor the crew of the space shuttle that disintegrated in 1986, I named this language Challenger.
Each memory cell is a 32-bit signed value, presented as Unicode character. (This causes some problem with current implementation, because I've discovered that even with fixed pitch font in Windows not every character has the same width - if someone has a good idea how to correct this, please let me know).
The program is loaded from UTF-8 text file and initializes this way some area on plane. The plane will be explanded in any direction when needed.
There are two main pointers operated by Challenger machine, the instruction pointer (IP) and data pointer (DP). The pointer not only determines the character cell on the plane, but also the direction of movement. The direction of IP is always specified directly, while direction of DP is always specified as rotation of the previous one. Both the IP and DP begin in the left upper corner of program code, with direction of moving right. Apart from this pointers, the machine has just one register, accumulator (A), which is used to perform the arithmetic operations and condition testing.
The basic instruction set is:
> Set IP direction to "right" < Set IP direction to "left" ^ Set IP direction to "up" v Set IP direction to "down" | Set IP direction to "down" if A=0, "up" otherwise _ Set IP direction to "right" if A=0, "down" otherwise . Move DP one cell forward Move DP forward by amount of cells specified in A Rotate DP direction clockwise Rotate DP direction counterclockwise = Set DP to be the same as IP \ Exchange A with cell at DP + Add value of cell at DP to A - Substract value of cell at DP from A * Multiply A by value of cell at DP / Divide A by value of cell at DP % Calculate A modulo value of cell at DP ` Load sign of value in A so if A<0, set A=1; set A=0 otherwise " Load immediate value