MSB first, unlike x86 32 registers, r0 is always 0, r31 is initialized to -1 (all others are initialized to 0) addi reg, reg, int16 000000rr rrrRRRRR iiiiiiii iiiiiiii subi reg, reg, int16 000001rr rrrRRRRR iiiiiiii iiiiiiii muli reg, reg, int16 000010rr rrrRRRRR iiiiiiii iiiiiiii divi reg, reg, int16 000011rr rrrRRRRR iiiiiiii iiiiiiii andi reg, reg, int16 000100rr rrrRRRRR iiiiiiii iiiiiiii ori reg, reg, int16 000101rr rrrRRRRR iiiiiiii iiiiiiii xori reg, reg, int16 000110rr rrrRRRRR iiiiiiii iiiiiiii shli reg, reg, int16 000111rr rrrRRRRR iiiiiiii iiiiiiii shri reg, reg, int16 001000rr rrrRRRRR iiiiiiii iiiiiiii lessthani reg, reg, int16 001001rr rrrRRRRR iiiiiiii iiiiiiii equaltoi reg, reg, int16 001010rr rrrRRRRR iiiiiiii iiiiiiii ldi reg, reg, int16 001011rr rrrRRRRR iiiiiiii iiiiiiii sti reg, reg, int16 001100rr rrrRRRRR iiiiiiii iiiiiiii Add an 'e' and set the top bit to extend int16 with 1s instead of 0s. add reg, reg, reg sub reg, reg, reg mul reg, reg, reg div reg, reg, reg and reg, reg, reg or reg, reg, reg xor reg, reg, reg shl reg, reg, reg shr reg, reg, reg lessthan reg, reg, reg equalto reg, reg, reg ld reg, reg, reg st reg, reg, reg ^-- these have the second-to-top bit set to indicate that iiiiiiii iiiiiiii should be treated as a register number instead division stores the quotient in the low 16 bits of the register and the remainder in the top 16 bits (so to get just the quotient, "andi rN, rN, -1", and to get just the remainder, "shri rN, rN, 16") pred reg, reg 001111rr rrrRRRRR If the first register is nonzero, run the next instruction. If the first register is zero, then if the second register is zero, run the next instruction. Otherwise, skip the next instruction. branchi reg, int16 001101rr rrr----- iiiiiiii iiiiiiii Branches to the memory address computed by adding the register to the int16 and truncating to 16 bits. The address of the instruction following the 'branchi' is stored in r31. systemi int16 001110-- -------- iiiiiiii iiiiiiii System calls :-) systemi 1 - ends the program systemi 2 - outputs the integer value in r1 systemi 3 - inputs an integer value into r1 systemi 4 - outputs the character value in r1 (e.g. 'A' if r1 = 65) systemi 5 - outputs a newline systemi 6 - outputs the string pointed at by r1 (null-terminated) system r7 - runs the system command specified in r7 data 'this is a non-terminated string', "this is a null-terminated string", 65, 66, 67 emits: "this is a non-terminated stringthis is a null-terminated string\0ABC"