Esempio n. 1
0
        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;
        }
Esempio n. 2
0
        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;
        }
Esempio n. 3
0
        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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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;
        }
Esempio n. 6
0
        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;
            }
        }
Esempio n. 7
0
        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;
            }
        }
Esempio n. 8
0
        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;
            }
        }
Esempio n. 9
0
        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;
            }
        }