PSEUDO ASSEMBLY LANG 1101 SPECIFICATION v1.5 It's character table (0-94): 01234567 89ABCDEFG HIJKLMNOP QRSTUVWXY Zabcdefgh ijklmnopq rstuvwxyz !@#$%^&*( )-=_+[]{} ;:'"\|,./ ?<> Whitespace is at the beginning (0) and new line is at the end (94) The language consists of instructions constructed of combinations of 4 zeros and ones. NOTE: a value is a number ranging from 0 to 65535 (65536 possible values). If a value overlaps 65535 it's set back to 0 0.SYNTAX Every character other than [0-1] is ignored. Each file has to have character count dividable by 4 after removing those others than 1's and 0's (since operators are 4 bits) 1.REGISTERS Data is stored in 4 registers, each consisting of 16 cells (0-15), one value per cell. There is one flag register, that holds one value, and cannot be modified directly. Registers are labeled as such: 1000 - A reg 1001 - B reg 1010 - C reg 1011 - D reg 1100 - Flag - impossible to increment/decrement, can only be set by internal functions. Default register is A register. NOTE: theese can and will overlap with instructions. 2.LOOPS AND STATEMENTS A loop is repeated until a value in the cell is equal to 0 A statement is executed if a flag register is set to 1. A loop starts with instruction 1010 - STARTLOOP A statement starts with instruction 1110 - STARTSTAT Both end with instruction 1011 - ENDLS NOTE: The interpreter should scan for the nearest ENDLS instruction after the STARTLOOP or STARTSTAT, none else => nested statements and loops are NOT supported. 3.VALUE TESTS Each of the instruction takes one parameter - cell address in current register. 0101- IF: It checks if the value in cell at current cell pointer is equal to the value in the cell specified. If the values are equal, the flag register is set to 1. otherwise it is set to 0. 0110 - IFNOT: It checks if the value in cell at current cell pointer is NOT equal to the value in the cell specified. If the values are NOT equal, the flag register is set to 1. otherwise it is set to 0. 4.USER INPUT Every character other than 0-9] is ignored. Input is treated as a number. E.g. if a user inputs 18, when the program outputs this value it will output the letter 'G' (as stated in character table) 5. INSTRUCTIONS 1. 0000 - SOF - (Start Of File) every program has to start with this 2. 1111 - EOF - end of program file. 3. 0001 - INCREMENT - Increment value at current cell pointer by 1 4. 0010 - DECREMENT - Decrease value at current cell pointer by 1 5. 0100 [register] - SWITCH - Switches the register to specified. 6. 1001 - INCRCELLP - increases cell pointer 7. 1000 - DECRCELLP - decreases cell pointer 8. 0011 - OUTPUT - output value to screen 9. 0111 - INPUT - request user input 10. 1010 - STARTLOOP - start loop 11. 1110 - STARTSTAT - start statement 12. 1011 - ENDLS - end loop/statement 13. 0101 [cell B] - IF - Refer to part 3 of documentation. 14. 0110 [cell B] - IFNOT - Refer to part 3 of documentation. 15. 1101 [register] [cell] - COPY - Copies value from pointed cell to cell at current cell pointer 16. 1100 - CLR - clears cell at cell pointer 5a.INSTRUCTION PARAMETERS Some instructions can take parameters. For instance - 1101 - COPY. The first parameter is a register taken from register list (refer to part 1 of documentation) The second one is cell address in the register specified. It is formatted as a binary number ranging from 0-15. 6.EXAMPLE CODE a)This code displays user's input 10 times 0000 1001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 1000 0111 1001 1010 1000 0011 1001 0010 1011 1111 alternatively, for a word interpreter: SOF INCRCELLP INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT INCREMENT DECRCELLP INPUT INCRCELLP STARTLOOP DECRCELLP OUTPUT INCRCELLP DECREMENT ENDLS EOF b)Simple Hello world. 0000 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0011 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0011 0001 0001 0001 0001 0001 0001 0001 0011 0011 0001 0001 0001 0011 1100 0011 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0011 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0001 0011 0001 0001 0001 0011 0010 0010 0010 0010 0010 0010 0011 0010 0010 0010 0010 0010 0010 0010 0010 0011 1111