Exemplo n.º 1
0
    private void processOrder0()
    {
        BCD10 b;

        if (accB > 0)
        {
            effectiveOperand.add(accumulators[accB]);
        }
        if (accA == 0)
        {
            accumulators[0].set(controlBoxScript.getKeyboard());
        }

        b = new BCD10(effectiveOperand);
        if (siriusOpcodeLow >= 5)
        {
            b.shiftLeft(4);
        }

        switch (siriusOpcodeLow)
        {
        case 0:
        case 5:
            accumulators[accA].add(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 1:
        case 6:
            accumulators[accA].sub(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 2:
        case 7:
            accumulators[accA].negSub(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 3:
        case 8:
            accumulators[accA].negAdd(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 4:
        case 9:
            accumulators[accA].set(b);
            break;
        }
    }
Exemplo n.º 2
0
    private void processOrder2()
    {
        BCD10 b;
        bool  wasNegative;

        if (accB > 0)
        {
            effectiveOperand.add(accumulators[accB]);
        }
        if (accA == 0)
        {
            accumulators[0].set(controlBoxScript.getKeyboard());
        }

        b = new BCD10(effectiveOperand);
        if (siriusOpcodeLow >= 5)
        {
            b.shiftLeft(4);
        }
        wasNegative = accumulators[accA].isNegative();

        flagOVR |= (accumulators[accA].digits[9] != 0 && accumulators[accA].digits[9] != 9);

        for (int i = 9; i > 0; i--)
        {
            accumulators[accA].digits[i] = accumulators[accA].digits[i - 1];
        }
        accumulators[accA].digits[0] = 0;

        flagOVR |= (wasNegative != accumulators[accA].isNegative());

        switch (siriusOpcodeLow)
        {
        case 0:
        case 5:
            accumulators[accA].add(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 1:
        case 6:
            accumulators[accA].sub(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 2:
        case 7:
            accumulators[accA].negSub(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 3:
        case 8:
            accumulators[accA].negAdd(b);
            flagOVR |= BCD10.flagOVR;
            break;

        case 4:
        case 9:
            accumulators[accA].digits[0] = b.digits[9];
            break;
        }
    }