/* * quick-and-dirty throwaway program to add base address * in hexadecimal to offsets * * base address is command-line argument * offsets read from stdin */ if (args.length < 1) { System.err.println("need base address as argument, e.g., 00400024") System.exit(1) } val base = try { Integer.parseInt(args(0), 16) } catch { case _:NumberFormatException => { System.err.println("need base address as argument, e.g., 00400024") System.exit(1) 0 } } println("enter offsets, one per line, e.g., 002c, or EOF to end") var in = "" do { in = scala.io.StdIn.readLine() if (in != null) { try { val offset = Integer.parseInt(in, 16) println("base plus %04x is %08x".format( offset, base+offset)) } catch { case _:NumberFormatException => { System.err.println("invalid offset") } } } } while (in != null)