Exemple #1
0
		public static void GenerateOpcodeSizes()
		{
			Disassembler disasm = new Disassembler();

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[0,i] = (sbyte)pc;
			}

			opcodeSizes[0, 0xCB] = -1;
			opcodeSizes[0, 0xED] = -2;
			opcodeSizes[0, 0xDD] = -3;
			opcodeSizes[0, 0xFD] = -4;

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xCB, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[1, i] = (sbyte)pc;
			}

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xED, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[2, i] = (sbyte)pc;
			}

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xDD, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[3, i] = (sbyte)pc;
			}

			opcodeSizes[3, 0xCB] = -5;
			opcodeSizes[3, 0xED] = -2;

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xFD, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[4, i] = (sbyte)pc;
			}

			opcodeSizes[3, 0xCB] = -6;
			opcodeSizes[3, 0xED] = -2;


			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xDD, 0xCB, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[5, i] = (sbyte)pc;
			}

			for (int i = 0; i < 256; i++)
			{
				int pc = 0;
				byte[] opcode = { 0xFD, 0xCB, (byte)i, 0, 0, 0 };
				disasm.Disassemble(() => opcode[pc++]);
				opcodeSizes[6, i] = (sbyte)pc;
			}
		}
Exemple #2
0
        public static void GenerateOpcodeSizes()
        {
            Disassembler disasm = new Disassembler();

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[0, i] = (sbyte)pc;
            }

            opcodeSizes[0, 0xCB] = -1;
            opcodeSizes[0, 0xED] = -2;
            opcodeSizes[0, 0xDD] = -3;
            opcodeSizes[0, 0xFD] = -4;

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xCB, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[1, i] = (sbyte)pc;
            }

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xED, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[2, i] = (sbyte)pc;
            }

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xDD, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[3, i] = (sbyte)pc;
            }

            opcodeSizes[3, 0xCB] = -5;
            opcodeSizes[3, 0xED] = -2;

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xFD, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[4, i] = (sbyte)pc;
            }

            opcodeSizes[3, 0xCB] = -6;
            opcodeSizes[3, 0xED] = -2;


            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xDD, 0xCB, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[5, i] = (sbyte)pc;
            }

            for (int i = 0; i < 256; i++)
            {
                int    pc     = 0;
                byte[] opcode = { 0xFD, 0xCB, (byte)i, 0, 0, 0 };
                disasm.Disassemble(() => opcode[pc++]);
                opcodeSizes[6, i] = (sbyte)pc;
            }
        }