public static String format(int value, int format) {
		String ret;
		switch (format) {
		case ROM.FORMAT_HEX:
			ret = Integer.toHexString(value);
			while (ret.length() < 2)
				ret = "0" + ret;
			return "$" + ret;
		case ROM.FORMAT_DEC:
			ret = Integer.toString(value, 10);
			while (ret.length() < 3)
				ret = " " + ret;
			return ret;
		case ROM.FORMAT_BIN:
			ret = Integer.toString(value, 2);
			while (ret.length() < 8)
				ret = "0" + ret;
			return "%" + ret;
		case ROM.FORMAT_BUTTONS:
			return toButtons(value);
		default:
			throw new IllegalArgumentException("Unknown format " + format);
		}
	}