PIC 18 Disassembler

Disassembler for Microchip's PIC 18 family.

Visit also PIC bootloader page.

Download

Download Python code (for those that have Python installed);  size=5k
Download windows executable (build from Python using py2exe), size=470k

Usage

python picdis18.py [-l] [-o outputfile] inputfile
or
picdis18.exe [-l] [-o outputfile] inputfile

History

June, 2003 - I have searched the web for a pic18 disassembler and found none, so I said I'll do it. I decided to write it in Python, after I saw how nice Mel Wilson's wrote his dispic16.py;
v0.3    added support for eeprom & configuration words;
v0.4    some options;

Features

Original code: dis18.asm Assembled with mplab, then disassembled: dis18_.asm
	RADIX DEC
	LIST P=18F252	
	#include "p18f252.inc"
	
	__CONFIG	_CONFIG1H,	_OSCS_OFF_1H & _HS_OSC_1H
	; EEPROM values:
	ORG 0xF00000	
	DE "Ok"
	
	ORG 0x0
	goto	start
	
	ORG 0x100
start	movlw	0x6
	decf	PORTA,W
	rlcf	TRISA
	addwf	0x23,W,BANKED
	addwfc	0x23,f,BANKED
	cpfslt	0x23
	cpfslt	0x23,BANKED
	btg	0x23,0,BANKED
	bc	start
	bra	start
	rcall	undeva
	call	undeva,FAST
	push
	pop
	
undeva	tblrd*+	
	lfsr	0x2,0xBAC
	movff	0x123,0x456	
	movff	WREG,STATUS	
	return	FAST
	END

    
	;Select your processor
	LIST      P=18F252		; modify this
	#include "p18f252.inc"		; and this

	__CONFIG 300000h, FAFFh
	;eeprom:
	ORG F00000h
	DE 6B4Fh

	ORG 0x0
	goto	p__100

	ORG 0x100
p__100	movlw	6			; entry from: 0,110h,112h
	decf	PORTA,W
	rlcf	TRISA
	addwf	23h,W,BANKED
	addwfc	23h,f,BANKED
	cpfslt	23h
	cpfslt	23h,BANKED
	btg	23h,0,BANKED
	bc	p__100
	bra	p__100
	rcall	p__11E
	call	p__11E,FAST
	push
	pop

p__11E	tblrd*+				; entry from: 114h,116h
	lfsr	2,0BACh
	movff	123h,456h
	movff	WREG,STATUS
	return	FAST
	END

	
 
 python picdis18.py -l -o dis18_.lst dis18.hex
 
		;Select your processor
		LIST      P=18F252		; modify this
		#include "p18f252.inc"		; and this

300000 FAFF
		;eeprom:
F00000 6B4F


00000 EF80		goto	p__100
00002 F000		;nil
00100 0E06	p__100	movlw	6			; entry from: 0,110h,112h
00102 0480		decf	PORTA,W
00104 3692		rlcf	TRISA
00106 2523		addwf	23h,W,BANKED
00108 2323		addwfc	23h,f,BANKED
0010A 6023		cpfslt	23h
0010C 6123		cpfslt	23h,BANKED
0010E 7123		btg	23h,0,BANKED
00110 E2F7		bc	p__100
00112 D7F6		bra	p__100
00114 D804		rcall	p__11E
00116 ED8F		call	p__11E,FAST
00118 F000		;nil
0011A 0005		push
0011C 0006		pop
0011E 0009	p__11E	tblrd*+				; entry from: 114h,116h
00120 EE2B		lfsr	2,0BACh
00122 F0AC		;nil
00124 C123		movff	123h,456h
00126 F456		;nil
00128 CFE8		movff	WREG,STATUS
0012A FFD8		;nil
0012C 0013		return	FAST
	END