Пример #1
0
bool Crlp6001::run(void)
{
    Cbus bus;

    bus.fromUInt64(pMAINCONNECTOR->Get_values());
    quint8 dest = bus.getDest()-1;

    if ( dest >= 0x06) return true;

    bus.setDest(0);
    // copy MainConnector to Ext Connectors
    pEXTCONNECTOR[dest]->Set_values(bus.toUInt64());

    // execute Ext
    mainwindow->pdirectLink->outConnector(pEXTCONNECTOR[dest]);

    bus.fromUInt64(pEXTCONNECTOR[dest]->Get_values());
    if (bus.getFunc()==BUS_READDATA)
        pMAINCONNECTOR->Set_values(bus.toUInt64());


    return true;
}
Пример #2
0
bool Chp82143A::run(void) {

    if (!isready) return true;

    Cbus bus;

    bus.fromUInt64(pCONNECTOR->Get_values());

    if (!bus.isEnable()) return true;
#if 0
    switch (bus.getFunc()) {
    case BUS_SLEEP: break;
    case BUS_READDATA:
        if (bus.getAddr()==0x3a) {
            bus.setData(getStatus() >> 8);
            bus.setFunc(BUS_READDATA);
        }
        if (bus.getAddr()==0x3b) {
            bus.setData(getStatus() & 0xff);
            bus.setFunc(BUS_READDATA);
        }
        break;
    case BUS_WRITEDATA: Printer(bus.getData());
        bus.setFunc(BUS_SLEEP);
        break;
    }
Пример #3
0
bool Crlp9001::run(void)
{
    Cbus bus;

    bus.fromUInt64(pMAINCONNECTOR->Get_values());

    if (bus.getDest()!=0) return true;

    if (bus.getFunc()==BUS_QUERY) {
        bus.setData(0xFB);
        bus.setFunc(BUS_READDATA);
        pMAINCONNECTOR->Set_values(bus.toUInt64());
        return true;
    }

    if (bus.getFunc()==BUS_SELECT) {
        if (bus.getData()==1){
            Power=true;
        }
        if (bus.getData()==0) {
            Power = false;
        }
        bus.setFunc(BUS_READDATA);
        pMAINCONNECTOR->Set_values(bus.toUInt64());
        return true;
    }

    if (!Power) return true;

    switch (bus.getFunc()) {
    case BUS_SLEEP: break;
    case BUS_WRITEDATA: mem[bus.getAddr()] = bus.getData();
        break;
    case BUS_READDATA: bus.setData(mem[bus.getAddr()]);
        break;
    }

    pMAINCONNECTOR->Set_values(bus.toUInt64());
    return true;
}