[A86] Re: TI-86 Disassembler


[Prev][Next][Index][Thread]

[A86] Re: TI-86 Disassembler





On Tue, 3 Sep 2002 18:51:56 -0500 "David Phillips" <david@acz.org>
writes:
> values.  I made a small enhancement a while ago to load symbol 
> tables
> generated by Assembly Studio 8x and it made it very useful for 
> debugging,
> since the code would then have most of the labels your source had.  


I remember hearing about that, and I really wish it wish it was in
there...


> > You gotta understand that it's very difficult to tell the 
> difference
> > between code and data, and the difference between random constants 
> and
> > meaningful pointers.  Producing a source file suitable to run 
> through
> > an assembler will probably never be a completely automated task if
> > that's what you're looking for.
> 
> What do you mean?  Any correct disassembler should produce code that 
> can be
> run through an assembler and produce the same result.  The code just 
> may not
> reflect the original code, as the disassembled output may contain 
> code where
> it was originally data and vice versa.  I could write a disassembler 
> that
> output everything as ".db" and it would work.  The problem isn't 
> strict
> correctness, it's perceived correctness.

eh... ok, yes.
For that matter you could just create a source file that was a single
.incbin line, but that would be pretty useless.  I suppose what I'm
trying to say is that it wouldn't be suitable to run through a *human*
trying to figure out what it does, modify it, then reassemble it.

For example, take this from the ROM:
;_EXMODE
5e2a  218d5d    ld      hl,#5d8d
5e2d  5f        ld      e,a
5e2e  1600      ld      d,#00
5e30  19        add     hl,de
5e31  19        add     hl,de
5e32  cd3300    call    #0033
5e35  e9        jp      (hl)

Now it would be a pretty fancy disassembler indeed that could identify
this structure, but it's clearly a jump table, starting at $5d8d, but
what's at $5d8d?  More code:
5d8d  cabb0e    jp      z,#0ebb
5d90  e1        pop     hl
5d91  f1        pop     af
5d92  cd4938    call    #3849
5d95  cde21f    call    #1fe2
5d98  cd2c22    call    #222c

The actual jump table doesn't start until $5e39, but there's no real way
of telling programatically, so it doesn't really make any sense.  The
disassembler has no way of knowing if the bytes at $5e39 should be code
or data, and unless you can recognize it, it's hard for a person to
recognize it too.  Then you have to somehow associate it with the
seemingly stray pointer in _EXMODE.  And even if the disassembler could
recognize the stuff at $5e39 as pointers, it wouldn't know they were code
pointers, so it would also have no way of telling if the routines listed
in the table were code or data.

There's no point in using a disassembler if your goal is *only* to run it
through an assembler again, you usually want something somewhat
meaningful for source code.  So technically, you could just produce
whatever would come back out of an assembler unchanged, but realistically
that's useless.

-rabidcow



  

________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today!  For your FREE software, visit:
http://dl.www.juno.com/get/web/.



Follow-Ups: