def wr_test_val(p, start = 0x6000, end = 0x8000): px = ( 0x00, 0xff, 0xaa, 0x55, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01) l = p.m.find(start, end, px) assert len(l) == 1 ax = l[0] x = p.t.add(ax, ax + len(px), "tbl") print("WR_TEST_VAL", x) x.blockcmt += "-\nWrite Test Values" p.setlabel(ax, "WR_TEST_VAL") for i in range(x.start, x.end): const.byte(p, i)
def wr_test_val(p, start=0x6000, end=0x8000): px = (0x00, 0xff, 0xaa, 0x55, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01) l = p.m.find(start, end, px) assert len(l) == 1 ax = l[0] x = p.t.add(ax, ax + len(px), "tbl") print("WR_TEST_VAL", x) x.blockcmt += "-\nWrite Test Values" p.setlabel(ax, "WR_TEST_VAL") for i in range(x.start, x.end): const.byte(p, i)
def chargen(adr): const.byte(p,adr) const.byte(p,adr + 1) for j in range(2, 66, 2): x = const.w16(p, adr + j) y = p.m.b16(adr + j) s = "" for b in range(15, -1, -1): if y & (1 << b): s += "#" else: s += "." x.lcmt(s)
def chargen(adr): const.byte(p, adr) const.byte(p, adr + 1) for j in range(2, 66, 2): x = const.w16(p, adr + j) y = p.m.b16(adr + j) s = "" for b in range(15, -1, -1): if y & (1 << b): s += "#" else: s += "." x.lcmt(s)
def one_eprom(p, disass, start, eprom_size): if False: x = p.t.add(start, start + eprom_size, "eprom") x.blockcmt += "\n-\nEPROM at 0x%x-0x%x\n\n" % \ (start, start + eprom_size - 1) # Calculate checksum j = 0^p.m.w16(start) for jj in range(2, eprom_size): j += p.m.rd(start + jj) j &= 0xffff if j == 0xffff: j = "OK" else: print("NB: Bad Eprom checksum @%x" % start) j = "BAD" x = const.w16(p, start) x.cmt.append("EPROM checksum (%s)" % j) x.blockcmt += "-\nEPROM %04x\n" % start x = const.byte(p, start + 2) x.cmt.append("EPROM identifier") # Jump table at front of EPROM for ax in range(start + 3, start + eprom_size, 3): if p.m.rd(ax) != 0x7e: break disass(ax)
def one_eprom(p, disass, start, eprom_size): if False: x = p.t.add(start, start + eprom_size, "eprom") x.blockcmt += "\n-\nEPROM at 0x%x-0x%x\n\n" % \ (start, start + eprom_size - 1) # Calculate checksum j = 0 ^ p.m.w16(start) for jj in range(2, eprom_size): j += p.m.rd(start + jj) j &= 0xffff if j == 0xffff: j = "OK" else: print("NB: Bad Eprom checksum @%x" % start) j = "BAD" x = const.w16(p, start) x.cmt.append("EPROM checksum (%s)" % j) x.blockcmt += "-\nEPROM %04x\n" % start x = const.byte(p, start + 2) x.cmt.append("EPROM identifier") # Jump table at front of EPROM for ax in range(start + 3, start + eprom_size, 3): if p.m.rd(ax) != 0x7e: break disass(ax)
def hpib_arg_range(p, adr, len = 14): x = p.t.add(adr, adr + len * 2, "arg-range") x.blockcmt += "-\nTable of legal range of numeric argument for HPIB cmd" for i in range(0, len): aa = adr + i * 2 x = const.byte(p, aa, 2) l = p.m.rd(aa) h = p.m.rd(aa + 1) x.lcmt(p.hpib_cmd[i][0] + "[%d-%d]" % (l,h)) p.hpib_cmd[i].append(l) p.hpib_cmd[i].append(h)
def hpib_tbl_idx(p, adr): aa = adr for i in p.hpib_cmd: if len(i) == 1: break x = const.byte(p, aa) i.append(p.m.rd(aa)) x.lcmt(i[0]) aa += 1 x = p.t.add(adr, aa, "idx-table") x.blockcmt += "-\nIndex into cmd table, add numeric arg"
cpu.disass(p.m.l16(a)) for a in range(0xff93, 0xff9a, 3): const.w16(p, a + 1) cpu.disass(a) pass ####################################################################### if True: while p.run(): pass x = p.t.add(0xe28a, 0xe29d, "consts") x.blockcmt = """- Command byte dispatch table """ x = const.byte(p, 0xe28a) x.lcmt("Number of commands in table") y = cpu.disass(0xe1e6) fd_cmds = dict() fd_cmds[4] = "FORMAT" fd_cmds[8] = "READ" fd_cmds[10] = "WRITE" fd_cmds[0x0f] = "MOVCMD" fd_cmds[0xde] = "GOTO" fd_cmds[0xe3] = "FILL" for x in range(0,6): b = 0xe28b + x a = 0xe291 + 2 * x
x.lcmt("= 2^31 * 5*10^-9 * 10^-6 (%.9e)\n" % (math.ldexp(1,31)*5e-9*1e-6)) x = hp5370.float(p, 0x619c) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1,23)*5e-9*1e-9)) x = hp5370.float(p, 0x61a3) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1,31)*5e-9)) x = hp5370.float(p, 0x69dd) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1,23)*5e-9*1e-9)) x = hp5370.float(p, 0x69e4) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1,31)*5e-9)) ####################################################################### const.byte(p, 0x7a75, 15) const.byte(p, 0x7a84, 8) const.byte(p, 0x7a8c, 8) const.byte(p, 0x7a95, 7) const.byte(p, 0x77f7, 7) ####################################################################### x = p.t.add(0x6b09,0x6b23, "tbl") x.blockcmt += "Table Keyboard or LED related ?\n" const.byte(p, 0x6b09, 8) const.byte(p, 0x6b11, 8) const.byte(p, 0x6b19, 8) const.byte(p, 0x6b21, 2) ####################################################################### x = p.t.add(0x6b23,0x6b32, "tbl")
cpu.disass(0) ####################################################################### while p.run(): pass ####################################################################### cpu.to_tree() ####################################################################### for a in range(0x66a, 0x676, 3): w = p.m.l16(a) x = const.byte(p, a, len=3, fmt="%d") p.setlabel(a, "CONST_%d" % w) p.setlabel(0x6e8, "rr0++") ####################################################################### p.setlabel(0x6bc, "Count_Down()") x = p.t.find(0x6bc, "ins") x.blockcmt += """- This is the RESET "countdown" routine Displays: .9.9.9.9 9.9 .8.8.8.8 8.8 ... .0.0.0.0 0.0
cpu.disass(0) cpu.disass(3) cpu.disass(7) ####################################################################### while p.run(): pass ####################################################################### # Jump table j = cpu.disass(0x3f) for i in range(0x0a,0x21): v = p.m.rd(i) const.byte(p, i) cpu.disass(v) j.flow("cond", "x", v) p.setlabel(v, "CMD_%02x" % (i - 0xa)) ####################################################################### # No idea... for i in range(0x000,0x800,0x100): cpu.disass(i + 0xfe) ####################################################################### # Pure guess const.txt(p, 0x5ae) cpu.disass(0x695)
x.lcmt("= 2^31 * 5*10^-9 * 10^-6 (%.9e)\n" % (math.ldexp(1, 31) * 5e-9 * 1e-6)) x = hp5370.float(p, 0x619c) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1, 23) * 5e-9 * 1e-9)) x = hp5370.float(p, 0x61a3) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1, 31) * 5e-9)) x = hp5370.float(p, 0x69dd) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1, 23) * 5e-9 * 1e-9)) x = hp5370.float(p, 0x69e4) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1, 31) * 5e-9)) ####################################################################### const.byte(p, 0x7a73, 15) const.byte(p, 0x7a82, 8) const.byte(p, 0x7a8a, 8) const.byte(p, 0x7a93, 7) const.byte(p, 0x77f9, 7) ####################################################################### x = p.t.add(0x6b09, 0x6b23, "tbl") x.blockcmt += "Table Keyboard or LED related ?\n" const.byte(p, 0x6b09, 8) const.byte(p, 0x6b11, 8) const.byte(p, 0x6b19, 8) const.byte(p, 0x6b21, 2) ####################################################################### x = p.t.add(0x6b23, 0x6b32, "tbl")
# 0:0bc8 related x = p.t.add(0x0c4a, 0xc76, "tbl") x.blockcmt = """- Initialization for some I/O chip See routine @ 0x0bc8 Doesn't look like 6845 or SCC, could be Hi-Res """ i = p.m.b16(0xc74) a = 0xc4a while i > 0: j = i if j > 2: j = 2 const.byte(p, a, j) a += j i -= j const.w16(p, 0x0c74) ####################################################################### # # Looks unref INW(adr) cpu.disass(0x0214) p.setlabel(0x0214, "INW(adr)") cpu.disass(0x22b0) #######################################################################
for i in range(0, 8): b.append(p.m.rd(adr + i)) self.nbr = hp5359_nbr(p, b) self.a['const'] = "FLOAT=%e" % float(self.nbr) p.setlabel(adr, self.a['const']) def rfunc(self, p, t): s = ".FLOAT\t%e" % float(self.nbr) return (s, ) #---------------------------------------------------------------------- for i in range(0x7f03, 0x7fa3, 8): dot_float(p, i) #---------------------------------------------------------------------- const.byte(p, 0x7fa3, 7) const.byte(p, 0x7faa, 7) const.byte(p, 0x7fb1, 7) const.byte(p, 0x7fb8, 7) #---------------------------------------------------------------------- for ax in range(0x6225, 0x6287, 2): x = const.txtlen(p, ax, 2) if ax < 0x624d: continue a2 = ax - 0x624d + 0x6287 y = p.m.b16(a2) tt = x.txt if tt[1:] == "\\x00": tt = tt[:1] if tt[0] == "a": tt = "EC" + tt[1:]
cpu.disass(0) cpu.disass(3) cpu.disass(7) ####################################################################### while p.run(): pass ####################################################################### # Jump table j = cpu.disass(0x3f) for i in range(0x0a, 0x21): v = p.m.rd(i) const.byte(p, i) cpu.disass(v) j.flow("cond", "x", v) p.setlabel(v, "CMD_%02x" % (i - 0xa)) ####################################################################### # No idea... for i in range(0x000, 0x800, 0x100): cpu.disass(i + 0xfe) ####################################################################### # Pure guess const.txt(p, 0x5ae) cpu.disass(0x695)
x.lcmt("= 2^31 * 5*10^-9 * 10^-6 (%.9e)\n" % (math.ldexp(1,31)*5e-9*1e-6)) x = hp5370.float(p, 0x619c) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1,23)*5e-9*1e-9)) x = hp5370.float(p, 0x61a3) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1,31)*5e-9)) x = hp5370.float(p, 0x69dd) x.lcmt("= 2^23 * 5*10^-9 * 10^-9 (%.9e)\n" % (math.ldexp(1,23)*5e-9*1e-9)) x = hp5370.float(p, 0x69e4) x.lcmt("= 2^31 * 5*10^-9 (%.9e)\n" % (math.ldexp(1,31)*5e-9)) ####################################################################### const.byte(p, 0x7a73, 15) const.byte(p, 0x7a82, 8) const.byte(p, 0x7a8a, 8) const.byte(p, 0x7a93, 7) const.byte(p, 0x77f9, 7) ####################################################################### x = p.t.add(0x6b09,0x6b23, "tbl") x.blockcmt += "Table Keyboard or LED related ?\n" const.byte(p, 0x6b09, 8) const.byte(p, 0x6b11, 8) const.byte(p, 0x6b19, 8) const.byte(p, 0x6b21, 2) ####################################################################### x = p.t.add(0x6b23,0x6b32, "tbl")
b = bytearray() for i in range(0,8): b.append(p.m.rd(adr + i)) self.nbr = hp5359_nbr(p, b) self.a['const'] = "FLOAT=%e" % float(self.nbr) p.setlabel(adr, self.a['const']) def rfunc(self, p, t): s = ".FLOAT\t%e" % float(self.nbr) return (s,) #---------------------------------------------------------------------- for i in range(0x7f03, 0x7fa3, 8): dot_float(p, i) #---------------------------------------------------------------------- const.byte(p, 0x7fa3, 7) const.byte(p, 0x7faa, 7) const.byte(p, 0x7fb1, 7) const.byte(p, 0x7fb8, 7) #---------------------------------------------------------------------- for ax in range(0x6225,0x6287,2): x = const.txtlen(p, ax, 2) if ax < 0x624d: continue a2 = ax - 0x624d + 0x6287 y = p.m.b16(a2) tt = x.txt if tt[1:] == "\\x00": tt = tt[:1] if tt[0] == "a": tt = "EC" + tt[1:]