Welcome, Guest. Please login or register.

Author Topic: new Amiga 68K disassembler  (Read 4639 times)

Description:

0 Members and 1 Guest are viewing this topic.

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show only replies by DamageX
    • http://www.hyakushiki.net/
new Amiga 68K disassembler
« on: January 04, 2020, 04:07:23 AM »
I made a disassembler for Amiga "hunk" executables. It uses the same syntax as my compiler (NOWUT). Only recognizes code, data, bss, and reloc32 hunks. Likely to choke on other ones.

Under ideal circumstances the output can be fed back into my compiler to generate a duplicate of the original program. However this is dependant on the input program using only plain 68000 instructions, not having data mixed in the code hunk, and no extension words or short addresses because these aren't supported by the NOWUT 68K assembler yet. There is also a limit to program size because of fixed buffer allocations.

http://www.hyakushiki.net/misc/dehunk90.zip

This includes an Amiga build and a Win32 build.

example of disassembly:
Code: [Select]
; De-hunk version 0.90 : amtest.run
; number of hunks: 00000003
; first hunk: 00000000
; last hunk: 00000002
; size of hunk: 00000024  hunk load address: 0040D5B8
; size of hunk: 00000004  hunk load address: 0040D5DC
; size of hunk: 0000002C  hunk load address: 0040D5E0
; Code hunk size: 00000024
; Reloc hunk
; count: 00000001 section: 00000001
; hunk end
; Data hunk size: 00000004
; hunk end
; BSS hunk size: 0000002C
; hunk end
; end of file

        sectionbss
        resb $0000002C                            ; $0040D5E0

        sectiondata
ld0001:
        db $00,$4C,$4B,$40                        ; $0040D5DC  .LK@

        sectioncode
        asm
        move a6.d,[a7-].d                     ; $0040D5B8 2F0E
        move a7.d,a6.d                        ; $0040D5BA 2C4F
        sub $04,a7.d                          ; $0040D5BC 598F
        move $00989680,d0.d                   ; $0040D5BE 203C 0098 9680
        move d0.d,[a6+$FFFC].d                ; $0040D5C4 2D40 FFFC
lc0000:
        sub $01,[ld0001].d                    ; $0040D5C8 53B9 0040 D5DC
        bne lc0000                            ; $0040D5CE 6600 FFF8
        move $00,d0.d                         ; $0040D5D2 7000
        move a6.d,a7.d                        ; $0040D5D4 2E4E
        move [a7+].d,a6.d                     ; $0040D5D6 2C5F
        rts                                   ; $0040D5D8 4E75
        dw $7575                              ; $0040D5DA 7575
 

Offline Leo24

  • Newbie
  • *
  • Join Date: Jun 2008
  • Posts: 10
    • Show only replies by Leo24
Re: new Amiga 68K disassembler
« Reply #1 on: January 04, 2020, 10:03:20 AM »
Every tool for the m68k architecture is welcome. But the syntax is very weird. Neither Motorola nor AT&T/MIT.  .d instead of .l and attached to the operands instead of to the opcode. Where does this originate from?
« Last Edit: January 05, 2020, 04:18:11 AM by Leo24 »
 

Offline DamageXTopic starter

  • Sr. Member
  • ****
  • Join Date: Jun 2005
  • Posts: 339
    • Show only replies by DamageX
    • http://www.hyakushiki.net/
Re: new Amiga 68K disassembler
« Reply #2 on: January 05, 2020, 01:45:50 AM »
That's basically my own personal syntax used by my compiler. :) Adding different ones to the disassembler wouldn't be too hard though, mostly just a matter of different string constants...