コード例 #1
0
        private void InitialiseOperations()
        {
            var ops = new Ops(this);

            // 0x00 - NOP
            Operations.Add(0x00, ops.NOP());

            // 0x01 - LD BC,nn
            Operations.Add(0x01, ops.LD_16(Register16BitNames.BC));

            // 0x02 - LD (BC), A
            Operations.Add(0x02, ops.LD_8(Register8BitNames.A, Register16BitNames.BC));

            // 0x04 - INC B
            Operations.Add(0x04, ops.INC_8(Register8BitNames.B));

            // 0x05 - DEC B
            Operations.Add(0x05, ops.DEC_8(Register8BitNames.B));

            // 0x06 - LD B,n
            Operations.Add(0x06, ops.LD_8(Register8BitNames.B));

            // 0x07 RLCA
            Operations.Add(0x07, ops.RLCA());

            // 0x08 LD (nn), SP
            Operations.Add(0x08, ops.LD_16_SP());

            // 0x09 - ADD HL,BC
            Operations.Add(0x09, ops.ADD_16(Register16BitNames.BC));

            // 0x02 - LD (DE), A
            Operations.Add(0x12, ops.LD_8(Register8BitNames.A, Register16BitNames.DE));

            // 0x0B - DEC BC
            Operations.Add(0x0B, ops.DEC_16(Register16BitNames.BC));

            // 0x0C - INC C
            Operations.Add(0x0C, ops.INC_8(Register8BitNames.C));

            // 0x0D - DEC C
            Operations.Add(0x0D, ops.DEC_8(Register8BitNames.C));

            // 0x0E - LD C,n
            Operations.Add(0x0E, ops.LD_8(Register8BitNames.C));

            // 0x11 - LD DE,nn
            Operations.Add(0x11, ops.LD_16(Register16BitNames.DE));

            // 0x14 - INC D
            Operations.Add(0x14, ops.INC_8(Register8BitNames.D));

            // 0x15 - DEC D
            Operations.Add(0x15, ops.DEC_8(Register8BitNames.D));

            // 0x16 - LD D,n
            Operations.Add(0x16, ops.LD_8(Register8BitNames.D));

            // 0x19 - ADD HL,DE
            Operations.Add(0x19, ops.ADD_16(Register16BitNames.DE));

            // 0x1B - DEC DE
            Operations.Add(0x1B, ops.DEC_16(Register16BitNames.DE));

            // 0x1C - INC E
            Operations.Add(0x1C, ops.INC_8(Register8BitNames.E));

            // 0x1D - DEC E
            Operations.Add(0x1D, ops.DEC_8(Register8BitNames.E));

            // 0x1E - LD E,n
            Operations.Add(0x1E, ops.LD_8(Register8BitNames.E));

            // 0x1F - RRA
            Operations.Add(0x1F, ops.RRA());

            // 0x20 - JR NZ,n
            Operations.Add(0x20, ops.JR(JRFlags.NZ));

            // 0x21 - LD HL,nn
            Operations.Add(0x21, ops.LD_16(Register16BitNames.HL));

            // 0x24 - INC H
            Operations.Add(0x24, ops.INC_8(Register8BitNames.H));

            // 0x25 - DEC H
            Operations.Add(0x25, ops.DEC_8(Register8BitNames.H));

            // 0x26 - LD H,n
            Operations.Add(0x26, ops.LD_8(Register8BitNames.H));

            // 0x28 - JR Z,n
            Operations.Add(0x28, ops.JR(JRFlags.Z));

            // 0x29 - ADD HL,HL
            Operations.Add(0x29, ops.ADD_16(Register16BitNames.HL));

            // 0x2A - LDI (HL),A
            Operations.Add(0x2A, ops.LDI(Register8BitNames.A, Register16BitNames.HL));

            // 0x2B - DEC HL
            Operations.Add(0x2B, ops.DEC_16(Register16BitNames.HL));

            // 0x2C - INC L
            Operations.Add(0x2C, ops.INC_8(Register8BitNames.L));

            // 0x2D - DEC L
            Operations.Add(0x2D, ops.DEC_8(Register8BitNames.L));

            // 0x2E - LD H,n
            Operations.Add(0x2E, ops.LD_8(Register8BitNames.L));

            // 0x2F - CPL
            Operations.Add(0x2F, ops.CPL());

            // 0x30 - JR NC,n
            Operations.Add(0x30, ops.JR(JRFlags.NC));

            // 0x31 - LD SP,nn
            Operations.Add(0x31, ops.LD_16(Register16BitNames.SP));

            // 0x32 - LDD (HL),A
            Operations.Add(0x32, ops.LDD(Register8BitNames.A, Register16BitNames.HL));

            // 0x35 - DEC A
            Operations.Add(0x35, ops.DEC_8(Register8BitNames.A));

            // 0x36 - LD HL,n
            Operations.Add(0x36, ops.LD_8(Register16BitNames.HL));

            // 0x38 - JR C,n
            Operations.Add(0x38, ops.JR(JRFlags.C));

            // 0x39 - ADD HL,SP
            Operations.Add(0x39, ops.ADD_16(Register16BitNames.SP));

            // 0x3B - DEC SP
            Operations.Add(0x3B, ops.DEC_16(Register16BitNames.SP));

            // 0x3C - INC A
            Operations.Add(0x3C, ops.INC_8(Register8BitNames.A));

            // 0x3E - LD A,n
            Operations.Add(0x3E, ops.LD_8(Register8BitNames.A));

            // 0x70 - LD (HL), B
            Operations.Add(0x70, ops.LD_8(Register8BitNames.B, Register16BitNames.HL));

            // 0x71 - LD (HL), C
            Operations.Add(0x71, ops.LD_8(Register8BitNames.C, Register16BitNames.HL));

            // 0x72 - LD (HL), D
            Operations.Add(0x72, ops.LD_8(Register8BitNames.D, Register16BitNames.HL));

            // 0x73 - LD (HL), E
            Operations.Add(0x73, ops.LD_8(Register8BitNames.E, Register16BitNames.HL));

            // 0x74 - LD (HL), H
            Operations.Add(0x74, ops.LD_8(Register8BitNames.H, Register16BitNames.HL));

            // 0x75 - LD (HL), L
            Operations.Add(0x75, ops.LD_8(Register8BitNames.L, Register16BitNames.HL));

            // 0x77 - LD (HL), A
            Operations.Add(0x77, ops.LD_8(Register8BitNames.A, Register16BitNames.HL));

            // 0x78 - LD A, B
            Operations.Add(0x78, ops.LD_8(Register8BitNames.B, Register8BitNames.A));

            // 0x79 - LD A, C
            Operations.Add(0x79, ops.LD_8(Register8BitNames.C, Register8BitNames.A));

            // 0x7A - LD A, D
            Operations.Add(0x7A, ops.LD_8(Register8BitNames.D, Register8BitNames.A));

            // 0x7B - LD A, E
            Operations.Add(0x7B, ops.LD_8(Register8BitNames.E, Register8BitNames.A));

            // 0x7C - LD A, H
            Operations.Add(0x7C, ops.LD_8(Register8BitNames.H, Register8BitNames.A));

            // 0x7D - LD A, L
            Operations.Add(0x7D, ops.LD_8(Register8BitNames.L, Register8BitNames.A));

            // 0x7F - LD A, A
            Operations.Add(0x7F, ops.LD_8(Register8BitNames.A, Register8BitNames.A));

            // 0xA0 - AND B
            Operations.Add(0xA0, ops.AND_8(Register8BitNames.B));

            // 0xA1 - AND C
            Operations.Add(0xA1, ops.AND_8(Register8BitNames.C));

            // 0xA2 - AND D
            Operations.Add(0xA2, ops.AND_8(Register8BitNames.D));

            // 0xA3 - AND E
            Operations.Add(0xA3, ops.AND_8(Register8BitNames.E));

            // 0xA4 - AND H
            Operations.Add(0xA4, ops.AND_8(Register8BitNames.H));

            // 0xA5 - AND L
            Operations.Add(0xA5, ops.AND_8(Register8BitNames.L));

            // 0xA7 - AND A
            Operations.Add(0xA7, ops.AND_8(Register8BitNames.A));

            // 0xA8 - XOR B
            Operations.Add(0xA8, ops.XOR_8(Register8BitNames.B));

            // 0xA9 - XOR C
            Operations.Add(0xA9, ops.XOR_8(Register8BitNames.C));

            // 0xAA - XOR D
            Operations.Add(0xAA, ops.XOR_8(Register8BitNames.D));

            // 0xAB - XOR E
            Operations.Add(0xAB, ops.XOR_8(Register8BitNames.E));

            // 0xAC - XOR H
            Operations.Add(0xAC, ops.XOR_8(Register8BitNames.H));

            // 0xAD - XOR L
            Operations.Add(0xAD, ops.XOR_8(Register8BitNames.L));

            // 0xAF - XOR A
            Operations.Add(0xAF, ops.XOR_8(Register8BitNames.A));

            // 0xB0 - OR B
            Operations.Add(0xB0, ops.OR_8(Register8BitNames.B));

            // 0xB1 - OR C
            Operations.Add(0xB1, ops.OR_8(Register8BitNames.C));

            // 0xB2 - OR D
            Operations.Add(0xB2, ops.OR_8(Register8BitNames.D));

            // 0xB3 - OR E
            Operations.Add(0xB3, ops.OR_8(Register8BitNames.E));

            // 0xB4 - OR H
            Operations.Add(0xB4, ops.OR_8(Register8BitNames.H));

            // 0xB5 - OR L
            Operations.Add(0xB5, ops.OR_8(Register8BitNames.L));

            // 0xB7 - OR A
            Operations.Add(0xB7, ops.OR_8(Register8BitNames.A));

            // 0xB8 - CP B
            Operations.Add(0xB8, ops.CP(Register8BitNames.B));

            // 0xB9 - CP C
            Operations.Add(0xB9, ops.CP(Register8BitNames.C));

            // 0xBA - CP D
            Operations.Add(0xBA, ops.CP(Register8BitNames.D));

            // 0xBB - CP E
            Operations.Add(0xBB, ops.CP(Register8BitNames.E));

            // 0xBC - CP H
            Operations.Add(0xBC, ops.CP(Register8BitNames.H));

            // 0xBD - CP L
            Operations.Add(0xBD, ops.CP(Register8BitNames.L));

            // 0xBF - CP A
            Operations.Add(0xBF, ops.CP(Register8BitNames.A));

            // 0xC2 - JP NZ,nn
            Operations.Add(0xC2, ops.JP_cc_nn(JRFlags.NZ));

            // 0xC3 - JP, nn
            Operations.Add(0xC3, ops.JP_nn());

            // 0xC9 - RET
            Operations.Add(0xC9, ops.RET());

            // 0xCA - JP Z,nn
            Operations.Add(0xCA, ops.JP_cc_nn(JRFlags.Z));

            // 0xCD - CALL nn
            Operations.Add(0xCD, ops.CALL());

            // 0xD2 - JP NC,nn
            Operations.Add(0xD2, ops.JP_cc_nn(JRFlags.NC));

            // 0xDA - JP C,nn
            Operations.Add(0xDA, ops.JP_cc_nn(JRFlags.C));

            // 0xE0 - LDH (n),A
            Operations.Add(0xE0, ops.LDH_n_A());

            // 0xE2 - LD (0xFF00+C),A
            Operations.Add(0xE2, ops.LD_C_FF00_A());

            // 0xE6 - AND n
            Operations.Add(0xE6, ops.AND_8());

            // 0xEA - LD (nn),A
            Operations.Add(0xEA, ops.LD_8());

            // 0xF0 - LDH A,(n)
            Operations.Add(0xF0, ops.LDH_A_n());

            // 0xF3 - DI
            Operations.Add(0xF3, ops.DI());

            // 0xFB - EI
            Operations.Add(0xFB, ops.EI());

            // 0xFE - CP
            Operations.Add(0xFE, ops.CP());
        }