Exemplo n.º 1
0
 public void setNumber(BCD10 b)
 {
     if (!b.isEqual(lastDisplayed))
     {
         for (int i = 0; i < 10; i++)
         {
             nixies[9 - i].setNumber(b.digits[i]);
         }
     }
     lastDisplayed.set(b);
 }
Exemplo n.º 2
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;
        }
    }
Exemplo n.º 3
0
    private void processOrder3()
    {
        BCD10 b           = new BCD10();
        bool  wasNegative = accumulators[accA].isNegative();
        bool  shiftOVR;
        byte  msdB;

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

        if (siriusOpcodeLow < 5)
        {
            if (accB > 0)
            {
                effectiveOperand.add(accumulators[accB]);
            }
            b.setHex64(getMainStore(effectiveOperand.toUInt64()));
            if (accA == 0)
            {
                accumulators[0].set(controlBoxScript.getKeyboard());
            }
            flagOVR |= shiftOVR | (wasNegative != accumulators[accA].isNegative());
        }
        else
        {
            if (accB == 0)
            {
                b.set(controlBoxScript.getKeyboard());
            }
            else
            {
                b.set(accumulators[accB]);
            }
        }

        msdB = b.msd(); // in case accA = accB ...

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

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

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

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

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

        case 4:
            accumulators[accA].digits[0] = msdB;
            break;

        case 5:
            accumulators[accA].add(b);
            break;

        case 6:
            accumulators[accA].sub(b);
            break;

        case 7:
            accumulators[accA].negSub(b);
            break;

        case 8:
            accumulators[accA].negAdd(b);
            break;

        case 9:
            accumulators[accA].digits[0] = msdB;
            break;
        }
    }
Exemplo n.º 4
0
    private void processOrder1()
    {
        BCD10 b = new BCD10();

        if (siriusOpcodeLow < 5)
        {
            if (accB > 0)
            {
                effectiveOperand.add(accumulators[accB]);
            }
            b.setHex64(getMainStore(effectiveOperand.toUInt64()));
            if (accA == 0)
            {
                accumulators[0].set(controlBoxScript.getKeyboard());
            }
        }
        else
        {
            if (accB == 0)
            {
                b.set(controlBoxScript.getKeyboard());
            }
            else
            {
                b.set(accumulators[accB]);
            }
        }

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

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

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

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

        case 4:
            accumulators[accA].set(b);
            break;

        case 5:
            accumulators[accA].add(b);
            break;

        case 6:
            accumulators[accA].sub(b);
            break;

        case 7:
            accumulators[accA].negSub(b);
            break;

        case 8:
            accumulators[accA].negAdd(b);
            break;

        case 9:
            accumulators[accA].set(b);
            break;
        }
    }
Exemplo n.º 5
0
    public void processOneOrder()
    {
        if (isPrimaryInput)
        {
            if (!isWaitingR)
            {
                currentOrder.setHex64(primaryInputMicroProgram[primaryInputPC]);
                primaryInputPC = primaryInputPC + 1;
            }
        }
        else
        {
            if (manualPressed)
            {
                if (!isRetrying)
                {
                    if (flagInputAccepted)
                    {
                        flagInputAccepted = false;
                        currentOrder.set(acceptedInput);
                    }
                    else
                    {
                        currentOrder.set(controlBoxScript.getKeyboard());
                    }
                }
            }
            else
            {
                if (!isRetrying)
                {
                    currentOrder.setHex64(getMainStore(accumulators[controlRegister].toUInt64()));
                    if (kbWaitPressed &&
                        accumulators[controlRegister].toUInt64() % mainStoreModulus == kbValue.toUInt64() % mainStoreModulus)
                    {
                        isStoppedKB = true;
                    }
                    accumulators[controlRegister].add(new BCD10(1)); // OK?
                }
            }
        }

        accB             = currentOrder.digits[0];
        accA             = currentOrder.digits[1];
        siriusOpcodeLow  = currentOrder.digits[2];
        siriusOpcodeHigh = currentOrder.digits[3];
        siriusOperand.setUInt32((UInt32)(currentOrder.toUInt64() / 10000L));
        effectiveOperand.setBCD6(siriusOperand);

        addCycles(3 * cycleFactor);
        switch (siriusOpcodeHigh)
        {
        case 0:
            processOrder0();
            break;

        case 1:
            processOrder1();
            break;

        case 2:
            processOrder2();
            break;

        case 3:
            processOrder3();
            break;

        case 4:
            processOrder4();
            break;

        case 5:
            processOrder5();
            break;

        case 6:
            processOrder6();
            break;

        case 7:
            processOrder7();
            break;

        case 8:
            processOrder8();
            break;

        case 9:
            processOrder9();
            break;

        default:
            break;
        }

        isRetryingForFrame &= isRetrying;
    }