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

6502 disassembler (was: Prodos external command oddness)



Bill Garber wrote:
> : >And thanks for the Dis-assembler BTW. It
> : >has proven to be invaluable to me. Would
> : >be nice if it recognized more of the ROM
> : >firmware calls and of course data from
> : >instruction, but other than that, it's
> : >been good for me.
> 
> I should have clarified that this is running on a PC.

Try a batch file using SED to do a
search-and-replace on the entire file.
For example, you could have A2IO.BAT:

SED %1 "HC000" "KBD"
SED %1 "HC010" "KBDSTRB"
SED %1 "HC020" "TAPEOUT"
SED %1 "HC030" "SPKR"
... etc.

When I wrote my disassembler I was trying for
a way to distribute a disassembly script that
would produce a file with comments and labels
ready for re-assembly.  It turned out that the
way I actually used the disassembler was to
get the script so it would properly disassemble
the file (code vs data, etc.) then just keep
editing the listing file to add comments,
labels, etc.  I actually removed the commands
to embed remarks and labels into the disassembly.

My disassembler will trace code.  If you give
it the old Apple II monitor and this script:

     ; APPLE II OLD MONITOR
     O $F800
     ; NMI RESET IRQ
     V $FFFA
     V $FFFC
     V $FFFE

then you will get a 60KB file.  Here are the
first and last 50 lines of the disassembly:

                        ORG     $F800

                Z00     EQU     $00
                Z01     EQU     $01
                Z20     EQU     $20
                Z21     EQU     $21
                Z22     EQU     $22
                Z23     EQU     $23
                Z24     EQU     $24
                Z25     EQU     $25
                Z26     EQU     $26
                Z27     EQU     $27
                Z28     EQU     $28
                Z29     EQU     $29
                Z2A     EQU     $2A
                Z2B     EQU     $2B
                Z2D     EQU     $2D
                Z2E     EQU     $2E
                Z2F     EQU     $2F
                Z30     EQU     $30
                Z31     EQU     $31
                Z32     EQU     $32
                Z33     EQU     $33
                Z34     EQU     $34
                Z3A     EQU     $3A
                Z3B     EQU     $3B
                Z3C     EQU     $3C
                Z3D     EQU     $3D
                Z3E     EQU     $3E
                Z3F     EQU     $3F
                Z40     EQU     $40
                Z41     EQU     $41
                Z45     EQU     $45
                Z46     EQU     $46
                Z47     EQU     $47
                Z48     EQU     $48
                Z49     EQU     $49
                Z4A     EQU     $4A

F800  4A        HF800   LSR     A
F801  08                PHP
F802  20 47 F8          JSR     HF847
F805  28                PLP
F806  A9 0F             LDA     #$0F
F808  90 02             BCC     HF80C   ;=>
F80A  69 E0             ADC     #$E0
F80C  85 2E     HF80C   STA     Z2E
F80E  B1 26             LDA     (Z26),Y
F810  45 30             EOR     Z30



FFD5  A6                .DB     $A6     ;*.*..**. "&"
FFD6  A4                .DB     $A4     ;*.*..*.. "$"
FFD7  06                .DB     $06     ;.....**.
FFD8  95                .DB     $95     ;*..*.*.*
FFD9  07                .DB     $07     ;.....***
FFDA  02                .DB     $02     ;......*.
FFDB  05                .DB     $05     ;.....*.*
FFDC  F0                .DB     $F0     ;****.... "p"
FFDD  00                .DB     $00     ;........
FFDE  EB                .DB     $EB     ;***.*.** "k"
FFDF  93                .DB     $93     ;*..*..**
FFE0  A7                .DB     $A7     ;*.*..*** "'"
FFE1  C6                .DB     $C6     ;**...**. "F"
FFE2  99                .DB     $99     ;*..**..*
FFE3  B2        HFFE3   .DB     $B2     ;*.**..*. "2"
FFE4  C9                .DB     $C9     ;**..*..* "I"
FFE5  BE                .DB     $BE     ;*.*****. ">"
FFE6  C1                .DB     $C1     ;**.....* "A"
FFE7  35                .DB     $35     ;..**.*.* '5'
FFE8  8C                .DB     $8C     ;*...**..
FFE9  C3                .DB     $C3     ;**....** "C"
FFEA  96                .DB     $96     ;*..*.**.
FFEB  AF                .DB     $AF     ;*.*.**** "/"
FFEC  17                .DB     $17     ;...*.***
FFED  17                .DB     $17     ;...*.***
FFEE  2B                .DB     $2B     ;..*.*.** '+'
FFEF  1F                .DB     $1F     ;...*****
FFF0  83                .DB     $83     ;*.....**
FFF1  7F                .DB     $7F     ;.*******
FFF2  5D                .DB     $5D     ;.*.***.* ']'
FFF3  CC                .DB     $CC     ;**..**.. "L"
FFF4  B5                .DB     $B5     ;*.**.*.* "5"
FFF5  FC                .DB     $FC     ;******.. "|"
FFF6  17                .DB     $17     ;...*.***
FFF7  17                .DB     $17     ;...*.***
FFF8  F5                .DB     $F5     ;****.*.* "u"
FFF9  03                .DB     $03     ;......**
FFFA  FB 03             .DA     H03FB
FFFC  59 FF             .DA     HFF59
FFFE  86 FA             .DA     HFA86

                H0036   EQU     $0036
                H0038   EQU     $0038
                H0200   EQU     $0200
                H03FB   EQU     $03FB
                H03FE   EQU     $03FE
                HC050   EQU     $C050
                HC051   EQU     $C051
                HC053   EQU     $C053
                HC054   EQU     $C054
                HC056   EQU     $C056

Page zero labels are listed first, then
the disassembly, and finally external
labels.

You can keep adding to the script until
you have everything disassembled.  The
script commands are A, B, C, K, L, O,
U, V, and W.

  A $1234  ->        .DA H5678    LABELED ADDRESS OF DATA
  B $1234  ->        .DB $XX      BYTE
  C $1234  ->  H1234 xxx xxxx     LABELED CODE
  K $1234  ->        xxx xxxx     UNLABELED CODE
  L $1234  ->  H1234 xxxxxxxxxxx  FORCE ADDRESS TO BE LABELED
  O $1234                         ORIGIN (OFFSET) OF CODE
  U $1234  ->        .DA H5678-1  LABELED ADDRESS-1 OF CODE (VECTOR-1)
  V $1234  ->        .DA H5678    LABELED ADDRESS OF CODE (VECTOR)
  W $1234  ->        .DW $5678    UNLABELED WORD

--
Paul
Monroe, Michigan USA