private static void STA_ZP(CPU cpu, MEM memory) { byte data1 = memory.getMem((ushort)(cpu.PC + 0x0001)); byte data2 = memory.getMem((ushort)(cpu.PC + 0x0002)); memory.setMem(data1, data2, cpu.A); cpu.PC += 3; }
private static void JMP_ABS(CPU cpu, MEM memory) { byte data1 = memory.getMem((ushort)(cpu.PC + 0x0001)); byte data2 = memory.getMem((ushort)(cpu.PC + 0x0002)); cpu.PC = (ushort)(data1 << 8); cpu.PC += data2; }
private static void INC_ZP(CPU cpu, MEM memory) { byte data1 = memory.getMem((ushort)(cpu.PC + 0x0001)); byte data2 = memory.getMem((ushort)(cpu.PC + 0x0002)); byte x = memory.getMem(data1, data2); x++; memory.setMem(data1, data2, x); cpu.Z = (x == 0x00); cpu.N = (x & 0x80) == 0x80; cpu.PC += 3; }
private static void JMP_INDIRECT(CPU cpu, MEM memory) { byte data1 = memory.getMem((ushort)(cpu.PC + 0x0001)); byte data2 = memory.getMem((ushort)(cpu.PC + 0x0002)); ushort address = (ushort)(data1 << 8); address += data2; byte jumpToH = memory.getMem(address); byte jumpToL = memory.getMem((ushort)(address + 0x0001)); cpu.PC = (ushort)(jumpToH << 8); cpu.PC += jumpToL; }
private static void LDA_IM(CPU cpu, MEM memory) { byte data1 = memory.getMem((ushort)(cpu.PC + 0x0001)); cpu.A = data1; cpu.Z = (data1 == 0x00); cpu.N = (data1 & 0x80) == 0x80; cpu.PC += 0x02; }
public static void execute(CPU cpu, MEM memory) { switch (memory.getMem(cpu.PC)) { case 0x4C: JMP.JMP_ABS(cpu, memory); return; case 0x6C: JMP.JMP_INDIRECT(cpu, memory); return; } }
public static void execute(CPU cpu, MEM memory) { switch (memory.getMem(cpu.PC)) { case 0xE6: case 0xEE: INC.INC_ZP(cpu, memory); return; case 0xF6: case 0xFE: return; } }
public static void execute(CPU cpu, MEM memory) { switch (memory.getMem(cpu.PC)) { case 0x85: STA.STA_ZP(cpu, memory); return; case 0x95: case 0x8D: case 0x9D: case 0x99: case 0x81: case 0x91: return; } }
public static void execute(CPU cpu, MEM memory) { switch (memory.getMem(cpu.PC)) { case 0xA9: LDA.LDA_IM(cpu, memory); return; case 0xA5: case 0xB5: case 0xAD: case 0xBD: case 0xB9: case 0xA1: case 0xB1: return; } }