Scratchpad

If you are new to Scratchpad, and want full access as a Scratchpad editor, create an account!
If you already have an account, log in and have fun!!

READ MORE

Scratchpad
Advertisement

DFR[]

DFR is a free disassembler for the Fujitsu FR, written in ANSI C.

It supports mapping input file sections to memory addresses, and specifying certain disassembly formats (e.g code, vectors, data) or exclusion of memory ranges. (Unspecified areas are currently treated as code; a future version may try to distinguish code from data.)


A few lines of sample output:

100081E6  9F80 1000 0AAA              LDI:32  #0x10000AAA,R0
100081EC  CF01                        LDI:8   #0xF0,R1
100081EE  9F20                        RET:D   
100081F0  1501                         STH    R1,@R0              ; 0x10000AAA

000FFFF8  0700 0000                   DL      0x07000000          ; INT #0x01
000FFFFC  000D 55BA                   DL      0x000D55BA          ; INT #0x00

105A3ABC  0001 0004                   DR      1/4                 ; 0.25
105A3AC0  0001 0006                   DR      1/6                 ; 0.166667


Options
  -d range          -- disassemble only specified range
  -f range=address  -- map range of input file to memory address
  -h                -- display this message
  -i range=offset   -- map range of memory to input file offset
  -l                -- little-endian input file
  -m range=type     -- describe memory range (use -m? to list types)
  -o filename       -- output file
  -r                -- separate output file for each memory range
  -t address        -- equivalent to -m address,0x400=DATA:V
  -v                -- verbose
  -w options        -- output options (use -w? to list options)
  -x file           -- read options from file

Numbers are C-style. A range is start-end or start,length.

Memory types (for -m) are:

  NONE              -- do not disassemble
  UNKNOWN           -- unknown contents
  CODE              -- disassemble as code where possible
  DATA[:spec]       -- disassemble as data; spec is up to 8 of:         
                         L -- long (32-bit) data
                         N -- long (32-bit) data, no labels
                         R -- rational
                         V -- vector
                         W -- word (16-bit) data

Output options (for -w) are:

  -w cstyle         -- use C-style operands
  -w dmov           -- use alternates for DMOV
  -w dollar         -- use $ for hexadecimal
  -w filemap        -- generate input file map
  -w memorymap      -- generate memory map
  -w register       -- use AC, FP, SP
  -w shift          -- use large shift constants
  -w specials       -- use special registers
  -w stack          -- use PUSH and POP

A -w option may be turned off using -w nooption.

On startup, dfr looks for the following files:

$HOME/.dfrrc
$HOME/dfr.txt
./.dfrrc
./dfr.txt

These files, along with any specified in a -x option, may contain options as above, one per line, and comments where the first non-blank character on a line is '#' (currently comments may not appear on the same line as an option). The four predefined files are read before options on the command line; -x files are read at the point the option is encountered. Later options override earlier ones.


Further documentation and symbol support TBD. Please report bugs on the talk page.

Some suggested options for K10D firmware[]

Put this in a file dfr.txt or .dfrrc in your working directory, or use the -x option. Based on Memory layout.

# Output formatting options:
-w register,shift,stack
-w filemap,memorymap                                                            

# Split output into one file for each memory range (dfr 1.01):
-r

# File map:
-i 0x000C0000-0x000FFFFF=0x00800000
-i 0x10000000-0x107FFFFF=0x00000000
-i 0x80000000-0x80000447=0x000F03C0

# Memory map:
-m 0x000C0000-0x000C007F=DATA:L
-m 0x000C0080-0x000F8979=CODE
-m 0x000F9040-0x000F90DF=DATA:L
-m 0x000F90E0-0x000F9267=UNKNOWN
-m 0x000F9268-0x000F9AC7=DATA:L
-m 0x000F9AC8-0x000F9B0B=DATA:W
-m 0x000F9B0C-0x000F9BFF=DATA:L
-m 0x000F9C00-0x000FA01B=DATA:W
-m 0x000FA01C-0x000FA097=DATA:L
-m 0x000FA098-0x000FA0BB=DATA:W
-m 0x000FA0BC-0x000FA103=DATA:L
-m 0x000FA104-0x000FA1FF=DATA:W
-m 0x000FA200-0x000FA7BF=DATA:L
-m 0x000FA7C0-0x000FADF3=DATA:W
-m 0x000FADF4-0x000FAE47=DATA:L
-m 0x000FAE48-0x000FAE7F=DATA:W
-m 0x000FAE80-0x000FAEFF=DATA:L
-m 0x000FAF00-0x000FB067=DATA:W
-m 0x000FB068-0x000FB083=DATA:L
-m 0x000FB084-0x000FB22B=DATA:W
-m 0x000FB22C-0x000FB277=DATA:L
-m 0x000FB278-0x000FB29F=DATA:W
-m 0x000FB2A0-0x000FB303=DATA:L
-m 0x000FB304-0x000FB36B=DATA:W
-m 0x000FB36C-0x000FB407=DATA:L
-m 0x000FB408-0x000FB50B=DATA:W
-m 0x000FB50C-0x000FBF5F=DATA:L
-m 0x000FBF60-0x000FC1D3=DATA:W
-m 0x000FC1D4-0x000FC307=DATA:L
-m 0x000FC308-0x000FC35B=DATA:W
-m 0x000FC35C-0x000FC38F=DATA:L
-m 0x000FC390-0x000FC4C7=DATA:W
-m 0x000FC4C8-0x000FC55F=DATA:L
-m 0x000FC560-0x000FC57F=DATA:W
-m 0x000FC580-0x000FC5BF=DATA:L
-m 0x000FC5C0-0x000FC5F7=DATA:W
-m 0x000FC5F8-0x000FC6E7=DATA:L
-m 0x000FC6E8-0x000FC72B=DATA:W
-m 0x000FC72C-0x000FC83B=DATA:L
-m 0x000FC83C-0x000FC89F=DATA:W
-m 0x000FC8A0-0x000FC8E6=DATA:L
-m 0x000FC8E8-0x000FC90F=DATA:W
-m 0x000FC910-0x000FC95B=DATA:L
-m 0x000FC95C-0x000FF9FF=NONE
-m 0x000FFA00-0x000FFBFF=DATA:W
-m 0x000FFC00-0x000FFFFF=DATA:V
-m 0x10000000-0x10003BFF=NONE
-m 0x10003C00-0x10003FFF=DATA:V
-m 0x10004000-0x1000423F=DATA:W
-m 0x10004240-0x100060FF=NONE
-m 0x10006410-0x10007FFF=NONE
-m 0x10008000-0x10009705=CODE
-m 0x100F2050-0x100FFFFF=NONE
-m 0x105A39D0-0x105A3EC1=DATA:R
-m 0x105A3EC4-0x105A4957=DATA:W
-m 0x105A4958-0x105A5BFF=DATA:L
-m 0x80000000-0x80000447=CODE

Obtaining DFR[]

Source: http://www.kw.igs.net/~schoedel/dfr-103.zip or http://www.kw.igs.net/~schoedel/dfr-103.tar.gz

Version 1.00 2007/11/05[]

First release.

Version 1.01 2007/11/06[]

Added the -r option to split output among multiple files; begins a new file for each change of memory type or gap in memory range. Fixed some option processing problems (and, oops, broke -m?). Use ANSI standard types (uintX_t). Some output tweaks.

Version 1.02 2007/11/07[]

Some bug fixes, and the beginnings of a feature.

Version 1.03 2007/11/15[]

Fixed a stupid bug. Sorry for the delay; I'm on vacation.

Advertisement