---- START NEW MESSAGE --- Received: from cherry.ease.lsoft.com [209.119.0.109] by dpmail10.doteasy.com with ESMTP (SMTPD32-8.05) id A38019E01B0; Fri, 30 Jan 2004 06:00:32 -0800 Received: from PEAR.EASE.LSOFT.COM (209.119.0.19) by cherry.ease.lsoft.com (LSMTP for Digital Unix v1.1b) with SMTP id <5.00CC4BCC@cherry.ease.lsoft.com>; Fri, 30 Jan 2004 9:00:19 -0500 Received: from MITVMA.MIT.EDU by MITVMA.MIT.EDU (LISTSERV-TCP/IP release 1.8e) with spool id 8743 for PICLIST@MITVMA.MIT.EDU; Fri, 30 Jan 2004 09:00:13 -0500 Received: from MITVMA (NJE origin SMTP@MITVMA) by MITVMA.MIT.EDU (LMail V1.2d/1.8d) with BSMTP id 8998; Fri, 30 Jan 2004 08:58:58 -0500 Received: from turkey.mail.pas.earthlink.net [207.217.120.126] by mitvma.mit.edu (IBM VM SMTP Level 430) via TCP with ESMTP ; Fri, 30 Jan 2004 08:58:26 EST X-Comment: mitvma.mit.edu: Mail was sent by turkey.mail.pas.earthlink.net Received: from h-68-166-232-18.cmbrmaor.dynamic.covad.net ([68.166.232.18] helo=CONSULTA-P97R9Q.nowhere.com) by turkey.mail.pas.earthlink.net with esmtp (Exim 3.33 #1) id 1AmZAD-0005Wi-00 for PICLIST@MITVMA.MIT.EDU; Fri, 30 Jan 2004 05:58:29 -0800 References: Message-ID: Date: Fri, 30 Jan 2004 05:58:29 -0800 Reply-To: pic microcontroller discussion list Sender: pic microcontroller discussion list From: Dave Tweed Subject: Re: [PIC:] Disassemblers KISS or not To: PICLIST@MITVMA.MIT.EDU Precedence: list X-RCPT-TO: Status: U X-UIDL: 371856501 Bill Couture wrote: > Which is why any decent disassembler has to do instruction emulation and > tracking. Otherwise, all you have is a computerized opcode lookup table. > > Bill {been there, done that, have the T-shirt} Yeah, me too, although I found that an intermediate approach worked well. I wrote a disassembler that kept a table of "entry points" to executable code. You would start out by seeding this table with the hardware entry points (reset and interrupt vectors), and as the disassembler proceeded, it would add additional entries every time it encountered any sort of branch or call. When ever it got to an unconditional jump or return, it would abandon the current path and start on another unexplored entry point from the table. Eventually, it would find all of the reachable code in the system. One nice side effect of this was that the output listing already had labels for all of the entry points. Granted, they were generic labels of the form "L0001:", but it was easy to replace these with meaningful names once you figured out what the code was doing. The only things it couldn't handle were indirect jumps and calls (computed or table-driven), but these were rare enough that it was easy to identify them and add the necessary entries to the entry point table manually. I disassembled most of the TRS-80 Model 100 ROM this way. Also the floppy-disk driver. -- Dave Tweed -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body .