; Basic assembly to machine language converter ; ; bits 0-3 Address of next instruction ; bits 4-7 Data bits ; bits 8-9 Light register instruction bits ; bits 10-12 Accumulator instruction bits ; bit 13 Conditional Jump bit ; J C C C L L D D D D A A A A ; The simple assembly language provides a convenient interface with which to design programs for the small computer specified by Lab 1. It translates mnemonics to machine instructions that can be loaded into the program memory unit. Each line of the assembly source file translates into one machine instruction. Each instruction can specify the values of each of the following parameters: the address of the next instruction (using 'goto'), the data bits, the light register command, the accumulator command, and the value of the conditional jump bit. Note that the order in which commands are specifed on an instruction line does not matter. Comments begin with a semi-colon and extend to the end of the line. Specifying the next address: A 'goto' command on a line causes the program to jump to the specified instruction. The instructions are numbered starting at 0, so the command " goto.0 " jumps to the first instruction in the program. Since the program memory can hold only 16 instructions, the legal values for the addresses range from 0 to 15. If an instruction line doesn't have goto command, the default next address is the next instruction. Specifying the data value: Data values are specified in hexadecimal. Specifying the light register command: The 'lr' identifier specifies the light register, and the possible commands are listed below. Specifying the accumulator register command: The 'ac' identifier specifies the accumulator register, and the possible commands are listed below. Specifying the jump bit: Simply include the 'jmp' identifier on a line to set the conditional jump bit. For the data value, light, and accumulator register commands, if nothing is specified on an instruction line, the previous command is used. The defaults are indicated below also. ; Syntax of "assembly" language. Comments begin with ; ; Up to sixteen instruction lines can exist in a program. ; ; Light register instructions: ; ; default: Reload hold ; Load from instruction data loadins ; Load from accumulator output loadacc ; Inverse invert ; ; Accumulator Register instructions: ; ; default: Hold the same value hold ; Load from instruction register loadins ; Load from light register loadli ; Invert the bits invert ; Add one add1 ; Subtract one sub1 ; Shift left shiftl ; Shift right shiftr ; ; example program that does about nothing data.0x2 lr.loadacc ac.loadins jmp data.0x3 goto.0