Esempio n. 1
0
bool Crlh1000::run() {

    // 0x5802 : Shift 0x80   ???
    // 0x5820 : 2nd 0x80     ???
    // timercnt = timer (1/256 sec)


    //TODO: change this !!!
    if (dialogdasm)
        dialogdasm->imem=false;

#ifndef QT_NO_DEBUG
//    if (pCPU->get_PC()==0xc854) m6502->set_PC(0xc856);
#endif

    Get_Connector();
    if (bus->getINT()) {
//        qWarning()<<"INT RECEIVED FROM BUS";
        m6502->write_signal(101,1,1);
        bus->setINT(false);
    }
    Set_Connector();

     CpcXXXX::run();



    if (pKEYB->LastKey>0) { m6502->write_signal(101,1,1); }

    if (pTIMER->usElapsedId(1)>=4096) {
//        if (timercnt1!=0)
        {
            timercnt1--;
            if ((timercnt1==0)&&(timercnt2==0)&&(timercnt3==0)) {
                m6502->write_signal(101,1,1);
                if (pCPU->fp_log) fprintf(pCPU->fp_log,"\n READ ROM KBD TIMER\n");
            }
            if (timercnt1==0xff) {
                m6502->write_signal(101,1,1);
                AddLog(LOG_CONSOLE,"INTERRUPT\n");
                timercnt2--;
                if (timercnt2==0xff) {
                    timercnt3--;
                }
            }
        }
        pTIMER->resetTimer(1);
    }

    Set_Connector();
    return true;
}
Esempio n. 2
0
bool Cpc2021::run(void)
{

    Get_Connector();

#if 1
// Try to introduce a latency
    quint64	deltastate = 0;

    if (run_oldstate == -1) run_oldstate = pTIMER->state;
    deltastate = pTIMER->state - run_oldstate;
    if (deltastate < PC2021LATENCY ) return true;
    run_oldstate	= pTIMER->state;
#endif

    quint8 c = pCONNECTOR->Get_values();

    if (c>0)
    {
        AddLog(LOG_PRINTER,QString("Recieve:%1 = (%2)").arg(c,2,16,QChar('0')).arg(QChar(c)));
        SET_PIN(9,1);
        Printer(c);
    }

    pCONNECTOR_value = pCONNECTOR->Get_values();




    Set_Connector();

    return true;
}
Esempio n. 3
0
bool Cmd100::run(void)
{
    Get_Connector();

    pCONNECTOR_value = pCONNECTOR->Get_values();
    pCENTCONNECTOR_value = pCENTCONNECTOR->Get_values();
    pSIOCONNECTOR_value = pSIOCONNECTOR->Get_values();

    bool P4_GoDown = ( ( P4 == DOWN ) && (prev_P4 == UP)) ? true:false;
    bool P2_GoDown = ( ( P2 == DOWN ) && (prev_P2 == UP)) ? true:false;
    bool P2_GoUp   = ( ( P2 == UP ) && (prev_P2 == DOWN)) ? true:false;


    // Port 27 (P4) from 1 to 0 = reset  : reply 0x55
    if ((P4_GoDown)&&(P2==UP)) {
//    if (P4==UP) {
        AddLog(LOG_PRINTER,tr("MD-100 send 0x55"));
        if (mainwindow->dialoganalogic) mainwindow->dialoganalogic->setMarker(1);
        out_adrBus= 0x03;
        data = 0x55;
        PUT_BIT(port,0,UP);
        FddOpen();
        sendData = true;
    }
    else if (P4==DOWN) {
        if ( P2_GoDown) {

            // Send data
// FDD result send
                PUT_BIT(port,0,UP);
                out_adrBus= 0x03;
//                AddLog(LOG_PRINTER,tr("[%1] MD-100 receivED %2").arg(prev_adrBus,2,16,QChar('0')).arg(data,2,16,QChar('0')));
                data = FddTransfer(data);
                sendData = true;
//                AddLog(LOG_PRINTER,tr("[%1] MD-100 send %2").arg(port,2,16,QChar('0')).arg(data,2,16,QChar('0')));
                if (mainwindow->dialoganalogic) mainwindow->dialoganalogic->setMarker(2);

        }
        else if ( P2_GoUp) {
            // Receive data
            // FDD command received
                sendData = false;
                PUT_BIT(port,0,DOWN);
//                AddLog(LOG_PRINTER,tr("[%1] MD-100 receive %2").arg(prev_adrBus,2,16,QChar('0')).arg(data,2,16,QChar('0')));
                if (mainwindow->dialoganalogic) mainwindow->dialoganalogic->setMarker(3);
        }
        else if (adrBus==0x05) {
            printerDataPort(data);
        }
        else if ((adrBus==0x06))//&&(P2==UP))
        {
            printerControlPort(data);
        }
        else if (adrBus==0x04) {
            // Send the printerStatusPort
            sendData = true;
            out_adrBus = 0x04;
            data = printerStatusPort();
        }
        else if (adrBus == 0x00) {

            // READ
//            serial port status register
//            bit 0 - set when TX buffer full, cleared after the byte has been transmitted
//            bit 1 - set when RX buffer full, cleared after reading the RX data register 010
//            bit 2 - state of the CTS input
//            bit 3 - state of the DSR input
//            bit 4 - state of the DCD input



            // WRITE
//            serial port control register
//            bit 0 - MT/RS232C
//            bit 1 - Odd/Even parity
//            bit 2 - parity OFF/ON
//            bit 3 - 7/8 data length
//            bit 4 - 1/2 stop bit
//            bits 5..7 - baud rate
        }
        else if (adrBus == 0x01) {
            //READ
//            serial port status register
//            bit 0 - set when RX parity error
//            bit 1 - cleared when RX framing or overrun error
//            bit 3 - state of the SW0 input
//            bit 4 - state of the SW1 input
//            bit 5 - state of the SW2 input




            //Write
//            serial port control register
//            bit 0 - transmitter enable
//            bit 1 - receiver enable
//            bit 2 - state of the RTS output
//            bit 3 - state of the DTR output

        }
        else if ( (adrBus == 0x02) && (prev_adrBus != 0x02) ) {
            // READ
//            serial port receive data register
            sendData = true;
            out_adrBus = 0x02;
            data = SIORecvData();
            AddLog(LOG_SIMULATOR,tr("SIO Data received:[%1]=%2").arg(data,2,16,QChar('0')).arg(QChar(data)));

            // WRITE
//            serial port control register
        }
        else if ( (adrBus == 0x03) && (prev_adrBus != 0x03) ){
            // WRITE
//            serial port transmit data register
            AddLog(LOG_SIMULATOR,tr("Data sent to 03:[%1]=%2").arg(data,2,16,QChar('0')).arg(QChar(data)));
        }
    }

//    PUT_BIT(port,3,DOWN); //P3 to 0


    prev_P0 = P0;
    prev_P1 = P1;
    prev_P2 = P2;
    prev_P3 = P3;
    prev_P4 = P4;

    Set_Connector();
    pCONNECTOR_value = pCONNECTOR->Get_values();
    pCENTCONNECTOR_value = pCENTCONNECTOR->Get_values();
    pSIOCONNECTOR_value = pSIOCONNECTOR->Get_values();

    return true;
}