Sorry, I didn't realize that. Let me repost the problem here, in a nutshell:
The 7700-series mcus (what a B13 and B14 uses) are hard to disassemble because the processor can either run in 8 or 16 bit modes (as indicated by the m and x flags), and you have to know the mode to correctly disassemble each line (icky!). This means a straight disassembler is of limited use because you would have to manually walk the disassembler through the binary and tell it when the mode has changed. A dude in Japan (Mr. Kashima) wrote a simple straight disassembler (DASM77), but again, you have to manually walk it through the binary. It also doesn't know any specific registers to the 7790 (the specific mcu model used in the B13) so the output is hard to read.
Soooo, this other cool guy (Erich) wrote a C++ program that 'walks' DASM77 through the binary, and also parses the output correctly for the 7790 and notes which blocks are called by what. Way cool, but it has a problem. As it walks through the code it maintains a stack of starting addresses of code blocks that it still needs to disassemble, and the correct state of the m and x flags. When it finishes a block it moves down the stack, and every time it hits a branch or jump command it adds the destination to the stack (with the flags). All cool, except jumps can modify the flags (they return to the current block!), so they must be skimmed first to see if the flags need to be changed before proceeding further with the current block.
This next is a cut and paste from the other forum describing the exact problem:
---
What I'd like it to do is change how it handles jumps. Right now it just adds branches and jumps to the stack, both in the same manner. The problem is that branches don't affect future code, but jumps do because the jump is executed before the next line of code. So if the jump changes the X or M flags then RTS, that needs to be tracked before moving down. What I would like is to change the jump handling so it adds the jump to the stack like normal, then does a quick pass through the jump code (ignoring any branch instructions, but following new jmp instructions) checking for X and M changes, the on the end of the jump passes the changes back and continues with the original block. The jump would still get handled like normal later.
The example code below illustrates what I think the problem is:
Code:
VECTOR: UART tx interrupt address: B95A Length: 48 M:0 X:0
00B95A C238 clp #0x38 ; m:0 x:0
00B95C EB0F psh iy, ix, b, a
00B95E F8 sem ; m:1 x:0
00B95F A535 lda al, dp + 0x35 ; Read from Control register high byte
00B961 42A536 lda bl, dp + 0x36 ; Read from Receive buffer
00B964 8D1444 sta al, 0x4414
00B967 428D1544 sta bl, 0x4415
00B96B A5F0 lda al, dp + 0xf0 ; Read from UART tx interrupt control register
00B96D 2907 and al, #0x07
00B96F F04B beq 0xb9bc
00B971 3C14440246 bbc #0x02, 0x4414, 0xb9bc
00B976 2C0144100F bbs #0x10, 0x4401, 0xb98a
00B97B 64F000 ldm #0x00, dp + 0xf0 ; Write to UART tx interrupt control register
00B97E 1C014420 clb #0x20, 0x4401
00B982 20ACBC jsr 0xbcac
00B985 AD1644 lda al, 0x4416
00B988 8030 bra 0xb9ba
I added outputs to the program so you can see what its doing as it disassembles. Here's how it handles the block:
Code:
*** Code block address: B95A M:0 X:0
Adding Code block address: B9BC M:1 X:0
Adding Code block address: B9BC M:1 X:0
Adding Code block address: B98A M:1 X:0
Adding Code block address: BCAC M:1 X:0
Adding Code block address: B9BA M:1 X:0
In this case the "jsr 0xbcac" on line 00B982 works out correctly because that jump doesn't change the X or M flags, but had it the next branch added to the stack would have been added with the wrong flag. It should scan the jump for changes to the flags before moving to the next branch.
---
I've attached DASM77 and the code for Erich's program (with the debug lines I added to watch what it was doing, remove them of course to make it run correctly). Usage for the disassembler is '*** filename offset', so for a B13 type this is *** filename 8000. The output is just printf, not pointed to a file, so you have to manually pipe it to a file.
Are you intrested in working on this? Erich is too busy and I just haven't had time either.
http://www.calumsult.com/calumsu/***.zip