Aq Qoyunlu
Jump to navigation
Jump to search
Aq Qoyunlu is designed by PSTF. It is based on Brainfuck, with some modification inspired from SLet and Apollo.
Overview
Aq Qoyunlu, or White Sheep, has a tape and a stack, and also 3 accumulators.
This is the command table.
CC: Current Cell. AX: Accumulator 1. BX: Accumulator 2. CX: Accumulator 3. SS: Stack top. TP: Tape pointer. CS: Current command. IP: Program counter. ZF: Flag, indicates whether the value from the most recent operation is zero. If it is zero, the flag is set to 1. SF: Flag, indicates the sign of the most recent operation. Returns 1 if it's positive, -1 if it's negative, and 0 if ZF is 1. VF: Flag, determines whether the most recent evaluation of a logical expression is true, or whether ZF is 0. If so, it returns 1. MOV A, B: Assign B to A. ADD A, B: Add B to A. SUB A, B: Subtract B from A. MUL A, B: Multiply A by B. DIV A, B: Divide A by B, and return the quotient. MOD A, B: Divide A by B, and return the remainder. IPT A, port: Read a value from the specified port into A. This value must be a number and stops when a whitespace character is encountered. Port 0 refers to the keyboard. Leave "port" blank for port 0. OPT A, port: Directly output the value of A. Port 0 represents the screen. REA A, port: Read a character into A. WRT A, port: Print A as character. #Label_name DO ... END: Define a label. JMP label: Jump unconditionally to the specified label. JZR label: Jump if ZF=1. JNZ label: Jump if ZF=0. IF A DO B ELSE IF A2 DO C ELSE DO D END: Literally meaning. WHILE A DO B END: Literally meaning. LOOP X, label: Jump back to the specified label if X was evaluated into TRUE. TRUE: Logical 1. FALSE: Logical 0. PUSH X: Push the value of X into stack. POP X: Restore the value of X from the stack. DS: Data that DP points to. DP: Data pointer. CMP A, B: Subtract B from A without storing the result, but reflect it through ZF, SF, and VF. EXIT: Literally meaning. More commands coming soon.
Examples
Hello, world!
#Data DO:
WORD 16 "Hello, world!", 13, 10, 0;
END
#Main DO:
MOV CC, DS;
WRT CC;
ADD DP, 1;
CMP DP, 15;
JZR Main;
JMP End;
END
#End DO:
EXIT
END
Pictogram Version
#Data {:
WORD 16 "Hello, world!", 13, 10, 0;
}
#Main {:
= CC, DS;
. CC;
+ DP, 1;
? DP, 15;
⇥0 Main;
⇥ End;
}
#End {:
@
}