예제 #1
0
    public void negSub(BCD10 b)
    {
        int  c           = 0;
        bool wasNegative = isNegative();

        for (int i = 0; i < DIGITS; i++)
        {
            int n = 20 - digits[i] - b.digits[i] - c;
            c         = 2 - n / 10;
            digits[i] = (byte)(n % 10);
        }
        flagOVR = ((!wasNegative && !b.isNegative() && !isNegative()) ||
                   (wasNegative && b.isNegative() && isNegative()));
    }
예제 #2
0
    public void add(BCD10 b)
    {
        int  c           = 0;
        bool wasNegative = isNegative();

        for (int i = 0; i < DIGITS; i++)
        {
            int n = digits[i] + b.digits[i] + c;
            c         = n / 10;
            digits[i] = (byte)(n % 10);
        }
        flagOVR = ((wasNegative && b.isNegative() && !isNegative()) ||
                   (!wasNegative && !b.isNegative() && isNegative()));
    }
예제 #3
0
    private void processOrder5()
    {
        BCD10 a = new BCD10();

        if (accA == 0)
        {
            a.set(controlBoxScript.getKeyboard());
        }
        else
        {
            a.set(accumulators[accA]);
        }

        if (accB > 0)
        {
            effectiveOperand.add(accumulators[accB]);
        }

        switch (siriusOpcodeLow)
        {
        case 0:     // DUMMY
            break;

        case 1:
            if (a.msd() != 0)
            {
                setPC(effectiveOperand);
            }
            break;

        case 2:
            if (!a.isZero())
            {
                setPC(effectiveOperand);
            }
            break;

        case 3:
            if (flagOVR)
            {
                setPC(effectiveOperand);
            }
            flagOVR = false;
            break;

        case 4:
            if (a.isNegative())
            {
                setPC(effectiveOperand);
            }
            break;

        case 5:
            setPC(effectiveOperand);
            break;

        case 6:
            if (a.msd() == 0)
            {
                setPC(effectiveOperand);
            }
            break;

        case 7:
            if (a.isZero())
            {
                setPC(effectiveOperand);
            }
            break;

        case 8:
            if (!flagOVR)
            {
                setPC(effectiveOperand);
            }
            flagOVR = false;
            break;

        case 9:
            if (!a.isNegative())
            {
                setPC(effectiveOperand);
            }
            break;
        }
    }