= Survey Computer Science computer = a piece of shit 16 8-bit registers 8-bit address space 1RXY - LOAD rR, memory register rR = memory at address XY 2RXY - LOAD rR, constant register rR = constant XY 3RXY - STORE rR, memory memory at address XY = register rR 40RS - MOVE rS, rR register rS = register rR 5RST - ADD rR, rS, rT register rR = rS + rT 6RST - ADDF rR, rS, rT register rR = rS + rT, except they're really shitty 8-bit floating point numbers 7RST - OR rR, rS, rT register rR = rS | rT 8RST - AND rR, rS, rT register rR = rS & rT 9RST - XOR rR, rS, rT register rR = rS ^ rT AR0X - ROTATE rR, X register rR is rotated right X times BRXY - JUMP rR, address jump to address XY if rR == r0 C000 - HALT stop execution ------------------------------------------------------- = MARIE = a slightly less piece of shit 16-bit accumulator, AC 12-bit program counter, PC 0nnn - JnS address Stores program counter to location NNN. Set accumulator and program counter ot NNN+1. 1nnn - Load address AC = memory at address NNN 2nnn - Store address memory at address NNN = AC 3nnn - Add address AC += memory at address NNN 4nnn - Subt address AC -= memory at address NNN 5000 - Input Request a value from the user and put it in AC 6000 - Output Write AC to the output 7000 - Halt 8000 - Skipcond < Skip next opcode if AC < 0 8400 - Skipcond = Skip next opcode if AC == 0 8800 - Skipcond > Skip next opcode if AC > 0 9nnn - Jump address PC = NNN A000 - Clear AC = 0 BNNN - AddI address AC += memory accessed through pointer at address NNN CNNN - JumpI address PC = memory at address NNN DNNN - LoadI address AC = memory accessed through pointer at address NNN ENNN - StoreI address memory accessed through pointer at address NNN = AC ------------------------------------------------------- = CHIP-8 = a bit better but suffers from poor access to memory 12-bit program counter 16 8-bit registers V0 through VF 12-bit register I 16 stack levels 8-bit timer register, counts down at 60hz 8-bit sound register, counts down at 60hz, beeps while nonzero 64x32 monochrome display * marks SuperChip only opcodes 00CN - SCD lines * Scroll display N lines down 00E0 - CLS Clear the display 00EE - RET Return from subroutine 00FB - SCR * Scroll display 4 pixels right 00FC - SCL * Scroll display 4 pixels left 00FD - EXIT * Exit intereter 00FE - LOW * Disable extended screen mode 00FF - HIGH * Enable extended screen mode (128x64) 1NNN - JP address PC = address 2NNN - CALL address push old PC to stack PC = address 3xkk - SE Vx, byte Skip next opcode if Vx == byte 4xkk - SNE Vx, byte Skip next opcode if Vx != byte 5xy0 - SE Vx, Vy Skip next opcode if Vx == Vy 6xkk - LD Vx, byte Vx = byte 7xkk - ADD Vx, byte Vx += byte 8xy0 - LD Vx, Vy Vx = Vy 8xy1 - OR Vx, Vy Vx |= Vy 8xy2 - AND Vx, Vy Vx &= Vy 8xy3 - XOR Vx, Vy Vx ^= Vy 8xy4 - ADD Vx, Vy Vx += Vy VF = carry from this operation 8xy5 - SUB Vx, Vy Vx -= Vy 8x06 - SHR Vx Vx >>= 1 VF = carry 8x07 - SUBN Vx = Vy - Vx If Vy > Vx, VF = 1. Otherwise it's 0 8x0E - SHL Vx Vx <<= 1 VF = carry 9xy0 - SNE Vx, Vy Skip next opcode if Vx != Vy Annn - LD I, address I = address Bnnn - JP V0, address PC = address + V0 Cxkk - RND Vx, byte Vx = random()&byte DXYN - DRW Vx, Vy, size An 8 pixel wide sprite is drawn at position Vx and Vy, using XOR to change the pixels. Sprite graphics are at I, and are a given number of pixels tall VF = 1 if any pixels are turned off, or 0 if not DXY0 - DRW Vx, Vy, 0 In extended mode, draw a 16x16 sprite EX9E - SKP Vx Skip if key of value Vx is pressed EXA1 - SKNP Vx Skip if key of value Vx is not pressed FX07 - LD Vx, DT Vx = Delay timer FX0A - LD Vx, K Wait for key press, store its value into Vx FX15 - LD DT, Vx Delay timer = Vx FX18 - LD ST, Vx Sound timer = Vx FX1E - ADD I, Vx Vx += I FX29 - LD F, Vx I is set to a pointer to a hex digit sprite corresponding to Vx (5 rows tall) FX30 - LD F, Vx * I is set to a pointer to a decimal digit sprite corresponding to Vx (10 rows tall) FX33 - LD B, Vx Stores 3-digit BCD version of Vx at I (hundreds), I+1 (tens), I+2 (ones) FX55 - LD [I], Vx Stores registers V0 through Vx into memory at I through I+x FX65 - LD [I], Vx Loads memory at I through I+x into registers V0 through Vx ------------------------------------------------------- = Data General Nova = big endian four 16-bit accumulators (AC0, AC1, AC2, AC3) I/O 011AATTTCCDDDDDD AA = Which accumulator TTT = 000 NIO - no I/O transfer 001 DIA - data in from buffer A 010 DOA - data out to buffer A 011 DIB - data in from buffer B 100 DOB - data out to buffer B 101 DIC - data in from buffer C 110 DOC - data out to buffer C 111 SKP - skip on condition CC (if not SKP) send a control signal to device = 00 issue no commands 01 (S) set busy flag, clear done flag 10 (C) clear both busy and done flag 11 (P) issue a pulse to device (if SKP) = 00 (SKPBN) skip if busy flipflop is nonzero 01 (SKPBZ) skip if busy flipflop is zero 10 (SKPDN) skip if done flipflop is nonzero 11 (SKPDZ) skip if done flipflop is zero Memory access (without accumulator) 000FFINNDDDDDDDD FF = 00 JMP to effective address 01 JSR (store PC in AC, set PC to effective address) 10 ISZ - increment memory address, skip if zero 11 DSZ - decrement memory address, skip if zero NN = 00 D is a zeropage address 01 PC relative 10 index with AC2 11 index with AC3 I = use address as a pointer if 1 D = displacement Memory address (with accumulator) 0FFAAINNDDDDDDDD FF = 01 LDA - load accumulator 10 STA - store accumulator ALU opcodes 1SSDDFFFRRCCNTTT SS = source accumulator DD = destination accumulator FFF = 000 COM, destination = ~source 001 NEG, destination = -source 010 MOV, destination = source 011 INC, destination = source + 1 100 ADC, destination = destination + source, 1's complement 101 SUB, destination = destination - source 110 ADD, destination = destination + source 111 AND, destination = destination & source RR = 00 no shifting 01 L, rotate result of function left 1 bit, including carry 10 R, rotate result of function right 1 bit, including carry 11 S, swap the two bytes in the word CC = 00 don't change carry before function 01 Z, force carry to zero before function 10 O, force carry to one before function 11 C, complement carry before function N = if 1, don't actually change destination register TTT = 000 never skip 001 SKP, skip unconditionally 010 SZC, skip if carry zero 011 SNC, skip if carry nonzero 100 SZR, skip if result of function is zero 101 SNR, skip if result of function is nonzero 110 SEZ, skip if either carry or result are zero 111 SBN, skip if both carry and result are nonzero Macros: IORST - IO reset HALT - halt the processor READS - read switches on the machine INTEN - interrupt enable INTDS - interrupt disable MSKO - interrupt mask out INTA - interrupt acknowledge Special addresses: 16-23 - When used as a pointer, auto post-increment 24-31 - When used as a pointer, auto pre-decrement 0 - Return address for interrupts 1 - Interrupt handler address