// Check if it's a math function if ((IR & 0x80) == 0x80) { // Grab the destination and source values int destination, source, address; switch(IR & 0x0c) // Isolate destination id { case 0x0: destination = memory[MAR]; break; case 0x4: destination = ACC; break; case 0x8: destination = MAR; break; case 0xc: destination = memory[((memory[Old_PC + 1] << 8) + memory[Old_PC + 2])]; break; } switch(IR & 0x03) // Isolate destination id { case 0x0: source = memory[MAR]; break; case 0x1: source = ACC; break; case 0x2: // If 8 bits, do this: INSERT YOUR CODE HERE!!!! source = memory[Old_PC + 1]; // else if 16 bits, do this: INSERT YOUR CODE HERE!!!! source = (memory[Old_PC + 1] << 8) + memory[Old_PC + 2]; break; case 0x3: // If 8 bits, do this: INSERT YOUR CODE HERE!!!! source = memory[((memory[Old_PC + 1] << 8) + memory[Old_PC + 2])]; // else if 16 bits, do this: INSERT YOUR CODE HERE!!!! address = ((memory[Old_PC + 1] << 8) + memory[Old_PC + 2]); source = (memory[address] << 8) + memory[address + 1]; break; } // Process the operation switch (IR&0x70) { case 0x00: // AND function destination &= source; break; case 0x10: case 0x20: case 0x30: case 0x40: case 0x50: case 0x60: case 0x70: default: } // Store destination // If 8 bits, do this: INSERT YOUR CODE HERE!!!! destination & = 0xff; // else if 16 bits, do this: INSERT YOUR CODE HERE!!!! destination & = 0xffff; } // Check if this is a memory function else if ((IR & 0xf0) == 0) { } // Check branch function else if ((IR & 0xF8) == 0x10) { } // Otherwise, it's a special opcode or an illegal opcode else { } Within