 
 // Are we wanting the processor to be halted?
 bool halt_request;
+
+// Should we cycle the processor?
+bool cycle_request;
 
 DebouncedSwitch mode_switch(BTN_MODE);
 DebouncedSwitch select_switch(BTN_SELECT);


    // Processor is in running state
    halt_request = false;

    // OK, all done, just wait for display test to time out
    while(millis() - dt_shown_at < DPY_TST_DURATION) {

    return { .next = &readingCommandState };
}

void printHelp() {
    Serial.println("?       - show brief help message");
    Serial.println("p       - print current address/data bus");
    Serial.println("h       - toggle halt state");
    Serial.println("c       - single cycle");
}

SerialState processCommand() {
    if(cmd_buf[0] == 'p') {
        // print current state
        Serial.print("A: ");
        Serial.print(address_bus, HEX);
        Serial.print(" D: ");
        Serial.print(data_bus, HEX);
        Serial.println("");
    } else if(cmd_buf[0] == '?') {
        printHelp();
    } else if(cmd_buf[0] == 'h') {
        halt_request = !halt_request;
        Serial.print("halt ");
        Serial.println(halt_request ? "on" : "off");
    } else if(cmd_buf[0] == 'c') {
        cycle_request = true;
    } else {
        Serial.println("unknown cmd");
        printHelp();
    }
    return serialPrompt();
}

