Example #1
0
        static (Op, Mode[]) DeconstructInstructionCode(int code)
        {
            int mode_flags = code / 100;
            Op  operation  = (Op)(code - mode_flags * 100);
            var modes      = new Mode[operation.ParamCount()];

            for (int i = 0; i < modes.Length; i++)
            {
                modes[i]    = (Mode)(mode_flags & 1);
                mode_flags /= 10;
            }

            foreach (var force_immediate in operation.AssignmentParams())
            {
                modes[force_immediate] = Mode.Immediate;
            }

            return(operation, modes);
        }