 static volatile bool bufferHasData;
 static void updateInputBuffer();
 
+static bool hold = false;
+static bool finished = false;
+
 static size_t getNextRegion(size_t& size) {
   size_t currentPos = bufferPos;
   if ((currentPos == bufferEndPos || (currentPos == 0 && bufferEndPos == INPUT_BUFFER_SIZE)) && bufferHasData) {

    startTimer();
    volatile uint32_t *config = portConfigRegister(N64_PIN);
    uint32_t oldConfig = *config;
//    unsigned int curPos;

    // Bail if file open failed
    if (!m64OpenSuccess)
        goto end;

    *config &= ~0x000F0000;


  } else if (cmd.startsWith("IN:")) {
    size_t len = appendInputs(hextobin(cmd.substring(3)));
    lockedPrintln("IN:", len);
  } else if (cmd.startsWith("HL:")) {
    hold = cmd[3] == '1';
  } else if (cmd.startsWith("CL:")) {
    writeFile.close();
    lockedPrintln("CL:OK");
