示例#1
0
def hd6845_tab(asp):
    hd6845reg = (
        "Horizontal Total",
        "Horizontal Displayed",
        "Horizontal Sync Position",
        "Sync Width",
        "Vertical Total",
        "Vertical Total Adjust",
        "Vertical Displayed",
        "Vertical Sync Position",
        "Interlace & Skew",
        "Maximum Raster Address",
        "Cursor Start Raster",
        "Cursor End Raster",
        "Start Address (H)",
        "Start Address (L)",
        "Cursor (H)",
        "Cursor (L)",
        "Light Pen (H)",
        "Light Pen (L)",
    )
    a = 0x434a
    asp.set_label(a, "HD6845_PARAMS[]")
    while a < 0x436a:
        x = data.Pstruct(asp, a, "BB")
        y = asp[a]
        if y < len(hd6845reg):
            x.lcmt += hd6845reg[y]
        a += 2
    data.Pstruct(asp, a, ">H")
示例#2
0
def flow_post_arg(asp, ins):
    z = post_arg.get(ins.dstadr)
    if z is None:
        return
    ins.flow_out.pop(-1)
    if len(z) <= 1:
        a = data.Pstruct(asp, ins.hi, ">h", "%d", ".INFIX").hi
        ins += code.Jump(to=a)
        return
    l = []
    for i in z[1:]:
        if i[1:] == "A6rel":
            r = asp.bs16(ins.hi)
            ins.hi += 2
            if r < 0:
                l.append("(A6-0x%x)" % -r)
            else:
                l.append("(A6+0x%x)" % r)
        elif i[1:] == "abs":
            r = asp.bu16(ins.hi)
            if r & 0x8000:
                r |= 0xffff0000
            ins.hi += 2
            l.append("0x%08x" % r)
        elif i == "drel":
            r = ins.hi + asp.bs16(ins.hi)
            ins.hi += 2
            ins.lcmt += " @0x%x\n" % r
            y = data_double(asp, r)
            l.append("%g" % y.data[0])
        elif i == "brel":
            r = ins.hi + asp.bs16(ins.hi)
            ins.hi += 2
            ins.lcmt += " @0x%x\n" % r
            y = data_bcd(asp, r)
            l.append("%x" % y.data[0])
        elif i == "lrel":
            r = ins.hi + asp.bs16(ins.hi)
            ins.hi += 2
            ins.lcmt += " @0x%x\n" % r
            if not asp.occupied(r):
                data.Pstruct(asp, r, ">L", "%d", ".LONG")
            l.append("%d" % asp.bu32(r))
        elif i == "frel":
            r = ins.hi + asp.bs16(ins.hi)
            ins.hi += 2
            ins.lcmt += " @0x%x\n" % r
            y = data_float(asp, r)
            l.append("%g" % y.val)
        elif i == "bcd":
            r = asp.bu16(ins.hi)
            # y = data.Pstruct(asp, ins.hi, ">H", "%x", ".BCD")
            l.append("%04x" % r)
            ins.hi += 2
        else:
            l.append(i)
    ins.oper.append(assy.Arg_verbatim("(" + ",".join(l) + ")"))
    ins += code.Flow()
示例#3
0
	def flow_post_arg(pj, ins):
		z = post_arg.get(ins.dstadr)
		if z == None:
			return
		ins.flow_out.pop(-1)
		if len(z) <= 1:
			a = data.Pstruct(pj, ins.hi, ">h", "%d", ".INFIX").hi
			ins.add_flow(pj, ">", True, a)
			return
		l = []
		for i in z[1:]:
			if i[1:] == "A6rel":
				r = pj.m.bs16(ins.hi)
				ins.hi += 2
				if r < 0:
					l.append("(A6-0x%x)" % -r)
				else:
					l.append("(A6+0x%x)" % r)
			elif i[1:] == "abs":
				r = pj.m.bu16(ins.hi)
				if r & 0x8000:
					r |= 0xffff0000
				ins.hi += 2
				l.append("0x%08x" % r)
			elif i == "drel":
				r = ins.hi + pj.m.bs16(ins.hi)
				ins.hi += 2
				ins.lcmt += " @0x%x\n" % r
				y = data_double(pj, r)
				l.append("%g" % y.data[0])
			elif i == "brel":
				r = ins.hi + pj.m.bs16(ins.hi)
				ins.hi += 2
				ins.lcmt += " @0x%x\n" % r
				y = data_bcd(pj, r);
				l.append("%x" % y.data[0])
			elif i == "lrel":
				r = ins.hi + pj.m.bs16(ins.hi)
				ins.hi += 2
				ins.lcmt += " @0x%x\n" % r
				y = data.Pstruct(pj, r, ">L", "%d", ".LONG")
				l.append("%d" % y.data[0])
			elif i == "frel":
				r = ins.hi + pj.m.bs16(ins.hi)
				ins.hi += 2
				ins.lcmt += " @0x%x\n" % r
				y = data_float(pj, r)
				l.append("%g" % y.val)
			elif i == "bcd":
				r = pj.m.bu16(ins.hi)
				y = data.Pstruct(pj, ins.hi, ">H", "%x", ".BCD")
				l.append("%04x" % r)
				ins.hi += 2
			else:
				l.append(i)
		ins.oper.append(assy.Arg_verbatim(pj, "(" + ",".join(l) + ")"))
		ins.add_flow(pj, True, True, ins.hi)
示例#4
0
def hack(cpu, lo):
    while lo:
        y = cpu.dataptr(lo)
        x = data.Pstruct(cpu.m, lo + 2, "B" * 1, fmt=", ".join(["0x%02x"] * 1))
        x = data.Txt(cpu.m, lo + 3, term=(0x85,), label=False)
        x.compact = True
        x = data.Pstruct(cpu.m, x.hi, "B" * 2, fmt=", ".join(["0x%02x"] * 2))
        x.compact = True
        lo = y.dst
示例#5
0
def data_double(asp, a):
    y = DATA.get(a)
    if not y:
        y = data.Pstruct(asp, a, ">d", "%g", ".DOUBLE")
        y.val = y.data[0]
        DATA[a] = y
    return y
示例#6
0
def example():
    rv = []
    m1 = mem.ByteMem(0, 256)
    for i in range(256):
        m1[i] = i
    rv.append(m1)

    cx = banked.BankedCPU(NPG, mc6809.mc6809)
    for i in cx.bank:
        i.m.map(m1, lo=0x00, hi=0x20, shared=True)
        i.m.map(m1, lo=0x40, hi=0x60, offset=0x30 + i.bank * 0x20)
        i.m.map(m1, lo=0xd0, hi=0xe0, offset=0xb0)
        i.m.map(m1, lo=0xe0, hi=0xf0, offset=0xb3)
        rv.append(i.m)

    cx[0].m.map(m1, lo=0x80, hi=0x90, offset=0xd0, shared=True)
    cx[1].m.map(m1, lo=0x90, hi=0xa0, offset=0xd0, shared=True)
    cx[2].m.map(m1, lo=0xa0, hi=0xb0, offset=0xd0, shared=True)

    if True:
        m1.set_block_comment(0x00, " 0x00-0x20 Mapped Shared 3x @0x00")
        m1.set_block_comment(0x20, " 0x20-0x30")
        m1.set_block_comment(0x30, " 0x30-0x50 Mapped cx0 @ 0x40")
        m1.set_block_comment(0x50, " 0x50-0x70 Mapped cx1 @ 0x40")
        m1.set_block_comment(0x70, " 0x70-0x90 Mapped cx2 @ 0x40")
        m1.set_block_comment(0x90, " 0x90-0xb0")
        m1.set_block_comment(
            0xb0, " 0xb0-0xc3 Mapped Shared 3x @0xd0-0xe0 & @+3:0xe0-0xf0")
        m1.set_block_comment(0xc3, " 0xc3-0xd0")
        m1.set_block_comment(
            0xd0, " 0xd0-0xe0 Mapped Shared cx0@0x80, cx1@0x90, cx2@0xa0")
        m1.set_block_comment(0xe0, " 0xe3-0xff")

    for i in cx.bank:
        for a in range(0, 256, 16):
            b = a + i.bank
            m = "CX[%d][0x%x]" % (i.bank, b)
            #print(i, "%x" % b)
            i.m.set_label(b, m)
            i.m.set_line_comment(b, "C_" + m)
            try:
                y = data.Pstruct(i.m, b, "B")
                y.typ = m
            except mem.MemError:
                pass

    m = [m1]
    m += [x.m for x in cx.bank]
    for i in m:
        a = list(sorted(i.find(lo=0x00, hi=0x100)))
        b = list(sorted(i))
        for x, y in zip(a, b):
            xr = x.render()
            yr = y.render()
            assert xr == yr, "Find(%s) %s %s" % (str(i), xr, yr)
        assert len(a) == len(b), "Find(%s)\n\t%s\n\t%s" % (str(i), str(a),
                                                           str(b))

    return NAME, rv
示例#7
0
def resha_section(asp, a, handle):

    y = data.Pstruct(asp, a + 1, "B", fmt="RESHA_SECTION_MARKER=0x%02x")
    assert y.data[0] == 0xa5

    y = data.Pstruct(asp, a + 0x1ffa, "B", fmt="RESHA_CHECKSUM_OFFSET=0x%02x")
    s = 0x56
    for i in range(0x2000):
        s += asp[a + i]
    s &= 0xff
    s -= y.data[0]
    print("resha_sum 0x%x = 0x%x" % (a, s))
    assert s == 0, "SUM 0x%x" % s

    y = data.Pstruct(asp, a + 0, "B", fmt="RESHA_NENTRY=0x%02x")
    for i in range(y.data[0]):
        z = data.Pstruct(asp, a + 2 + 2 * i, ">H", fmt="0x%04x")
        b = a + z.data[0]
        asp.set_block_comment(b, "RESHA 0x%x ENTRY[0x%x]" % (a, i))
        c = handle.get(i)
        if c and c[0]:
            asp.set_label(b, c[0])
        if c and c[1]:
            c[1](b)
示例#8
0
def chargendata(asp, a):
    asp.set_label(0x45fe, "CHARGEN")
    s = chargen.SVG_Charset(
        "/tmp/cbm900_hires.svg",
        cols=8,
        char_w=14,
        char_h=26,
        imargin=1,
        linewidth=2,
    )
    for i in range(128):
        l = []
        for j in range(26):
            l.append(asp.bu16(a + 10 + i * 66 + j * 2))
        s.set_char(i // 16, i % 16, l)
        y = data.Pstruct(asp, a + 8 + i * 66, ">BB32H")
        y.compact = True
    s.render()
示例#9
0
def example():
    m = mem.Stackup((FILENAME, ), nextto=__file__)
    cx = mos6500.mos6500()
    cx.m.map(m, 0xe000)

    for a, b in SYMBOLS.items():
        cx.m.set_label(a, b)

    for i in range(7):
        data.Const(cx.m, 0xe28a + i, 0xe28a + i + 1)

    a = 0xe7bf
    for i in range(5):
        y = data.Pstruct(cx.m, a, "<4B")
        a = y.hi

    y = data.Pstruct(cx.m, 0xe80a, "<4B")

    a = 0xe675
    y = data.Pstruct(cx.m, a, "<4B")
    a = y.hi
    y = data.Pstruct(cx.m, a, "<4B")

    a = 0xe962
    y = data.Pstruct(cx.m, a, "<5B")
    a = 0xe967
    y = data.Pstruct(cx.m, a, "<B")
    a = 0xe968
    y = data.Pstruct(cx.m, a, "<5B")

    a = 0xff9c
    y = data.Pstruct(cx.m, a, "<HH")

    cx.vectors()

    for i in range(6):
        cx.codeptr(0xe291 + 2 * i)

    for a in (
            0xe034,
            0xe906,
            0xe90c,
            0xe948,
            0xe96d,
            0xe972,
            0xe977,
            0xe989,
            0xe98e,
            0xe993,
            0xea33,
            0xea36,
            0xea39,
            0xea9c,
            0xeab1,
            0xff93,
            0xff96,
            0xff99,
            0xfff3,
            0xfff6,
            0xfff9,
    ):
        cx.disass(a)
        cx.m.set_line_comment(a, "MANUAL")

    return NAME, (cx.m, )
示例#10
0
 def assy_blwp1(self, pj):
     a = self['ptr']
     self.cache['blwp1'] = pj.m.bu16(a)
     data.Pstruct(pj, a, ">HH", ".BLWP\t0x%04x, 0x%04x")
     return "WP=0x%04x" % pj.m.bu16(a)
示例#11
0
def example():
    m0 = mem.Stackup(
        files=(("EPROM_C_900_boot-L_V_1.0.bin",
                "EPROM_C_900_boot-H_V_1.0.bin"), ),
        nextto=__file__,
    )

    cx = z8000.z8001()
    cx.m.map(m0, 0x00000000, 0x00006800)
    cx.m.map(m0, 0x01000000, 0x01001016, 0x00006800)
    cx.m.map(m0, 0x00007816, 0x00010000, 0x00007816)

    cx.flow_check.append(fc_outstr)
    cx.z8010_mmu(0xf8)
    cx.z8010_mmu(0xfc)

    for i, j in LABELS.items():
        cx.m.set_label(i, j)

    cx.m.set_block_comment(0x6800, "0x6800-0x7816 mapped to segment 0x1:0x0")

    # const.w32(p, 0x01000614)
    # cx.m.set_label(0x01000614, "screen_ptr")
    #cx.m.set_label(0x01001800, "is_lores")
    #cx.m.set_label(0x010017ff, "is_hires")
    #cx.m.set_label(0x01001562, "input_buffer")
    #cx.m.set_label(0x01001562, "input_buffer")

    if True:
        cx.vectors()

    if True:
        for v, a in (
            (
                "VEC0",
                0x0008,
            ),
            (
                "VEC1",
                0x0010,
            ),
            (
                "VEC2",
                0x0018,
            ),
            (
                "VEC3",
                0x0020,
            ),
            (
                "VEC4",
                0x0028,
            ),
            (
                "VEC5",
                0x0030,
            ),
        ):
            b = cx.vector(a, v)

    if True:
        switch(cx, 0x69e, 0xa)
        switch(cx, 0x31c4, 0x4)
        switch(cx, 0x39ba, 0x10)

    if True:
        for a in range(0x419e, 0x4202, 4):
            y = cx.codeptr(a)
            cx.m.set_label(y.dst, "PTR_%x" % a)

        cx.disass(0x20bc)
        cx.disass(0x3ec6)

        cx.disass(0x06da)
        cx.disass(0x0214)
        cx.disass(0x10ec)
        cx.disass(0x11a6)
        cx.disass(0x2028)
        cx.disass(0x2034)
        cx.disass(0x3bd2)

        for a in (
                0x01c0,
                0x0c0a,
                0x0c44,
                0x0e9e,
                0x0ee0,
                0x0eae,
                0x0ef0,
        ):
            cx.m.set_line_comment(a, "CALL_RR10_%x" % a)
            cx.disass(a)

        for a in range(0x3e90, 0x3ea0, 4):
            y = cx.codeptr(a)
            cx.m.set_label(y.dst, "PTR_%x" % a)

        chargendata(cx.m, 0x45fe + 0)

        for a, b, c in (
            (0x01000006, 0x0100000e, 4),
            (0x0100003e, 0x01000076, 14),
            (0x01000010, 0x0100003c, 4),
            (0x01000618, 0x01000658, 4),
            (0x01000766, 0x010007ae, 4),
            (0x010007b4, 0x010007c4, 4),
            (0x01000c1a, 0x01000c26, 4),
        ):
            while a < b:
                y1 = cx.dataptr(a)
                y2 = data.Txt(cx.m, y1.dst, align=1, label=False)
                cx.m.set_line_comment(y1.lo, '"' + y2.txt + '"')
                a += c

        for a in range(0x0100065a, 0x01000708, 6):
            data.Txt(cx.m, a, label=False, align=2)

        for a in range(0x01000c26, 0x01000e19, 6):
            y1 = data.Pstruct(cx.m, a, ">HHH")

        data.Txt(cx.m, 0x0c75, align=1, label=False)
        data.Txt(cx.m, 0x0cb1, align=1, label=False)
        for a in range(0xc4a, 0xc74, 2):
            data.Pstruct(cx.m, a, "BB")

        hd6845_tab(cx.m)

    return NAME, (cx.m, )
示例#12
0
def switch(cx, a, n):
    for i in range(n):
        y = data.Pstruct(cx.m, a + i * 2, ">H")
        b = a + n * 2 + i * 4
        z = cx.codeptr(b)
        cx.m.set_label(z.dst, "CASE_0x%x_0x%02x" % (a, y.data[0]))
def round_1(cx):
    ''' Let the disassembler loose '''

    for a, b, c in (
        (0x2448, 0x2454, 4),
        (0x3b82, 0x3b90, 4),
        (0x42e6, 0x42f2, 2),
        (0xa19c, 0xa1b4, 4),
    ):
        for i in range(a, b, c):
            cx.disass(i)
            cx.m.set_block_comment(i, "TBL @ 0x%x" % i)

    cx.m.set_label(0xa494, "KC_15_Board_Commands")
    for n, a in enumerate(range(0xa494, 0xa4b4, 4)):
        y = cx.codeptr(a)
        cx.m.set_block_comment(y.dst, "KC_15 BoardCommand=0x%x" % n)

    for a, b in (
        (0x6962, 0x6972),
        (0x6720, 0x6734),
        (0x7890, 0x78b0),
        (0x7b5c, 0x7b6c),
        (0x7e1e, 0x7e3a),
        (0x8188, 0x81a0),
        (0x8234, 0x824c),
        (0xa4e0, 0xa518),
        (0xa5b1, 0xa641),
            # (0xa641, 0xa688),
        (0xa68c, 0xa710),
        (0xa718, 0xa72c),
        (0xa734, 0xa740),
        (0xa744, 0xa748),
        (0xa750, 0xa794),
        (0xa79c, 0xa7c4),
        (0xa7c4, 0xa7c8),
        (0xa8a0, 0xa940),
        (0xa954, 0xa994),
    ):
        for i in range(a, b, 4):
            y = cx.codeptr(i)
            cx.m.set_block_comment(y.dst, "PTR @ 0x%x" % i)

    for n, a in enumerate(range(0xa641, 0xa689, 4)):
        y = cx.codeptr(a)
        cx.m.set_label(y.dst, "MODEM_0x%x" % n)

    for a, b in (
        (0xa21c, 0xa246),
        (0xa3b7, 0xa3c5),
        (0xa3d8, 0xa456),
        (0xa4b4, 0xa4de),
    ):
        for i in range(a, b, 2):
            y = data.Pstruct(cx.m, i, ">H", fmt="0x%08x")
            cx.disass(y.data[0])
            cx.m.set_block_comment(y.data[0], "TBL @ 0x%x" % i)

    for a, b in (
        (0x2602, "see 0x2612"),
        (0x2602, "via 0x09c4()"),
        (0x263e, "via 0x118"),
        (0x2694, "via 0x128"),
        (0x2e04, "See 00002bb6"),
        (0x2f02, "via 0x147d"),
        (0x3180, "via 0x09c4()"),
        (0x31c4, "via 0x12c"),
        (0x36aa, "via 0x09c4()"),
        (0x3b3e, "via 0x130"),
        (0x3b4a, "via 0x1438"),
        (0x3b58, "See 0000354e"),
        (0x3ed2, "via 0x143c"),
        (0x3ee0, "via 0x143c"),
        (0x3eee, "via 0x1440"),
        (0x3efc, "via 0x1440"),
        (0x3f08, "via 0x1444"),
        (0x3f16, "via 0x1444"),
        (0x3f24, "via 0x1448"),
        (0x3f32, "via 0x1448"),
        (0x4104, "via 0x09c4()"),
        (0x4120, "via 0x11c"),
        (0x4208, "via 0x144c"),
        (0x4214, "via 0x144c"),
        (0x4226, "via 0x09c4()"),
        (0x440e, "via 0x09c4()"),
        (0x4544, "via 0x147d"),
        (0x4548, "via 0x147d"),
        (0x46a0, "MANUAL"),
        (0x46aa, "via 0x147d"),
        (0x46c8, "MANUAL"),
        (0x49ba, "via 0x128"),
        (0x50b8, "MANUAL"),
        (0x6246, "via 0x177c"),
        (0x6312, "via 0x520"),
        (0x6738, "MANUAL"),
        (0x6940, "via 0x09c4()"),
        (0x6a0e, "via 0x520"),
        (0x6b8e, "via 0x09c4()"),
        (0x7fd4, "via 0x177c"),
        (0x8208, "via 0x520"),
        (0x82bc, "Via 0x8"),
        (0x8480, "via 0x09c4()"),
        (0x8d72, "MANUAL"),
        (0x9cb8, "via 0x520"),
        (0x9cc0, "MANUAL"),
        (0x9e88, "Wake after stop"),
        (0x9f0e, "via 0x09c4()"),
            #(0xac06, "MANUAL"),
            #(0xad58, "MANUAL"),
            #(0xad6e, "MANUAL"),
            #(0xae90, "MANUAL"),
            #(0xafd8, "MANUAL"),
            #(0xb458, "MANUAL"),
            #(0xb5f6, "MANUAL"),
            #(0xb8ca, "MANUAL"),
            #(0xbbe8, "MANUAL"),
            #(0xbc28, "MANUAL"),
            #(0x62c6, "MANUAL"),
            #(0x9756, "MANUAL"),
            #(0x9756, "MANUAL"),
    ):
        cx.disass(a)
        cx.m.set_block_comment(a, b)

    for a, b in (
        (0x1429, "XE1201_CTRL_COPY"),
        (0x1434, "MODEM_TXBUF"),
        (0x1438, "MODEM_VEC_1"),
        (0x143c, "MODEM_VEC_2"),
        (0x1440, "MODEM_VEC_3"),
        (0x1444, "MODEM_VEC_4_RAISE_DTR"),
        (0x1448, "MODEM_VEC_5_LOWER_DTR"),
        (0x144c, "MODEM_VEC_6"),
        (0x1481, "MODEM_EXPECT"),
        (0x1485, "MODEM_STATE"),
        (0x163c, "Timeout_chain"),
        (0x2374, "TEXT_TO_CONSOLE()"),
        (0x32f4, "INIT_KERNEL_05_UARTS"),
        (0x3970, "INT_MODEM_RESET"),
        (0x3b4a, "MODEM_VEC_1_XE1201"),
        (0x3b58, "MODEM_VEC_1_DUART"),
        (0x3e96, "MODEM_IS_X"),
        (0x3ede, "MODEM_VEC_2_XE1201"),
        (0x3ee0, "MODEM_VEC_2_DUART"),
        (0x3eee, "MODEM_VEC_3_XE1201"),
        (0x3efc, "MODEM_VEC_3_DUART"),
        (0x3f08, "MODEM_VEC_4_XE1201"),
        (0x3f16, "MODEM_VEC_4_DUART"),
        (0x3f24, "MODEM_VEC_5_XE1201"),
        (0x3f32, "MODEM_VEC_5_DUART"),
        (0x4208, "MODEM_VEC_6_XE1201"),
        (0x4214, "MODEM_VEC_6_DUART"),
        (0x4b0a, "MAYBE_DISK_IO_THING()"),
        (0x4cdc, "SCSI_OPERATION()"),
        (0x520c, "SCSI_D_REQ_SENSE(scsi_id=D2)"),
        (0x5596, "DO_READ_6(A1)"),
        (0x55be, "DO_WRITE_6(A1)"),
        (0x55e8, "DO_READ_DEFECT_DATA(A1)"),
        (0x5634, "DO_FORMAT_UNIT(A1)"),
        (0x565e, "DO_SEND_DIAGNOSTICS(A1)"),
        (0x5688, "DO_RECEIVE_DIAGNOSTICS(A1)"),
        (0x56aa, "DO_WRITE_BUFFER(A1)"),
        (0x56ec, "DO_READ_BUFFER(A1)"),
        (0x572e, "DO_READ_LONG_10(A1)"),
        (0x5770, "DO_WRITE_LONG_10(A1)"),
        (0x57bc, "DO_WRITE_SAME_10(A1)"),
        (0x57fe, "DO_VENDOR_X06(A1)"),
        (0x584c, "DO_VENDOR_XDA(A1)"),
        (0x5888, "DO_VENDOR_XD8(A1)"),
        (0x58c4, "DO_VENDOR_XD2(A1)"),
        (0x5902, "DO_VENDOR_XD1(A1)"),
        (0x5940, "DO_MODE_SELECT(A1)"),
        (0x596e, "DO_MODE_SENSE(A1)"),
        (0x59b4, "DO_MODE_SENSE_X03(A1)"),
        (0x59d6, "DO_SEEK(A1)"),
        (0x5b98, "INIT_KERNEL_06_DISKS"),
        (0x5d14, "DELAY_LOOP(D1)"),
        (0x5d28, "PROBE_DISK_GEOMETRY(D2)"),
        (0x5db0, "SCSI_D_MODE_SENSE_3(scsi_id=D2)"),
        (0x5dca, "SCSI_D_MODE_SENSE_4(scsi_id=D2)"),
        (0x5e6a, "SCSI_D_WAIT_STATUS(timeout=D2)"),
        (0x5e8a, "SCSI_D_WAIT_COMPLETE(timeout=D2)"),
        (0x5f16, "SCSI_D_TEST_UNIT_READY()"),
        (0x5f74, "INIT_KERNEL_11"),
        (0x5f7a, "SAVECORE()"),
        (0x6072, "SCSI_D_WRITE_10_SOMETHING(scsi_id=D0,src=D4,blockno=D6)"),
        (0x66a8, "INIT_KERNEL_10"),
        (0x8398, "BOUNCE_TO_FS"),
        (0x8acc, "INIT_KERNEL_04"),
        (0x8bec, "Stuff_Response_Fifo(A1)"),
        (0x8df0, "GET_SECTOR_BUFFER([A0+0x13].B => A1)"),
        (0x8e12, "CONFIG_IO_MAP()"),
        (0x8eb4, "INIT_KERNEL_03_FIFO"),
        (0x9ad0, "INIT_KERNEL_07"),
        (0x9c40, "INIT_KERNEL"),
        (0x9cee, "INIT_KERNEL_01"),
        (0x9d6e, "Timeout_Stop_PIT(A1)"),
        (0x9d8e, "Timeout_Start_PIT()"),
        (0x9dc4, "Timeout_Arm(D0=ticks,A2=entry)"),
        (0x9e00, "Timeout_Cancel(A2=entry)"),
        (0x9e6a, "Timeout_Init()"),
        (0x9e74, "AwaitInterrupt()"),
        (0x9f0e, "INIT_KERNEL_08"),
        (0x9fde, "INIT_KERNEL_09"),
        (0xa710, "SCSI_OPS_TABLE"),
        (0x4b20, "CHS512_TO_LBA1024(A0=CHAN)"),
        (0x374c, "DO_KC_15_DiagBus(D0,A0)"),
        (0x362c, "DiagBusResponse(D2)"),
    ):
        cx.m.set_label(a, b)
    for a, b in (
        (0x4b2a, "chan.drive"),
        (0x4b2e, "chan.cyl"),
        (0x4b32, "must be <= n_cyl"),
        (0x4b3a, "multiply by n_heads"),
        (0x4b40, "chan.head"),
        (0x4b44, "must be <= n_heads"),
        (0x4b5e, "multiply by n_sect.512"),
        (0x4b64, "chan.sect"),
        (0x4b68, "must be <= n_sect.512"),
        (0x4b72, "sect.512 -> sect.1024"),
        (0x4b78, "drive_desc.lba"),
        (0x1a120, "A1 = return address"),
        (0x1a12a, "length of exp name"),
        (0x1a130, "A1 now after string"),
        (0x1a14a, "1st byte after string"),
        (0x1a14c, "2nd byte after string"),
        (0x1a15a, "3rd byte after string"),
        (0x1a15c, "4th byte after string"),
    ):
        cx.m.set_line_comment(a, b)

    cx.m.set_label(0xa878, "Month_Table")
    for a in range(0xa878, 0x0a8a0, 2):
        data.Const(cx.m, a, a + 2)

    cx.m.set_block_comment(0x263e, "(Vector 0x46) MODEM.RXRDY Interrupt")
    cx.m.set_block_comment(0x2b82, "(Vector 0x42) CONSOLE.BREAK Interrupt")
    cx.m.set_block_comment(0x2ab0, "(Vector 0x49) CONSOLE.TXRDY Interrupt")
    cx.m.set_block_comment(0x2ada, "(Vector 0x45) CONSOLE.RXRDY Interrupt")
    cx.m.set_block_comment(0x36b0, "(Vector 0x48) DIAG_BUS.TXRDY Interrupt")
    cx.m.set_block_comment(0x370c, "(Vector 0x44) DIAG_BUS.RXRDY Interrupt")
    cx.m.set_block_comment(0x3970,
                           "Reset INT_MODEM by writing 3 zeros to cmd reg")
    cx.m.set_block_comment(0x3b3e, "(Vector 0x4c) INT_MODEM Interrupt (1)")
    cx.m.set_block_comment(0x4120, "(Vector 0x47) INT_MODEM Interrupt (2)")
    cx.m.set_block_comment(0x5a02, "(Vector 0x91) SCSI_D Interrupt")
    cx.m.set_block_comment(0x8c3c, "(Vector 0x4e) FIFO Interrupt")
    cx.m.set_block_comment(0x98aa, "(Vector 0x92) SCSI_T Interrupt")
    cx.m.set_block_comment(0x9e30, "(Vector 0x4f) PIT Interrupt")
示例#14
0
def data_bcd(pj, a):
	return data.Pstruct(pj, a, ">Q", "%016x", ".BCD")
示例#15
0
def example():
    m = []
    for fn, csum in FILES:
        i = mem.Stackup(files=(fn,), nextto=__file__,)
        assert sum(i.bytearray(i.lo, i.hi)) & 0xffff == csum
        m.append(i)

    charrom(m[3], m[4])

    cpu = z80.z80()
    cpu.m.map(m[0], 0x0000)
    cpu.m.map(m[1], 0x4000)
    cpu.m.map(m[2], 0xa000)

    cpu.flow_check.append(fc)

    for a, b in SYMBOLS.items():
        cpu.m.set_label(a, b)

    for a, b in IO_SYMBOLS.items():
        cpu.as_io.set_label(a, b)

    for a in range(0x3d, 0x60, 2):
        x = cpu.codeptr(a)
        cpu.m.set_line_comment(x.dst, "From tbl@0x003d")

    for a in range(0x0700, 0x0728, 2):
        x = cpu.codeptr(a)
        cpu.m.set_line_comment(x.dst, "From tbl@0x0700")

    for a in range(0x0800, 0x0810, 2):
        x = cpu.codeptr(a)
        cpu.m.set_line_comment(x.dst, "From tbl@0x0800")

    for a in range(0x0900, 0x0908, 2):
        x = cpu.codeptr(a)
        cpu.m.set_line_comment(x.dst, "From tbl@0x0900")

    for a in range(0xe00, 0xfa0, 2):
        x = cpu.codeptr(a)
        cpu.m.set_line_comment(x.dst, "From tbl@0x0e00")

    for a in range(0x0810, 0x0900, 2):
        x = cpu.dataptr(a)
        y = data.Txt(cpu.m, x.dst, term=(0x81,), label=False)
        x.lcmt = y.txt

    for a in range(0x0a45, 0x0be3, 2):
        x = cpu.dataptr(a)
        y = data.Txt(cpu.m, x.dst, term=(0x80,), label=False)
        x.lcmt = y.txt

    for a in range(0x3bb1, 0x3bd1, 2):
        x = cpu.dataptr(a)
        cpu.m.set_label(x.dst, "KBD_%x" % a)
        for i in range(29):
            try:
                y = data.Pstruct(cpu.m, x.dst + i * 5, "B" * 5, fmt=", ".join(["0x%02x"] * 5))
                y.compact = True
            except:
                pass

    hack(cpu, 0x264b)

    a = 0xa51a
    b = 0xa539
    while cpu.m[a] != 0xff:
        x = data.Pstruct(cpu.m, a, "BBB", fmt=", ".join(["0x%02x"] * 3))
        a = x.hi
        y = data.Txt(cpu.m, b, b + 0x1e, label=False)
        b = y.hi
    data.Const(cpu.m, a, a + 1)

    x = data.Pstruct(cpu.m, 0x54a7, "B" * 12, fmt=", ".join(["0x%02x"] * 12))
    x = data.Pstruct(cpu.m, 0xaddd, "B" * 12, fmt=", ".join(["0x%02x"] * 12))
    x = data.Pstruct(cpu.m, 0xa392, "B" * 12, fmt=", ".join(["0x%02x"] * 12))
    x = data.Pstruct(cpu.m, 0xa39e, "B" * 12, fmt=", ".join(["0x%02x"] * 12))
    x = data.Pstruct(cpu.m, 0xacb0, "B" * 10, fmt=", ".join(["0x%02x"] * 10))

    cpu.m.set_label(0xa2c4, "TestNames")
    for a in range(0xa2c4, 0xa384, 0x10):
        x = data.Txt(cpu.m, a, a + 0x10, label=False)

    for a in range(0xade9, 0xae21, 7):
        x = data.Txt(cpu.m, a, a + 0x7, label=True)

    menu_desc(cpu, 0x7103)
    menu_desc(cpu, 0x742b)
    menu_desc(cpu, 0x7689)

    for a, l in (
            (0xa384, 0x7),
            (0xa38b, 0x7),
            (0xae21, 0xa),
            (0xae2c, 0xc),
            (0xae38, 0x7),
            (0xae40, 0x9),
            (0xae4a, 0xa),
            (0xae54, 0xb),
            (0xae5f, 0xf),
            (0xae6f, 0x7),
            (0xae76, 0xb),
            (0xae81, 0x7),
    ):
        x = data.Txt(cpu.m, a, a + l)

    cpu.vectors(
        (
            "RESET",
            "RST08",
            "RST10",
            "RST18",
            "RST28",
            "IRQ",
            "NMI",
        )
    )

    # switch_tbl(cpu.m, 0x0dc0, cpu)
    switch_tbl(cpu.m, 0x32f8, cpu)
    switch_tbl(cpu.m, 0x334a, cpu)
    switch_tbl(cpu.m, 0x33c1, cpu)
    switch_tbl(cpu.m, 0x5328, cpu)
    switch_tbl(cpu.m, 0x5383, cpu)
    switch_tbl(cpu.m, 0x53b9, cpu)
    switch_tbl(cpu.m, 0x53a2, cpu)
    switch_tbl(cpu.m, 0x53af, cpu)

    for a in range(0x789b, 0x78bb, 2):
        y = cpu.dataptr(a)
        data.Txt(cpu.m, y.dst, term=(0x80,))

    for a in (
            0x7926,
            0x7cf7,
            0x7d03,
    ):
        data.Txt(cpu.m, a, term=(0x80,))

    if False:
        # See 0x43cc
        for a in range(0x3d, 0x58, 2):
            y = cpu.codeptr(a)
            cpu.m.set_line_comment(y.dst, "MANUAL from tbl@0x3c")

    if False:
        # See 0x493e
        for a in range(0x800, 0x900, 2):
            y = cpu.codeptr(a)
            cpu.m.set_line_comment(y.dst, "MANUAL from tbl@0x800")

    data.Pstruct(cpu.m, 0x89, "2B", fmt=", ".join(["0x%02x"] * 2))
    for a in range(0x524, 0x56c, 4):
        data.Pstruct(cpu.m, a, "4B", fmt=", ".join(["0x%02x"] * 4))

    for a, b in (
            (0x008b, "via IY"),
            (0x04f6, "via IY"),
            (0x0506, "via IY"),
            (0x0518, "via IY"),
            (0x0fc7, "via xfa0"),
            (0x0fe5, "via xfa0"),
            (0x1006, "via xfa0"),
            (0x1397, None),
            (0x5c03, "via 0xc296"),
            (0x5df9, "via 0xc296"),
            (0x5e25, "via 0xc296"),
            (0x5ecb, "via 0xc296"),
            (0x5f7f, "via 0xc296"),
            (0x5fbc, "via 0xc296"),
            (0xac5a, None),
            (0xb800, None),
            (0xb874, "via 0xc1da ptr"),
            (0xb8db, "via 0xc1d8 ptr"),
            (0xb8e2, "via 0xc1d8 ptr"),
            (0xb8e9, "via 0xc1d8 ptr"),
            (0xb8f0, "via 0xc1d8 ptr"),
            (0xb8f7, "via 0xc1d8 ptr"),
            (0xb844, None),
            (0x3916, "via 0xcf58 ptr"),
            (0x3936, "via 0xcf58 ptr"),
            (0x3948, "via 0xcf58 ptr"),
            (0x39d8, "via 0xcf58 ptr"),
    ):
        cpu.disass(a)
        if not b:
            b = "MANUAL"
        cpu.m.set_line_comment(a, b)

    y = data.Data(cpu.m, 0x4707, 0x4707 + 0x15e)

    if False:
        discover.Discover(cpu)

    return NAME, (cpu.m,)
示例#16
0
def data_double(pj, a):
	return data.Pstruct(pj, a, ">d", "%g", ".DOUBLE")
示例#17
0
def example():
    m0 = mem.Stackup(FILENAMES, nextto=__file__)

    cx = my68k20()

    cx.flow_check.append(inline_text)
    cx.trap_returns[0] = True

    cx.m.map(m0, 0x0, 0x8)
    cx.m.map(m0, 0x80000000, 0x80002000, 0x0000)
    cx.m.map(m0, 0x80004000, 0x80006000, 0x2000)
    cx.m.map(m0, 0x80002000, 0x80004000, 0x4000)
    cx.m.map(m0, 0x80006000, 0x80008000, 0x6000)
    cx.m.map(m0, 0x00070000, 0x00072000, 0x8000)
    cx.m.map(m0, 0x00072000, 0x00074000, 0xa000)
    cx.m.map(m0, 0x00074000, 0x00076000, 0xc000)
    cx.m.map(m0, 0x00076000, 0x00078000, 0xe000)

    for a, b in SYMBOLS.items():
        cx.m.set_label(a, b)

    resha_section(
        cx.m, 0x70000, {
            0: (None, cx.disass),
            1: (None, cx.disass),
            2: (None, cx.disass),
            3: (None, cx.disass),
            4: (None, cx.disass),
            5: (None, cx.disass),
        })
    resha_section(cx.m, 0x72000, {
        0: (None, cx.disass),
        2: (None, cx.disass),
        3: (None, cx.disass),
    })
    resha_section(cx.m, 0x74000, {
        0: (None, cx.disass),
        1: (None, cx.disass),
    })
    resha_section(cx.m, 0x76000, {
        0: (None, cx.disass),
    })

    cx.disass(0x80000024)
    for a in (
            0x80000072,
            0x80000156,
            0x800001c4,
            0x80000314,
            0x80000374,
            0x80000552,
            0x80002a24,
            0x80002a2c,
            0x800033ce,
            0x80003690,
            0x80004afe,
            0x80004b42,
            0x80004b68,
            0x80007e0b,
    ):
        data.Txt(cx.m, a, label=False, align=2)

    def txts(a, b, align=2, label=False):
        while a < b:
            y = data.Txt(cx.m, a, label=label, align=align, splitnl=True)
            a = y.hi

    txts(0x7063e, 0x70708, align=1)
    txts(0x712a6, 0x71308, align=1)
    txts(0x719f2, 0x71ab8, align=1)
    txts(0x74006, 0x7412c, align=1, label=True)
    txts(0x76248, 0x763b0, align=1)

    for a in range(0x76084, 0x760c8, 4):
        y = cx.dataptr(a)
        data.Txt(cx.m, y.dst)

    for a in range(0x76a4c, 0x76a54, 4):
        y = cx.dataptr(a)
        data.Txt(cx.m, y.dst)

    a = 0x765e4
    while a < 0x76656:
        w = data.Pstruct(cx.m, a, "<H", fmt="0x%x")
        y = cx.dataptr(w.hi)
        if y.dst:
            data.Txt(cx.m, y.dst)
        a = y.hi

    a = 0x7351e
    while True:
        w = data.Pstruct(cx.m, a, "<H", fmt="0x%x")
        if not w.data[0]:
            break
        y = cx.codeptr(w.hi)
        a = y.hi

    for a in range(0x7352e, 0x7353c, 4):
        y = cx.codeptr(a)
        cx.m.set_line_comment(y.dst, "VIA 0x%x" % a)

    for a in range(0x734ea, 0x7351e, 4):
        y = cx.codeptr(a)
        cx.m.set_line_comment(y.dst, "VIA 0x%x" % a)

    for a in range(0x76040, 0x76080, 4):
        y = cx.codeptr(a)
        cx.m.set_line_comment(y.dst, "VIA 0x%x" % a)

    for a in (
            0x7051c,
            0x70554,
            0x705d4,
            0x705df,
            0x705e8,
            0x705f5,
            0x70628,
            0x70746,
            0x709ea,
            0x71010,
            0x71025,
            0x71039,
            0x7104c,
            0x71b10,
            0x7200a,
            0x76128,
            0x762b0,
            0x76a0a,
            0x76a28,
            0x76a46,
            0x76990,
            0x76a46,
            0x76220,
            # 0x77666,
    ):
        data.Txt(cx.m, a)

    txts(0x800010cc, 0x80001122, align=1, label=True)
    txts(0x80001bb0, 0x80001bc2)
    txts(0x80002c14, 0x80002e04, align=1)
    txts(0x80004ece, 0x80004fbf, align=1)
    txts(0x800027ee, 0x800028ca, align=1)

    ##########
    data.Txt(cx.m, 0x8000221c, align=1)
    data.Txt(cx.m, 0x80002232, align=1, splitnl=True)
    data.Txt(cx.m, 0x8000223d, align=1, splitnl=True)
    l = []
    for a in range(0x8000228f, 0x800024a8):
        x = cx.m[a]
        if not x:
            l.append(a)
            break
        if x & 0x80:
            l.append(a)
    for i in range(len(l) - 1):
        data.Txt(cx.m, l[i], l[i + 1], align=1, label=not i)
    data.Txt(cx.m, l[-1] + 1, align=1, label=False)

    # 0x8000298e
    y = data.Txt(cx.m, 0x8000240c, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x80002481, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x8000254e, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x8000256e, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x8000257d, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x8000258c, splitnl=True, align=1)
    y = data.Txt(cx.m, 0x8000259b, splitnl=True, align=1)

    for a, b in (
        (0x704e8, None),
        (0x70708, None),
        (0x72c5e, None),
        (0x730a8, None),  # via 0x734f2
        (0x73134, None),  # via 0x734ee
        (0x73258, None),  # via 0x731b2
        (0x7338a, None),
        (0x73396, None),  # via 0x731b2
        (0x734ca, None),
        (0x733a2, None),
        (0x731b6, None),
        (0x7412e, None),
        (0x7665a, None),
        (0x74208, None),
        (0x74212, None),
        (0x77662, None),
        (
            0x8000000c,
            None,
        ),
        (
            0x80000010,
            None,
        ),
        (
            0x80000014,
            None,
        ),
        (
            0x80000018,
            None,
        ),
        (
            0x8000001c,
            None,
        ),
        (
            0x80000020,
            None,
        ),
        (
            0x800001f6,
            None,
        ),
        (
            0x80000208,
            None,
        ),
        (
            0x8000021a,
            None,
        ),
        (
            0x80001524,
            None,
        ),
        (
            0x80001566,
            None,
        ),
        (
            0x800015a8,
            None,
        ),
        (
            0x80001628,
            None,
        ),
        (
            0x800016c2,
            None,
        ),
        (
            0x80002796,
            None,
        ),
        (
            0x800027ca,
            None,
        ),
        (
            0x80002bbe,
            None,
        ),
        (
            0x80002bc4,
            None,
        ),
        (
            0x800040a0,
            None,
        ),
    ):
        cx.disass(a)
        if not b:
            b = "MANUAL"
        cx.m.set_line_comment(a, b)

    for a in range(0x80002000, 0x80002074, 4):
        cx.disass(a)

    for a in range(0x8000310e, 0x80003122, 4):
        cx.codeptr(a)

    for a in range(0x800038ce, 0x800038ee, 4):
        cx.codeptr(a)

    for a in range(0x80004000, 0x80004008, 4):
        cx.disass(a)

    for a in range(0x800043aa, 0x80004492, 6):
        y = data.Const(cx.m, a, a + 4, func=cx.m.bu32, size=4)
        z = data.Const(cx.m, y.hi, y.hi + 2, func=cx.m.bu16, size=2)
        w = cx.m.bu16(a + 4)
        w >>= 4
        w &= 0xffe
        d = 0x800043aa + w
        cx.disass(d)

    for a in range(0x80004a7a, 0x80004a98, 4):
        d = cx.m.bu32(a)
        data.Dataptr(cx.m, a, a + 4, d)
        data.Txt(cx.m, d, align=1)

    for a in range(0x800036e8, 0x800036fc, 4):
        d = cx.m.bu32(a)
        data.Dataptr(cx.m, a, a + 4, d)
        data.Txt(cx.m, d)

    data.Const(cx.m, 0x80001ffa, 0x80002000)
    data.Const(cx.m, 0x80003ffa, 0x80004000)
    data.Const(cx.m, 0x80005ffa, 0x80006000)
    data.Const(cx.m, 0x80007dfa, 0x80007e00)

    # See 0x800039e0
    data.Const(cx.m, 0x80003a2a, 0x80003a2a + 0x16)

    y = data.Pstruct(cx.m, 0x80007e84, ">L")
    y.lcmt = "Machine Number"

    d = discover.Discover(cx)

    return NAME, (cx.m, )
示例#18
0
def data_bcd(asp, a):
    y = DATA.get(a)
    if not y:
        y = data.Pstruct(asp, a, ">Q", "%016x", ".BCD")
        DATA[a] = y
    return y
示例#19
0
def task(pj, cpu):
	gpu = hp1345a.hp1345a()

	cpu.vectors(pj)

	if True:
		# screen texts
		a = 0xd95
		while a < 0xf4d:
			z = Scrtxt(pj, a)
			a = z.hi
			continue
			y = data.Pstruct(pj, a, ">HH")
			y = data.Pstruct(pj, a + 4, ">bbb")
			l = pj.m.bu16(a)
			y = data.Txt(pj, a + 7, a + 7 + l, align=1)
			a += 7 + l

		Scrtxt(pj, 0x01db)
		Scrtxt(pj, 0xea56)
		Scrtxt(pj, 0xea6a)
		Scrtxt(pj, 0xea7d)
		Scrtxt(pj, 0xee37)
		Scrtxt(pj, 0xee51)
		Scrtxt(pj, 0xfa6d)

	if True:
		n = 0
		c = {}
		while pj.m.bu16(0xfd0 + n):
			y = data.Txt(pj, 0xfd0 + n, 0xfd0 + n + 2, align=1)
			ta = 0x1062 + n
			t = pj.m.bu16(ta)
			z = data.Codeptr(pj, ta, ta + 2, t)
			z.lcmt += y.txt
			pj.todo(t, cpu.disass)
			if t not in c:
				c[t] = []
			if y.txt not in CMDS:
				print("Undoc command", y.txt)
				CMDS[y.txt] = [t, "???"]
			else:
				CMDS[y.txt][0] = t
			c[t].append(y.txt)
			n += 2
		for i in c:
			c[i].sort()
			pj.set_label(i, "CMD_" + "_".join(c[i]))

		for i in CMDS:
			c = CMDS[i]
			if c[0] == 0:
				print(i, "CMD not implemented (" + c[1] + ")")
				continue
			if c[1][0] == "?":
				print(i, "CMD not documented (%s)" % c[1][1:])
			pj.set_block_comment(c[0],
				" COMMAND " + i + " - " + c[1])

	if True:
		for a in (0x129d, 0x17e3, 0x181e, 0xe0e3, 0xee7e):
			w = pj.m.rd(a + 1) + 1
			t = pj.m.bu16(a + 4)
			for i in range(w):
				d = pj.m.bu16(t)
				data.Codeptr(pj, t, t + 2, d)
				pj.todo(d, cpu.disass)
				t += 2

	if True:
		# Random strings
		ttab(pj, 0xf019, 0xf03b)
		ttab(pj, 0xf1d1, 0xf25c)
		ttab(pj, 0xf412, 0xf44c)
		ttab(pj, 0xefd7, 0xeff7)

	if True:
		a = 0xf56e
		while pj.m.rd(a):
			y = data.Txt(pj, a, a + 6, label=False, align=1)
			a = y.hi

	if True:
		for a in range(0xf811, 0xf825, 2):
			d = pj.m.bu16(a)
			data.Codeptr(pj, a, a + 2, d)
			pj.todo(d, cpu.disass)

	if True:
		# HP1345 testpatterns
		pj.set_label(0xfbed, "IMG_PIKES_PEAK")
		pj.set_label(0xfd41, "IMG_FOCUS")
		for a0 in (0xfbed, 0xfd41):
			a = a0
			data.Const(pj, a, a + 2,
				func=pj.m.bu16, fmt="0x%x", size=2)
			l = pj.m.bu16(a)
			a += 2
			hp1345_render.svg(pj, a, a + l*2)
			while l > 0:
				gpu.disass(pj, a)
				a += 2
				l -= 1

	if True:
		# No idea, possibly length error in IMG_FOCUS ?
		data.Const(pj, 0xff17, 0xff19, fmt="0x%04x", func=pj.m.bu16, size=2)

	if True:
		# Special character handling
		b = 0xf75b
		c = 0xf778
		pj.set_label(b, "CHR_TBL_KEY")
		pj.set_label(c, "CHR_TBL_PTR")
		data.Const(pj, b, c, fmt="0x%x")
		a = c
		while b < c:
			p = pj.m.bu16(a)
			y = data.Dataptr(pj, a, a + 2, p)
			pj.set_label(p, "CHR_TBL_%02x" % pj.m.rd(b))
			while True:
				z = data.Const(pj, p, p + 2,
				    func=pj.m.bu16, fmt="0x%x", size=2)
				if pj.m.rd(p + 1) & 0x80:
					break
				p += 2
			b += 1
			a += 2

	# Stuff not accessed from anywhere

	pj.todo(0xe5a1, cpu.disass)
	pj.set_label(0xe5a1, "BOGO_TEST_ROM")
	pj.set_block_comment(0xe5a1, "Unused ROM checksum code")
	pj.set_block_comment(0xe5a1, "NB: Expects low rom at 0xc000")

	pj.set_label(0xe5ed, "TEST_IMGRAM")

	pj.todo(0xebf0, cpu.disass)

	while pj.run():
		pass

	pj.set_label(0x0291, "A=GETCHAR()")
	pj.set_label(0x02d0, "PUTCHAR(A)")
	pj.set_label(0x0312, "Y=FIND_CMD()")
	pj.set_label(0x0338, "CLEAR_SCREEN()")
	pj.set_label(0x0395, "PUTSTR(',')")
	pj.set_label(0x039a, "PUTSTR(CRNL)")
	pj.set_label(0x03a9, "memcpy(Y,X+2,@X)")
	pj.set_label(0x03b9, "GETNBR()")
	pj.set_block_comment(0x003b9, "Outputs $0x0c - Term (not comma)")
	pj.set_block_comment(0x003b9, "Outputs $0x12 - Error")
	pj.set_block_comment(0x003b9, "Outputs $0x1a = 0")
	pj.set_block_comment(0x003b9, "Outputs $0x1b - Digits")
	pj.set_block_comment(0x003b9, "Outputs $0x1f - Decimals")
	pj.set_block_comment(0x003b9, "Outputs $0x27 - Negative")
	pj.set_block_comment(0x003b9, "Outputs $0x31+32 - Number")
	pj.set_label(0x04a2, "PUTNBR(D)")
	pj.set_label(0x0bcb, "ERR_1_UNKNOWN_INSN()")
	pj.set_label(0x0bdc, "ERR_2_WRONG_NO_PARAMS()")
	pj.set_label(0x0bed, "ERR_3_XXX_OUT_OF_RANGE()")
	pj.set_label(0x0c2e, "ERR_4_ILLEGAL_CHAR()")
	pj.set_label(0x0c41, "ERR_11_NO_PLOTTER_HANDSHAKE()")
	pj.set_label(0x0c5d, "ERR_12_UNRECOG_PLOTTER()")
	pj.set_label(0x0c79, "ERR_22_FILE_NOT_OPEN_ON()")
	pj.set_label(0x0c8c, "ERR_24_NOT_IN_SCROLL_MODE()")
	pj.set_label(0x0c9f, "ERR_25_MEMORY_NOT_INIT()")
	pj.set_label(0x0cb2, "ERR_32_ALL_FILES_NOT_CONFIG()")
	pj.set_label(0x0cc5, "ERR_33_NO_DATA_TO_SCROLL()")
	pj.set_label(0x0cd8, "ERR_34_MEMORY_OVERFLOW_ON()")
	pj.set_label(0x0ceb, "ERR_35_FILE_ALREADY_OPEN_ON()")
	pj.set_label(0x0f4e, "SCR_MSG(X)")
	pj.set_label(0x0f77, "X = PREP_SCREEN()")
	pj.set_label(0x0f8e, "D = ADR2JMP(D)") 
	pj.set_label(0x0fac, "DELAY(@U)")
	pj.set_label(0x2800, "dip_switch")
	pj.set_label(0xe77e, "CMD_nop")
	pj.set_label(0xef76, "PLOT_pu_sp_lt()")
	pj.set_label(0xef90, "PLOT_SELECT_PEN(A)")
	pj.set_label(0xefb9, "PLOT_LINE_TYPE(A)")
	pj.set_label(0xf004, "PUTSTR(X+1,@X)")
	pj.set_label(0xf0c0, "SPEC_CHAR()")
	pj.set_label(0xf56e, "plotter_table")
	pj.set_label(0xf7fd, "DIAG_MODE()")
	pj.set_label(0xf825, "DIAG_HPIB_BACK2BACK()")
	pj.set_label(0xf895, "HPIB_RESET_CHIPS()")
	pj.set_label(0xf8ae, "HPIB_IFC()")
	pj.set_block_comment(0xf895, "Set reset, clear interrupt, Clr reset")
	pj.set_label(0xfa9f, "DIAG_SIGNATURE_EPROM1()")
	pj.set_label(0xfaaf, "DIAG_SIGNATURE_EPROM2()")
	pj.set_label(0xfac2, "DIAG_SIGNATURE_3000()")
	pj.set_label(0xfade, "DIAG_SIGNATURE_RAM()")
	pj.set_label(0xfaee, "DIAG_RAM()")
	pj.set_label(0xfb03, "DIAG_IMGRAM()")
	pj.set_label(0xfbcb, "DIAG_PIKES_PEAK()")
	pj.set_label(0xfbdc, "DIAG_FOCUS()")
示例#20
0
 def assy_blwp1(self):
     a = self['ptr']
     self.cache['blwp1'] = self.lang.m.bu16(a)
     if not self.lang.m.occupied(a):
         data.Pstruct(self.lang.m, a, ">HH", ".BLWP\t0x%04x, 0x%04x")
     return "WP=0x%04x" % self.lang.m.bu16(a)