   // Read some data from the SD card
   beginSdRead();
   readDspRamData(file, &buffer[0]);
-  for (word i = 0; i < SPC_UPLOAD_BUFFER_SIZE - 128; i++) {
-    buffer[128 + i] = readSpcRamData(file, info, i);
-  }
+  readSpcRamData(file, info, 0, &buffer[128], SPC_UPLOAD_BUFFER_SIZE - 128);
   endSdRead();
 
   // Initialize

  file.seek(desiredPosition);
}

byte readSpcRamData(File &spcFile, SPCInfo &info, word address) {
  // Extra RAM
  if (info.getShouldLoadExtraRAM() && address >= 0xFFC0) {
    seekIfNecessary(spcFile, EXTRA_RAM_START + (uint32_t)(address - 0xFFC0));
    return (byte)spcFile.read();
  }
  
  // Bootloader code
  if (address >= info.getBootLocation() && address < (info.getBootLocation() + info.getBootCount())) {
    word bootAddress = address - info.getBootLocation();
    switch (bootAddress) {
      case 0x19: return info.getExtraData(0);
      case 0x1F: return info.getExtraData(1);
      case 0x25: return info.getExtraData(2);
      case 0x2B: return info.getExtraData(3);
      case 0x01: return info.getExtraData(4);
      case 0x04: return info.getExtraData(5);
      case 0x07: return info.getExtraData(6);
      case 0x0A: return info.getExtraData(7);
      case 0x0D: return info.getExtraData(8);
      case 0x10: return info.getExtraData(9);
      case 0x38: return info.getExtraData(10);
      case 0x3E: return info.getExtraData(11);
      case 0x41: return info.getExtraData(12);
      case 0x44: return info.getSPLow();
      case 0x47: return info.getPSW();
      case 0x4b: return info.getA();
      case 0x4d: return info.getY();
      case 0x4f: return info.getX();
      case 0x51: return info.getPCLow();
      case 0x52: return info.getPCHigh();
      default: return pgm_read_byte(bootloaderCode + bootAddress);
    }
  }
  
  // Echo region
  if (info.getEchoEnabled() && address >= info.getEchoRegion() && address < (info.getEchoRegion() + info.getEchoSize())) {
    return 0;
  }
  
  // If no special RAM re-mapping is to be done, just load the byte
  seekIfNecessary(spcFile, RAM_START + (uint32_t)address);
  return (byte)spcFile.read();
}

/**

  for (uint32_t i = 0x180; i < 0x10000; i += SPC_UPLOAD_BUFFER_SIZE) {
    // Read more data from the card
    beginSdRead();
    readSpcRamData(file, info, (word)i, buffer, min(SPC_UPLOAD_BUFFER_SIZE, (word)(0x10000 - i)));
    endSdRead();
    
    // Write data to the SPC 700
