示例#1
0
        public static uint MSE(uint unit) /* minus sense */
        {
            uint skip        = 0;
            uint CurrUnit    = unit >> 4;
            uint CurrSubUnit = unit & 0xF;

            switch (CurrUnit)
            {
            case 6:     /* Sense Lights */
                if (CurrSubUnit >= 1 && CurrSubUnit <= 4)
                {
                    skip = SenseLights.SLT(CurrSubUnit);
                }
                else
                {
                    throw new InvalidOperationException("invalid Sense Light");
                }
                break;

            default:
                throw new InvalidOperationException("invalid device for MSE");
            }
            return(skip);
        }
示例#2
0
        public static uint PSE(uint unit) /* plus sense */
        {
            uint skip        = 0;
            uint CurrUnit    = unit >> 4;
            uint CurrSubUnit = unit & 0xF;

            switch (CurrUnit)
            {
            case 6:     /* Sense Lights */
                if (CurrSubUnit == 0)
                {
                    SenseLights.SLF();
                }
                else if (CurrSubUnit >= 1 && CurrSubUnit <= 4)
                {
                    SenseLights.SLN(CurrSubUnit);
                }
                else
                {
                    throw new InvalidOperationException("invalid Sense Light");
                }
                break;

            case 7:     /* Sense Switches */
                if (CurrSubUnit >= 1 && CurrSubUnit <= 6)
                {
                    skip = SenseSwitches.SWT(CurrSubUnit);
                }
                else
                {
                    throw new InvalidOperationException("invalid Sense Switch");
                }
                break;

            case 14:     /* Punch */
                if (CPU != null && CurrSubUnit >= 1 && CurrSubUnit <= 2)
                {
                    CPU.SPU(CurrSubUnit);
                }
                else
                {
                    throw new InvalidOperationException("invalid Punch Sense");
                }
                break;

            case 15:     /* Printer */
                if (LP != null && CurrSubUnit == 0)
                {
                    skip = LP.SPT();
                }
                else if (LP != null && CurrSubUnit >= 1 && CurrSubUnit <= 10)
                {
                    LP.SPR(CurrSubUnit);
                }
                else
                {
                    throw new InvalidOperationException("invalid Printer Sense");
                }
                break;

            default:
                throw new InvalidOperationException("invalid device for PSE");
            }
            return(skip);
        }