Beispiel #1
0
def example():
    m = mem.Stackup((FILENAME, ), nextto=__file__)
    cx = mcs48.i8748()
    cx.m.map(m, 0)

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

    gpu = hp1345a.hp1345a()

    cx.vectors()

    l = []
    for a in range(0x122, 0x200, 2):
        l.append(cx.m.bu16(a))
        gpu.disass(a, cx.m)

    for a in range(0x222, 0x2c8, 2):
        l.append(cx.m.bu16(a))
        gpu.disass(a, cx.m)

    hp1345_render.svg(cx.m, 0x122, 0x2c8, l=l)

    for a in range(0x31e, 0x400, 2):
        gpu.disass(a, cx.m)
    hp1345_render.svg(cx.m, 0x31e, 0x400)

    return NAME, (cx.m, )
Beispiel #2
0
def task(pj, cx):
	cpu = mcs48.i8748()
	gpu = hp1345a.hp1345a()

	pj.set_label(0x00a, "reset")
	pj.set_label(0x010, "int")
	pj.set_label(0x014, "tint")
	pj.set_label(0x017, "RESET_TIMER")
	pj.set_label(0x01d, "R1d")
	pj.set_label(0x032, "MEMTST")
	pj.set_label(0x048, "048")
	pj.set_label(0x06e, "06e")
	pj.set_label(0x0a1, "Ra1")
	pj.set_label(0x0ac, "0ac")
	pj.set_label(0x0c2, "0c2")
	pj.set_label(0x0d2, "0d2")
	pj.set_label(0x0d6, "0d6")
	pj.set_label(0x0de, "0de")
	pj.set_label(0x0ea, "0ea")
	pj.set_label(0x100, "ALIGN")
	pj.set_label(0x200, "ALIGN2")
	pj.set_label(0x300, "FOCUS")

	cpu.vectors(pj)

	while pj.run():
		pass

	l = []
	for a in range(0x122, 0x200, 2):
		l.append(pj.m.bu16(a))
		gpu.disass(pj, a)

	for a in range(0x222, 0x2c8, 2):
		l.append(pj.m.bu16(a))
		gpu.disass(pj, a)

	hp1345_render.svg(pj, 0x122, 0x2c8, l=l)

	for a in range(0x31e,0x400, 2):
		gpu.disass(pj, a)
	hp1345_render.svg(pj, 0x31e, 0x400)
Beispiel #3
0
	def __init__(self, pj, lo):
		f = ""
		w = pj.m.bu16(lo)
		f += ".SCRTXT\tL, %d\n" % w
		hi = lo + 2
		t = ""
		l = []
		n = 0
		gpu = hp1345a.hp1345a()
		while w > 0:
			c = pj.m.rd(hi)
			if c > 0x10:
				t += "%c" % c
				hi += 1
				w -= 1
				n += 1
			else:
				if n:
					f += ".SCRTXT\tT, '" + t + "'\n"
					l.append(t)
					t = ""
					n = 0
				hi += 1
				x = pj.m.bu16(hi)
				hi += 2
				y = pj.m.bu16(hi)
				hi += 2
				f += ".SCRTXT\tW, 0x%04x, 0x%04x\n" % (x, y)
		if n:
			f += ".SCRTXT\tT, '" + t + "'\n"
			l.append(t)

		ll = l[0].replace(" ", "_")
		pj.set_label(lo, "SCRTXT_" + ll)

		super(Scrtxt, self).__init__(pj, lo, hi, "scrtxt")
		self.fmt = f
		self.compact = True
Beispiel #4
0
def example():
    cx = mc6809.mc6809()
    cx.m.map(
        mem.Stackup((FILENAMES[0], ), nextto=__file__),
        0x0000,
    )
    cx.m.map(
        mem.Stackup((FILENAMES[1], ), nextto=__file__),
        0xe000,
    )

    s = 0
    for a in range(0x0000, 0x2000, 2):
        s += cx.m.bu16(a)
    print("SUM 0x0000-0x1fff = 0x%x" % s)

    s = 0
    for a in range(0xe000, 0x10000, 2):
        s += cx.m.bu16(a)
    print("SUM 0xe000-0xffff = 0x%x" % s)

    cx.add_ins(our_desc, our_ins)

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

    gpu = hp1345a.hp1345a()

    cx.vectors(which=("RST", "NMI", "SWI", "IRQ", "FIRQ", "SWI2"))

    if True:
        # screen texts
        a = 0xd95
        while a < 0xf4d:
            z = Scrtxt(cx.m, a)
            a = z.hi

        Scrtxt(cx.m, 0x01db)
        Scrtxt(cx.m, 0xea56)
        Scrtxt(cx.m, 0xea6a)
        Scrtxt(cx.m, 0xea7d)
        Scrtxt(cx.m, 0xee37)
        Scrtxt(cx.m, 0xee51)
        Scrtxt(cx.m, 0xfa6d)

    if True:
        n = 0
        c = {}
        while cx.m.bu16(0xfd0 + n):
            y = data.Txt(cx.m, 0xfd0 + n, 0xfd0 + n + 2, align=1)
            ta = 0x1062 + n
            t = cx.m.bu16(ta)
            z = data.Codeptr(cx.m, ta, ta + 2, t)
            z.lcmt += y.txt
            cx.disass(t)
            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()
            cx.m.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:])
            cx.m.set_block_comment(c[0], " COMMAND " + i + " - " + c[1])

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

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

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

    if True:
        for a in range(0xf811, 0xf825, 2):
            #d = cx.m.bu16(a)
            cx.codeptr(a)
            #cx.disass(d)

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

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

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

    # Stuff not accessed from anywhere

    cx.disass(0xe5a1)
    cx.m.set_block_comment(0xe5a1, "Unused ROM checksum code")
    cx.m.set_block_comment(0xe5a1, "NB: Expects low rom at 0xc000")

    cx.disass(0x1acf)
    cx.disass(0xebf0)

    cx.m.set_block_comment(0x003b9, "Outputs $0x0c - Term (not comma)")
    cx.m.set_block_comment(0x003b9, "Outputs $0x12 - Error")
    cx.m.set_block_comment(0x003b9, "Outputs $0x1a = 0")
    cx.m.set_block_comment(0x003b9, "Outputs $0x1b - Digits")
    cx.m.set_block_comment(0x003b9, "Outputs $0x1f - Decimals")
    cx.m.set_block_comment(0x003b9, "Outputs $0x27 - Negative")
    cx.m.set_block_comment(0x003b9, "Outputs $0x31+32 - Number")
    cx.m.set_block_comment(0xf895, "Set reset, clear interrupt, Clr reset")

    return NAME, (cx.m, )
Beispiel #5
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()")