Exemple #1
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;
    }
Exemple #2
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;
}