   delay(1);
   digitalWrite(LATCH, LOW);
 }
+
+bool getRomName() {
+  File config = SD.open("config.txt");
+  if (config) {
+    for (byte i = 0; config.peek() != '\n' && i <= FILENAME_SIZE; ++i) {
+      romName[i] = config.read();
+    }
+    config.close();
+    return true;
+  } else {
+    // File config.txt was not found or could not be opened.
+    return false;
+  }
+}


  disableVCBus();

  Serial.begin(9600);
  delay(100);

  Serial.println("writing data");
  enableSRAM();
  for (int i = 0; i < ROMSIZE; i++) {
    write2RAM(i, pgm_read_byte(romImage + i));
  }
  disableSRAM();
  Serial.println("done");

  Serial.println("enable bus to VC4000");
  enableVCBus();
}

void loop() {
  digitalWrite(LED, HIGH);
  delay(300);
  digitalWrite(LED, LOW);
  delay(300);
}

void enableSRAM() {

#include <SD.h>
#include <SPI.h>

#define CLOCK          4     // SRCLK
#define LATCH          3     // RCLK
#define DATA           5     // SER

#define WR             2
#define OEDATA         A1    // _G DATA BUS
#define OEADDRESS      A0    // _G ADDRESS BUS

#define OEVCBUS        6

#define CE1SRAM        7
#define CE2SRAM        8

#define SD_CS          10
#define FILENAME_SIZE  12    // 8.3 convention, see SD library doc.
#define MAX_ROM_SIZE   2048

#define LED            13

unsigned blinkTimeHigh = 500;
unsigned blinkTimeLow = 500;

char romName[FILENAME_SIZE + 1];
File romFile;

void setup() {
  pinMode(CLOCK, OUTPUT);
