altoslib: Print more helpful debug messages when checking rom version
authorKeith Packard <keithp@keithp.com>
Wed, 2 Sep 2020 01:47:23 +0000 (18:47 -0700)
committerKeith Packard <keithp@keithp.com>
Sat, 26 Sep 2020 03:07:39 +0000 (20:07 -0700)
Make sure success and failure include enough info to debug what
happened.

Signed-off-by: Keith Packard <keithp@keithp.com>
altoslib/AltosRomconfig.java

index 8ef1848d0f3c5c8e690113458cea23a170afd4dc..670946582386a3f5412e6881a006bab840aeca46 100644 (file)
@@ -151,8 +151,8 @@ public class AltosRomconfig implements AltosUnitInfoListener {
                                try {
                                        version = get_int(hexfile, ao_romconfig_version, 2, adjust);
                                        check = get_int(hexfile, ao_romconfig_check, 2, adjust);
-                                       System.out.printf("adjust %d version %x check %x\n", adjust, version, check);
                                        if (check == (~version & 0xffff)) {
+                                               System.out.printf("adjust %d version %x check %x success\n", adjust, version, check);
                                                switch (version) {
                                                case 2:
                                                case 1:
@@ -177,9 +177,11 @@ public class AltosRomconfig implements AltosUnitInfoListener {
                                                        break;
                                                }
                                                break;
+                                       } else {
+                                               System.out.printf("adjust %d version %x check %x fail\n", adjust, version, check);
                                        }
                                } catch (ArrayIndexOutOfBoundsException aie) {
-                                       System.out.printf("adjust %d failed\n", adjust);
+                                       System.out.printf("adjust %d out of bounds\n", adjust);
                                        continue;
                                }
                        }