[comp.sys.apple] Disassemble a GS instruction.

JWANKERL@UTCVM.BITNET ("Josef W. Wankerl") (10/23/89)

I was looking through my firmware reference manual for the routine I
can call from the miscellaneous tool set's FWEntry routine that would
disassemble a instruction.  I think I found it - INSTDSP at $F8D0.

But what I am wondering is how I can call this routine and support
various register lengths.  Somebody PLEASE correct me if I'm wrong,
but what I have to to to begin to get this thing working is to first
put the instruction I want disassembled into bank 0, set the zero page
locations $3A/$3B to point to my code I want disassembled (yes, zero
page as opposed to direct page, right?) then call FWEntry.

What kind of results can I expect from this?  I want to use GS/OS
character device output to display the disassembled instruction so

/**********************************************************************\
|*      Joe "Gonzo" Wankerl       |*|  The views expressed here are   *|
|* BITNET =>  JWANKERL@UTCVM      |*|  not necessarily yours...       *|
|*                                |*|         ...but they should be.  *|
\**********************************************************************/

dlyons@Apple.COM (David Lyons) (10/27/89)

In article <8910231327.aa23166@SMOKE.BRL.MIL> JWANKERL@UTCVM.BITNET ("Josef W. Wankerl") writes:
>I was looking through my firmware reference manual for the routine I
>can call from the miscellaneous tool set's FWEntry routine that would
>disassemble a instruction.  I think I found it - INSTDSP at $F8D0.

It looks like that routine was intended to be used for displaying 6502-style
disassemblies, not the full 65816 instruction set (if it was intended
to be used with 65816 stuff, presumably we would have documented some
way to tell it about 8/16-bit A and XY registers).

I think you'll be better off writing your *own* routine to disassemble
an instruction.  (I did that about 3 years ago for Nifty List--started
at about 4pm and was done by midnight.  I took the most straightforward
approach I could think of:  make a list of all the opcodes and the way
they look when disassembled--I used the monitor as a model.  Then make
a table of all the 3-character mnemonics.  Then make a table of the
left-hand punctuation for each addressing mode, and the right-hand
punctuation for each addressing mode, and have a table of subroutines
to print the operand value for each addressing mode.  Finally, make
a table of info for each opcode--I think I used one word per opcode.
Each word includes the mnemonic number and the addressing mode number.
The instruction length is a function of the addressing mode and, for
immediate mode, a function of the A or XY register sizes.)

If you do write your own, you have complete flexibility if you want
to make any changes (like fetching the stuff to be disassembled from
an address other than the one it's supposed to run at, for example).
-- 

 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   America Online: Dave Lyons                |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.