public void loadBatteryRam() {

		String saveRamFileName = romFileName;

		int numRamBanks;

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

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

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

			if ((cartType == 3) || (cartType == 9) || (cartType == 0x1B) || (cartType == 0x1E) || (cartType == 0x10) || (cartType == 0x13) ) {
				FileInputStream is = new FileInputStream(new File(saveRamFileName));
				is.read(ram, 0, numRamBanks * 8192);
				is.close();
				System.out.println("Read SRAM from '" + saveRamFileName + "'");
			}
			if (cartType == 6) {
				FileInputStream is = new FileInputStream(new File(saveRamFileName));
				is.read(ram, 0, 512);
				is.close();
				System.out.println("Read SRAM from '" + saveRamFileName + "'");
			}


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