Assembler/Disassembler 101
Peter Gargano
peter at techedge.com.au
Mon Aug 27 22:06:14 GMT 2001
Hopefully some strange characters resulting from cutting & pasting
have been removed in this version:
-------------------------------------------------------------------
Just a quick note on how to use a disassembler and/or assembler
specifically to work with GM BINs. Further information on ASHC11,
DHC11 and BINCVT is from:
http://www.techedge.com.au/utils
mailto:peter at techedge.com.au?subject=Assembler/Disassembler
Here's the overview: The following four commands can be used to
generate a disassembly of a BIN (AMXY.BIN), re-assemble that
disassembly (with a listing), convert the assembler's S19 output
to a binary file (AMXY.BIN), and compare the newly created file with
the original BIN file.
| C:\>dhc11 amxy -ov
| C:\>ashc11 amxy.dis -l
| C:\>bincvt amxy.s19 -o=amxy.new -ov
| C:\>fc amxy.bin amxy.new
More detail:
DHC11 takes a BIN file (say AMXY.BIN), and use the information
there, along with a control file, to generate output. Here's
the control file's contents and the command to disassemble AMXY
as would be seen in a "DOS box":
| C:\>type amxy
| ;
| ; AMXY Control file
|
| input amxy.bin
| output amxy.DIS
|
| load $C000
|
| C:\>dhc11 amxy -ov
| DHC11 - 68HC11 Disassembler v1.2b (c) Copyright 2001 Tech Edge Pty. Ltd.
|
| Input file amxy.bin has 16384 bytes ($4000).
| Output file: amxy.DIS
| Code resides from $C000 to $FFFF ($4000 bytes).
| Load address: $C000
| No entry point - defaulting to disassembly from $D000 (ie. the vector @ $FFFE).
| Pass 1 found 138 new entry points.
| Pass 2 found 8 new entry points.
| Pass 3 found 0 new entry points.
| Total of 3 iteration(s) to find all code.
This produces the following "type" of output
| fill $00, 289
| db $FF, $FF, $00, $00, $00, $00, $00, $00, $00, $00
| fill $00, 2040
|;
|LD000 ldS #$01FF
| call LD87B
| ldaA #$08
| staA L5000
| ldX #$0002
This can be immediately assembled (use ASCH11) to produce a list file
that looks like this
| 244 ;
|d000 8e 01 ff 245 LD000 ldS #$01FF
|d003 bd d8 7b 246 call LD87B
|d006 86 08 247 ldaA #$08
|d008 b7 50 00 248 staA L5000
But if the DHC11 command was ...
| c:\>dhc11 amxy -ov a op
... then this forces address (the "a") and opcode (the "op") information
to be added to so the disassembly file looks like
|C6DD fill $00, 289
|C7FE db $FF, $FF, $00, $00, $00, $00, $00, $00
|C808 fill $00, 2040
|;
|D000 8E 01 FF LD000 ldS #$01FF
|D003 BD D8 7B call LD87B
|D006 86 08 ldaA #$08
|D008 B7 50 00 staA L5000
|D00B CE 00 02 ldX #$0002
|D00E FF 3F FC stX L3FFC
This is a "listing" type display direct from DHC11 and cannot
be re-assembled with ASHC11.
--------
If there's any list interest, I'll continue this series on
"using my tools".
Other topics could include how to generate a better disassembly by
using the control file's many commands, and how to modify a disassembly
to add new code, etc.
Peter.
----------------------------------------------------------------------------
To unsubscribe from gmecm, send "unsubscribe gmecm" (without the quotes)
in the body of a message (not the subject) to majordomo at lists.diy-efi.org
More information about the Gmecm
mailing list