+ private final static String[] required_names = {
+ ao_romconfig_version,
+ ao_romconfig_check,
+ ao_serial_number
+ };
+
+ private static boolean name_required(String name) {
+ for (String required : required_names)
+ if (name.equals(required))
+ return true;
+ return false;
+ }
+
+ public static long fetch_base(AltosHexfile hexfile) throws AltosNoSymbol {
+ long base = 0xffffffffL;
+ for (String name : fetch_names) {
+ try {
+ int len = fetch_len(name);
+ long addr = find_address(hexfile, name, len);
+
+ if (addr < base)
+ base = addr;
+ System.out.printf("symbol %s at %x base %x\n", name, addr, base);
+ } catch (AltosNoSymbol ns) {
+ if (name_required(name))
+ throw (ns);
+ }
+ }
+ return base;
+ }
+
+ public static long fetch_bounds(AltosHexfile hexfile) throws AltosNoSymbol {
+ long bounds = 0;
+ for (String name : fetch_names) {
+ try {
+ int len = fetch_len(name);
+ long addr = find_address(hexfile, name, len) + len;
+ if (addr > bounds)
+ bounds = addr;
+ System.out.printf("symbol %s at %x bounds %x\n", name, addr, bounds);
+ } catch (AltosNoSymbol ns) {
+ if (name_required(name))
+ throw (ns);
+ }
+ }
+
+ return bounds;
+ }
+
+ public void write (AltosHexfile hexfile) throws IOException {