[cc65] da65 adventures

Date view Thread view Subject view

From: Robin Harbron (macbeth_at_tbaytel.net)
Date: 2003-11-03 05:59:42


I'm attempting to use da65 to disassemble M.U.L.E.

You can grab the binary and info file here if
you want to play along at home:
http://my.tbaytel.net/macbeth/mule.zip

So, I'd like to use da65 to generate source code that I
can then assemble with ca65 - so I did this:

    da65 -o mule.s mule.o     (this was fine)
    ca65 mule.s

And got many errors (here's a sampling):

mule.s(18261): Error #42: Symbol `pei' is already defined
mule.s(18261): Error #12: `:' expected
mule.s(18261): Error #11: Too many characters

It appears that the 65816's instruction "pei" is getting
disassembled instead of just being put in a .byte, as
an illegal opcode would be.  Maybe I'm just confused?

Anyway, I then created an info file to block most of the
large not-code areas into byte tables (info.txt is
included in the .zip above) and that got rid of those
errors (and yeah, I should have been doing this anyway):

    da65 -i info.txt -o mule.s
    ca65 mule.s

But added these errors:

mule.s(6): Error #10: Control statement expected
mule.s(6): Error #11: Too many characters

Line 6 in mule.s is:

    .setcpu "6502"

Which doesn't appear to be a valid control statement, but
that's what da65 seems to be automatically inserting.

Anyway, I delete that line, and try again:

    ca65 mule.s

errors:
mule.s(3489): Error #43: Undefined symbol `L47D9'
mule.s(3484): Error #43: Undefined symbol `L47D2'
mule.s(2702): Error #43: Undefined symbol `L56AD'
mule.s(2701): Error #43: Undefined symbol `L567C'
mule.s(1925): Error #43: Undefined symbol `L4A72'
mule.s(1898): Error #43: Undefined symbol `L4A44'

It appears that da65 can't handle situations that often happen
in self-modifying code, such as:

selfmod   lda #$ff
           lda #$00
           sta selfmod+1

Where the label refers to one or two bytes past the opcode
byte.

Now, I know I can work around this by just editing the output
from da65, or slightly better, adding to my info.txt file to
treat these areas as byte tables, but both seem sort of ugly,
and partially defeat the purpose of the info file, which is
a very cool idea, btw, Uz.

Anyway, thanks for any advice any of you can give.
-- 
Robin Harbron - macbeth_at_tbaytel.net
    http://my.tbaytel.net/macbeth
         http://www.psw.ca/

----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo_at_musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.


Date view Thread view Subject view

This archive was generated by hypermail 2.1.3 : 2003-11-03 05:46:35 CET