public void saveBatteryRam() {
		String saveRamFileName = romFileName;
		int numRamBanks;

		/*  if (rom[0x149] == 0x03) {
   numRamBanks = 4;
  } else {
   numRamBanks = 1;
  }*/
		numRamBanks = getNumRAMBanks();

		try {
			int dotPosition = romFileName.lastIndexOf('.');

			if (dotPosition != -1) {
				saveRamFileName = romFileName.substring(0, dotPosition) + ".sav";
			} else {
				saveRamFileName = romFileName + ".sav";
			}

			if ((cartType == 3) || (cartType == 9) || (cartType == 0x1B) || (cartType == 0x1E) || (cartType == 0x10) || (cartType == 0x13)) {
				FileOutputStream os = new FileOutputStream(new File(saveRamFileName));
				os.write(ram, 0, numRamBanks * 8192);
				os.close();
				System.out.println("Written SRAM to '" + saveRamFileName + "'");
			}
			if (cartType == 6) {
				FileOutputStream os = new FileOutputStream(new File(saveRamFileName));
				os.write(ram, 0, 512);
				os.close();
				System.out.println("Written SRAM to '" + saveRamFileName + "'");
			}

		} catch (IOException e) {
			System.out.println("Error saving battery RAM to '" + saveRamFileName + "'");
		}
	}