vPICdisasm - Free Mid-Range PIC Disassembler

Download the latest version of vPICdisasm source here: vpicdisasm-1.0.tar.gz.
Download a Mac OS X Intel binary (compiled on 10.4.8) of vPICdisasm here: vpicdisasm-intel-osx-1.0.gz.
Download a Linux x86 binary of vPICdisasm here: vpicdisasm-linux-x86-1.0.gz.


ChangeLog

Version 1.0 - 2007/01/06


I have formatted the README, which does a good job of explaining what vPICdisasm is and how to use it, for online viewing here.

README
vPICdisasm - Version 1.0 - 2007/1/6
Vanya A. Sergeev - vsergeev at gmail.

Table of Contents

  1. ABOUT vPICdisasm
  2. LICENSE
  3. COMPILING vPICdisasm
  4. USING vPICdisasm
  5. Ghetto Address Labels
  6. Shortcomings
  7. Source Code
  8. Sample Disassembly Outputs

1. ABOUT vPICdisasm

vPICdisasm is an PIC Mid-Range MCU family program disassembler. It supports all 35 PIC instructions, plus the two deprecated ones (”option” and “tris”) as defined by the PICmicro Mid-Range MCU Family Instruction Set, document DS31029A.

This single-pass disassembler can handle Intel HEX8, and Motorola S-Record formatted files containing valid PIC program binaries.

vPICdisasm features a handful of formatting options, including:

vPICdisasm should work on most *nix platform, including a Cygwin environment. vPICdisasm was written in C by Vanya A. Sergeev - vsergeev at gmail, and tested with the GNU C Compiler.


2. LICENSE

vPICdisasm is released under the GNU General Public License.

    You should have received a copy of the GNU General Public License
    along with this program; see the file "COPYING".  If not, visit
    http://www.gnu.org or write to the Free Software Foundation, Inc.,
    59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.

3. COMPILING vPICdisasm

Simply by running,
$ make
in the vPICdisasm project directory should compile vPICdisasm on most *nix systems, including a Cygwin environment. The Makefile is configured to use GCC to compile vPICdisasm. vPICdisasm should have no problem being compiled with “gmake”.


4. USING vPICdisasm

If you encounter any program bugs or problems, please notify the program author by email: Vanya A. Sergeev - vsergeev at gmail.


5. Ghetto Address Labels

vPICdisasm supports a unique formatting feature: Ghetto Address Labels, which few, if not any, single-pass disassemblers implement.

With the -l or - -address-label option and a supplied prefix, vPICdisasm will print a label containing the (ideally) non-numerical supplied prefix and the address of the disassembled instruction at every instruction. Also, every jump and call instruction will be formatted to jump to its designated address label.

This feature enables direct re-assembly of the vPICdisasm’s disassembly. This can be especially useful for quick modification of the PIC program assembly code without having to manually format the disassembly or adjust the relative branch, jump, and call distances with every modification to the disassembly.

The -l or - -address-label option overrides the default printing of the addresses alongside disassembly. Destination comments can still be used.

Example:
$ ./vpicdisasm -l “A_” sampleprogram.hex
vPICdisasm’s disassembly will include address labels that will look like this A_0000. For sample disassembly outputs by vPICdisasm, see the “Sample Disassembly Outputs” section.


6. Shortcomings

These features do not affect the accuracy of the disassembler’s output, and may be supported in future versions of vPICdisasm.


7. Source Code

vPICdisasm’s source code is heavily commented, because this disassembler was also a personal learning project of the author.
Operand prefixes (such as “R” for register operands or “$” for data operands) can be customized in the format_disasm.h header file.
Field width spacing of the addresses printed alongside disassembly, and the destination relative address comments can be customized in the ui_disasm.c source file.
The output file (default is stdout) can be changed in ui_disasm.c source file.
vPICdisasm uses libGIS, a free Atmel Generic, Intel HEX8, and Motorola S-Record Parser Library to parse formatted files containing PIC program binaries. libGIS is available for free under a Public Domain license here.
libGIS is compiled into vPICdisasm–it does not need to be obtained separately.


8. Sample Disassembly Outputs

Here are a few sample disassembly outputs illustrating the various formatting options and disassembly settings vPICdisasm supports:

$ ./vpicdisasm sampleprogram.hex
   0:   movlw 0x0
   1:   tris 0x06
   2:   movlw 0xFF
   3:   movwf 0x06
   4:   goto 0x004
$ ./vpicdisasm --no-addresses sampleprogram.hex
movlw 0x0
tris 0x06
movlw 0xFF
movwf 0x06
goto 0x004
$ ./vpicdisasm --literal-bin sampleprogram.hex
   0:   movlw b'00000000'
   1:   tris 0x06
   2:   movlw b'11111111'
   3:   movwf 0x06
   4:   goto 0x004
$ ./vpicdisasm -l "A_" sampleprogram.hex

org 0x000
A_000 movlw 0x0
A_001 tris 0x06
A_002 movlw 0xFF
A_003 movwf 0x06
A_004 goto A_004
end
$ ./vpicdisasm --literal-ascii sampleprogram2.hex
   0:   retlw 0x48      ; 'H'
   1:   retlw 0x45      ; 'E'
   2:   retlw 0x4C      ; 'L'
   3:   retlw 0x4C      ; 'L'
   4:   retlw 0x4F      ; 'O'
Print This Page Print This Page