 
 static bool hold = false;
 static bool finished = false;
+
+static FatFile tasFile;
+
+//static unsigned int progressPos = 0;
+static unsigned long numFrames = 0, curFrame = 0;
+static int edgesRead = 0;
+static int incompleteCommand = 0;
+
+static SdFatSdioEX sd;
+
+template<class T> void lockedPrintln(const T& input)
+{
+  noInterrupts();
+  Serial.println(input);
+  interrupts();
+}
+
+template<class A, class B> void lockedPrintln(const A& a, const B& b)
+{
+  noInterrupts();
+  Serial.print(a);
+  Serial.println(b);
+  interrupts();
+}
+
+static void startTimer()
+{
+  ARM_DWT_CYCCNT = 0;
+}
+
+static long readTimer()
+{
+  return ARM_DWT_CYCCNT;
+}
 
 static size_t getNextRegion(size_t& size) {
   size_t currentPos = bufferPos;


    LED_LOW;
}


#define INPUT_BUFFER_UPDATE_TIMEOUT 10 // 10 ms

#define MICRO_CYCLES (F_CPU / 1000000)

#define MAX_CMD_LEN 4096
#define MAX_LOOP_LEN 10240

static bool skippingInput = false;
static String inputString;

static char n64_raw_dump[36]; // maximum recv is 1+2+32 bytes + 1 bit
// n64_raw_dump does not include the command byte. That gets pushed into
