
							;INPUTS:
		lea	DisAdr_opcode,a0		;a0=addr to disassem
		lea	asmline.txt,a1			;a1=ascii buffer
		bsr	DisAdr_opcode
							;OUTPUTS:
							;a0=next adr to dis
							;a1=ascii buffer
		rts
		
asmline.txt	dcb.b	70," "
		dc.b	0
		even
		
*******************************************************************************
* Motorola MC68000 Dissassemble (1 line opcode)
* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*	Will begin dissassembly from the address pointed to by a5, the ascii
* string will be -1 terminated for text-printing routine.
*
* INPUTS ;	a4 = Address of ASCII string buffer (min 80 bytes)
*		a5 = Address to start dissassembling from
*
* OUTPUTS;	a5 = next address after instruction.
*******************************************************************************
Size	    	=     %0000000000000001
EffAdr	  	=     %0000000000000010
Displ	   	=     %0000000000000100
Immed	   	=     %0000000000001000
RegField1       =     %0000000000010000
RegField2       =     %0000000000100000
WordSize	=     %0000000001000000
LongSize	=     %0000000010000000
SmallImmed      =     %0000000100000000
FlagMovem       =     %0000001000000000
FlagCmpm	=     %0000010000000000
StatusMode      =     %0000100000000000
PreDecr		=     %0001000000000000
SubCall		=     %0010000000000000
ShortBranch     =     %0100000000000000
ARegField2      =     %0000000000110000
ByteSize	=     %0000000011000000

;-------------- Align address to dissassemble
DisAdr_OPCODE:	move.l	a1,a4
		move.l	a1,d7
		move.l  a0,d0		;make copy of adr to dissassemble
		bclr    #0,d0		;make address EVEN
		move.l  d0,a5		;put back into a5

;-------------- save size field (.b,.w,.l) for later
		move.w  (a5)+,d5	;get machine code
		move.b  #$c0,d1		;mask value for 'size field'
		and.b   d5,d1		;mask it
		lea	isize(pc),a6	;ptr to save adr
		move.b  d1,(a6)		;save field size for later

;-------------- Get opcode from table
		lea	mtab(pc),a0	;ptr to opcode table
		moveq	#8,d2		;to pass name (6) and arg type (2)
get_opcode:	move.w	d5,d1		;start search -- copy opcode to d1
		and.w	(a0)+,d1	;use opcode mask
		cmp.w	(a0)+,d1	;does this opcode match?
		add.w	d2,a0		;next offset point next entry
		bne.s	get_opcode	;if not, try next

;-------------- Place Argument type in d6
		move.w  -(a0),d6	;get arg type

;-------------- copy opcode name into buffer
		lea	olen(pc),a1	;ready copy name to obuf
		moveq	#6,d2		;length of name
		move.b	d2,(a1)+	;put op_code name length in 'olen' flag
		adda.w	d2,a1		;after place for name in obuf
		subq.w	#1,d2		;move 6 bytes
copy_op:	move.b	-(a0),-(a1)	;move the name
		dbra	d2,copy_op	;loop until all done

;-------------- here code in d5 and arg type in d6, now do condition code
		move.l	a1,a0
		addq.l	#1,a0
		cmp.b	#'@',(a0)+
		beq.b	.20
		cmp.b	#'@',(a0)+
		bne.b	.201
.20		subq.l  #1,a0
		move.w  d5,d0
		lsr.w   #7,d0
		and.w   #%00011110,d0	;cond. code times 2
		lea     condlets(pc),a3
		add.w   d0,a3
		move.b  (a3)+,(a0)+
		move.b  (a3),(a0)

.201		move.w  #ShortBranch,d0
		and.w   d6,d0
		beq.b     .21
		move.w  d5,d0
		and.w   #$00FF,d0
		beq.b     .21
		lea     3(a1),a0	;offset 3 from buffer, a0
		move.b  #'.',(a0)+	;insert (.S) short branch
		move.b  #'S',(a0)	;ascii text...
.21
;-------------- adjust size and mode for MOVEP
		move.w  d5,d0
		and.w   #%1111000100111000,d0
		cmp.w   #%0000000100001000,d0
		bne.b     .22
		or.w    #%0000000000100000,d5   ;mode is x(An)
		or.b    #%10000000,(a6)		;isize
		bra.b     .23			;so size like that of MOVEM
.22
;-------------- adjust size for MOVEM
		move.w	#FlagMovem,d0
		and.w	d6,d0
		beq.b	.24
.23:		sub.b	#%1000000,(a6)		;isize
		addq.b	#1,olen-isize(a6)	;olen
		bra.b	get_suffix

.24:		move.w	#size,d0
		and.w	d6,d0
		beq.b	opcode_done

;-------------- Put correct field with op-code
get_suffix:	cmp.b   #'.',(a1)+	;get field '.' suffix
		bne.b	get_suffix	;loop util found...

		move.b  isize(pc),d0	;get size field in d0
		move.b  #'L',(a1)	;put longword (.L) in buffer
		cmp.b   #longsize,d0	;now is it really a longword?
		beq.b	or_field	;yes.. done...

		move.b  #'W',(a1)	;word (.W)
		cmp.b   #wordsize,d0	;now is it really a word?
		beq.b	or_field	;yes.. done...

		move.b  #'B',(a1)	;must be a byte (.B)
		move.b  #bytesize,d0	;set byte type specifier
or_field:	or.b    d0,d6		;OR field with d6

;-------------- On Exit.. d5=Operand Code
;			  d6=Operand type

opcode_done:	lea	olen(pc),A0		;ptr to instr-opcode ASCII
		bsr.w	msg			;print text-2-screen
		move.b	#" ",d0			;space char
		move.b	#$9,(a4)+		;\
		bsr.s	showarg
		move.l	d7,a1
		sf.b	(a4)+		;terminator (to stop printing)
		sf.b	(a4)+		;terminator (to stop printing)
		sf.b	(a4)+		;terminator (to stop printing)
		sf.b	(a4)+		;terminator (to stop printing)
		move.l	a5,a0
		rts	

*******************************************************************************
* Motorola MC680x0 Dissassembler - DISPLAY OPERAND(S)
* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*	Will dissassemble machine-code operand into assembly language ASCII 
* text format (the OPERAND of the instruction)
*
* INPUTS ;	d5 = Operand-Code (as extracted from table)
*		d6 = Operand Type in D6 (as extracted from table)
* OUTPUTS;	None.
*******************************************************************************

showarg		move.w  D5,D0			; check for no operand
		and.w   #%1111111111111000,D0	; is there a real operand?
		cmp.w   #%0100111001110000,D0	; if so proceed...
		bne.s	op_valid		; otherwise...
		rts				; no operand = exit fast.

op_valid:	lea     nameUSP(pc),A0
		move.w  D5,D0   * move to/from USP
		and.w   #%1111111111110000,D0
		cmp.w   #%0100111001100000,D0
		bne.b     .311
		move.w  D5,D0   * make mode An
		and.w   #%1111111111000111,D5
		move.w  #%0000000000001000,D1
		or.w    D1,D5
		and.w   D1,D0   * test dir.
		bne.b     .310
.300		move.l  A0,-(SP)
		bsr.w     DoOperand
		move.b	#",",d0
		bsr.w	prtchr
		move.l  (SP)+,A0
		bra.w     msg
.310		bsr.w     msg
		move.b	#",",d0
		bsr.w	prtchr
		bra.w     subr106

.311		cmp.w   #%0100111001000000,D0   * TRAP ?
		bne.b     .312

		move.b	#'#',d0
		bsr.w	prtchr

		move.w  D5,D0
		and.w   #%00001111,D0
		bra.w     show2x
.312		lea     nameSR(pc),A0
		and.w   #%1111111111000000,D0
		cmp.w   #%0100000011000000,D0
		beq.b     .310
		cmp.w   #%0100011011000000,D0
		beq.b     .300
		lea     nameCCR(pc),A0
		cmp.w   #%0100010011000000,D0
		beq.b     .300

		move.w  D6,D0   * second operand reg in 1st field?
		and.w   #ARegField2,D0
		beq.b     .201
		cmp.w   #RegField1,D0
		beq.b     .201
		bsr.w     DoOperand    * do first operand
		move.b	#",",d0
		bsr.w	prtchr
		move.w  D6,D1
		moveq   #001,D0 * assign An mode
		and.w   #ARegField2,D1
		cmp.w   #ARegField2,D1
		beq.b     .200
		moveq   #0,D0   * else is RegField2, so assign Dn mode
.200		bsr.w     ex11.10.9
		bra.w     showea

.201		move.w  D5,D0   * test for DBcc
		and.w   #%1111000011111000,D0
		cmp.w   #%0101000011001000,D0
		bne.b     .202
		and.w   #%0000000000000111,D5   * make it look like:
		or.w    #%0001010111000000,D5   *  MOVE EA=x(PC) EA=modeDn,reg

.202		move.w  D6,D0   * test for CMPM
		and.w   #FlagCmpm,D0
		beq.b     .203
		and.w   #%0000111000000111,D5   * make like MOVE.B with m. (An)+
		or.w    #%0001000011011000,D5

.203		move.w  D6,D0
		and.w   #PreDecr,D0
		beq.b     .204
		move.w  D5,D1
		and.w   #%0000111000000111,D5   * save reg's
		or.w    #%0001000000000000,D5   * fake MOVE.B
		and.w   #%0000000000001000,D1   * reg or mem?
		beq.b     .204
		or.w    #%0000000100100000,D5   * if mem, modes are -(An)

.204		move.w  D5,D0
		and.w   #%1100000000000000,D0
		bne.b     .205
		move.w  D5,D0
		and.w   #%0011000000000000,D0   * check for move with 2 EA's
		beq.b     .205
		bsr.b     DoOperand    * got one -- do source
		move.b	#",",d0
		bsr.w	prtchr

* move 1st EA to pos'n of 2nd
		bsr.w     ex11.10.9
		move.w  D5,D0
		and.w   #%0000000111000000,D0
		lsr.w   #3,D0
		and.w   #%1111000000000000,D5
		or.w    D1,D5
		or.w    D0,D5
.205

DoOperand	move.w  D5,D0   * test for bit static
		and.w   #%1111111100000000,D0
		cmp.w   #%0000100000000000,D0
		bne.b     .1

		move.b	#'#',d0
		bsr.w	prtchr

		move.w  (A5)+,D1
		and.w   #%0000000000011111,D1
		bra.b     .6
.1		move.w  D6,D0
		and.w   #SmallImmed,D0
		beq.b     .7
		move.w  D5,D0   * test for shift inst. with Dn source
		and.w   #%1111000000100000,D0
		cmp.w   #%1110000000100000,D0
		bne.b     .2
		and.w   #%1111111111000111,D5   * zero bits for Dn mode
		bra.b     .8    * go extract Dn field
.2		cmp.w   #%1110000000000000,D0
		bne.b     .3
		and.w   #%1111111111000111,D5
.3		and.w   #%1111000000000000,D0
		cmp.w   #%0111000000000000,D0   * check for moveq
		bne.b     .5

		move.b	#'#',d0
		bsr.w	prtchr
		clr.w   D0
		move.b  D5,D0
		bpl.b     .4
		move.l  D0,-(SP)

		move.b	#'-',d0
		bsr.w	prtchr
		move.l  (SP)+,D0
		ext.w   D0
		neg.w   D0
.4		bra.w     show2x
.5

;-------------- here is addq, subq, or shift inst. with 3 bit immed. data
		move.b	#'#',d0
		bsr.w	prtchr

		bsr.w     ex11.10.9       * so extract the data
		tst.w   D1      * 0 represents 8
		bne.b     .6
		moveq   #8,D1
.6		move.w  D1,D0
		bsr.w     show2x
		bra.b     .9    * show comma and continue
.7		move.w  D6,D0
		and.w   #ARegField2,D0
		cmp.w   #RegField1,D0
		bne.b     .10
.8		clr.w   D0      * mode 0
		bsr.w     ex11.10.9
		bsr.w     showea
.9		move.b	#",",d0
		bsr.w	prtchr
.10
subr106:	move.w  D6,D0
		and.w   #Displ,D0
		beq.b     .12
* here it's a branch
		move.w  D5,D0
		ext.w   D0      * test for displ in next word
		bne.b     .11
		bra.w     shoffsEP1
.11		bra.w     shoffsEP2
.12		move.w  D6,D0   * MOVEM ?
		and.w   #FlagMovem,D0
		beq.b     .14
		move.w  D5,D0
		and.w   #%0000010000000000,D0
		beq.b     .13
		move.w  (A5)+,D0	* mask is here, even if EA is 1st arg
		move.w  D0,-(SP)
		bsr.b     .14
		move.b	#",",d0
		bsr.w	prtchr
		move.w  (SP)+,D0
		bra.w     mmask1
.13		bsr.w     mmask
		move.b	#",",d0
		bsr.w	prtchr
.14		move.w  D5,D0   * change mode for LINK & UNLK
		and.w   #%1111111111110000,D0
		cmp.w   #%0100111001010000,D0
		bne.b     .15
		btst    #3,D5   * LINK?
		bne.b     .16
		bsr.b     eaep1
		move.b	#",",d0
		bsr.w	prtchr
		move.b	#'#',d0
		bsr.w	prtchr
		move.w  (A5)+,D0
		bra.w     shsigned4x
.15		bra.b     eaep2
.16
eaep1		and.w   #%1111111111000111,D5
		or.w    #%0000000000001000,D5
eaep2		move.w  D6,D0
		and.w   #EffAdr,D0
		bne.b     .1
		rts		     * was 'shstub'

* here source is effective address
.1		move.w  D6,D0
		and.w   #Immed,D0
		beq.b     .2
		bsr.w     imsrce
		move.b	#",",d0
		bsr.w	prtchr
.2		move.w  D5,D0
		and.w   #%0111111,D0
		move.w  D0,D1   * save eff. adr
		cmp.w   #%0111010,D0
		bne.b     .3
		bsr.w     shoffsEP1  * pc with displacement?
		move.b  #"(",d0
		bsr.w     prtchr
		move.b	#'P',d0
		bsr.w	prtchr
		move.b	#'C',d0
		bsr.w	prtchr

		move.b  #")",d0
		bra.w     prtchr
* + abs. short and long, immediate
.3		cmp.w   #%0111000,D0    * abs. short?
		bne.b     .4
		move.w  (A5)+,D0
		bra.w     show4x
.4		cmp.w   #%0111001,D0    * abs. long?
		bne.b     .5
		move.l  (A5)+,D0	* number
		bra.w     shoplabel
.5		cmp.w   #%0111100,D0    * immediate?
		beq.w     imsrce.d
		cmp.w   #%0111011,D0    * pc with index?
		beq.b     .6
		and.w   #%0111000,D0    * other mode 7 illegal
		cmp.w   #%0111000,D0
		bne.b     .6

		lea	_astub(pc),A0
		bra.w	msg

.6
* here mode not 7 unless pc with index
		move.w  D1,D0
		and.w   #%0000111,D1    * get reg bits
		and.w   #%0111000,D0    * get mode bits
		lsr.b   #3,D0
;
;
;
showea		bsr.b	depmode		;only use of 'depmode'
		lea	olen(pc),A0
		move.b	D3,(A0)		;length
		bra.w	msg		;print it!
;
;
;
depmode:	clr.b   d3		* holds length
		lea     obuf(pc),a0
		dbra    d0,.6

;-------------- data register direct
		bra.w     ddregdir
.6		dbra    d0,.7

;-------------- address register direct
		bra.w     daregdir
.7		dbra    d0,.8

;-------------- address register indirect

		bra.w     daregind
.8		dbra    d0,.9

;-------------- (an)+
		bsr.w     daregind
		move.b  #'+',d0
		bra.w     depbyte
.9		dbra    d0,.10

;-------------- (an)
		move.b  #'-',d0
		bsr.w     depbyte
		bra.w     daregind
.10		dbra    d0,.11

;-------------- x(an)

		move.w  (a5)+,d0
		bsr.w     shsigned4x
		bra.w     daregind
.11		dbra    d0,.12

;-------------- x(an,d/an.)
		move.w  (a5),d0
		ext.w   d0
		bsr.w     shsigned4x
		move.b  #"(",d0
		bsr.w     depbyte
		bsr.b     daregdir

;-------------- 111$
		move.b  #',',d0
		bsr.w     depbyte
.111		move.w  (a5),d1 * get number of index reg
		moveq   #12,d0
		lsr.w   d0,d1
		and.w   #%0111,d1
		move.w  (a5),d0 * an or dn?
		bmi.b     .112
		bsr.b     ddregdir
		bra.b     .113
.112		bsr.b     daregdir
.113		move.b  #'.',d0
		bsr.w     depbyte
		move.b  #'W',d0
		 move.w  (a5)+,d1
		btst    #11,d1		;(.W) or (.L) ?
		beq.b     .114
		move.b  #'L',d0
.114		bsr.w     depbyte
		move.b  #")",d0
		bra.w     depbyte
.12		move.w  (a5),d0
		ext.w   d0
	;	movem.l  d1/d3/a0,-(sp)
	;	bsr     shoffsep2
	;	movem.l  (sp)+,d1/d3/a0

		move.b  #"(",d0
		bsr.w     depbyte
		bra.b     .111
;
;       Display data register direct
;
dDRegDir:	move.b  #'D',D0
		bsr.w     depbyte
		bra.w     depreg
;
;       Display address register direct
;
dARegDir:	cmp.b   #7,D1
		bne.b     .1
		move.b  #'S',D0
		bsr.w     depbyte
		move.b  #'P',D0
		bra.w     depbyte
.1		move.b  #'A',D0
		bsr.w     depbyte
		bra.w     depreg
;
;       Display address register indirect
;
dARegInd:	move.b  #"(",D0
		bsr.w     depbyte
		bsr.b     dARegDir
		move.b  #")",D0
		bra.w     depbyte

shsigned4x:	movem.l  D1/D3/A0,-(SP)
		tst.w   D0
		bpl.b     .1
		neg.w   D0
		move.w  D0,-(SP)

		move.b	#'-',d0
		bsr.w	prtchr
		move.w  (SP)+,D0
.1		bsr.w     show4x
		movem.l  (SP)+,D1/D3/A0
		rts
  
mmask		move.w  (A5)+,D0 * get mask
mmask1
;-------------- if '-(An)', reverse bits
		move.w  D5,D1
		and.w   #%0000000000111000,D1
		cmp.w   #%0000000000100000,D1
		bne.b     .20

		moveq	#15,D3
.10		roxr.w  #1,D0
		roxl.w  #1,D1
		dbra    D3,.10
		move.w  D1,D0
.20
		moveq	#0,d1		* start with bit 0
		move.b	d1,d2		* last bit not set
		move.b	d1,d3		* no bytes deposited yet
		lea     obuf(pc),A0	* deposit bytes here

.1		btst    D1,D0
		bne.b     .2
		clr.b   D2
		bra.b     .4
* have bit 1 -- should we just put in '-'?
.2		addq.b  #1,D1   * glance next bit
		tst.b   D2      * last bit set?
		beq.b     .3
		cmp.b   #8,D1   * last D-register?
		beq.b     .3
		cmp.b   #9,D1   * first A-register?
		beq.b     .3
		cmp.b   #16,D1  * was last register?
		beq.b     .3
		btst    D1,D0   * end of range?
		beq.b     .3
		cmp.b   #'-',D2 * already have hyphen?
		beq.b     .5
		move.b  #'-',D2
		move.b  D2,(A0)+
		addq.b  #1,D3
		bra.b     .5
.3		subq.b  #1,D1
		bsr.b     mdepreg
		st      D2
.4		addq.b  #1,D1
.5		cmp.b   #16,D1
		blt.b     .1
		lea     olen(pc),A0
		move.b  D3,(A0)
		bra.w     msg

mdepreg:	movem.l  D0/D1,-(SP)
		tst.b   D3
		beq.b     .1
		cmp.b   #'-',D2
		beq.b     .1
		move.b  #'/',D0
		bsr.b     depbyte
.1		move.b  #'D',D0
		cmp.b   #8,D1
		blt.b     .2
		move.b  #'A',D0
.2		bsr.b     depbyte
		and.b   #%0111,D1
		bsr.b     depreg
		movem.l  (SP)+,D0/D1
		rts

depreg		move.b  #'0',D0
		add.b   D1,D0
depbyte		move.b  D0,(A0)+
		addq.b  #1,D3
		rts

ex11.10.9	move.w  D5,D1
		and.w   #%0000111000000000,D1
		lsr.w   #4,D1
		lsr.w   #5,D1
		rts

imsrce.d	move.w  D6,D0
		and.w   #StatusMode,D0
		beq.b     imsrce
		lea     nameSR(pc),A0
		move.w  D6,D0
		and.w   #ByteSize,D0
		cmp.w   #WordSize,D0
		bne.w     msg
		lea     3(A0),A0
		bra.w     msg
imsrce		move.b	#'#',d0
		bsr.w	prtchr

		move.w  d6,d0
		and.w   #ByteSize,D0
		cmp.w   #LongSize,D0
		bne.b     .1

		move.l  (a5),D0
		bsr.w     pseudoaddress   * no symbol if ref. outside file
		move.l  (a5)+,D0
		tst.l   D1
		bne.w     shopdlabel
		move.l  d0,-(sp)

		move.b	#'$',d0
		bsr.w	prtchr

		move.l  (sp)+,D0
		bra.w     show8x

.1		cmp.w   #WordSize,D0
		beq.b     .2
		move.w  (A5)+,D0
		bra.b     showbyte
.2		move.w  (A5)+,D0
		bra.b     show4x

showadr:	move.l  A5,D0
		bsr.w     pseudoaddress
		tst.l   D1
		bne.b     .2
		addq.l  #4,SP
		rts

.2
show6x		bsr.w     BinHex
		lea     obuf(pc),A0
		addq    #1,A0
		move.b  #6,(A0)
		bra.w     msg
showbyte	cmp.b   #' ',D0
		blt.b     show2x
		cmp.b   #126,D0
		bhi.b     show2x
		move.l  D0,-(SP)
		cmp.b   #'"',D0
		bne.b     .1
		bsr.w     prtchr
.1		move.b  #'"',D0
		bsr.w     prtchr
		move.l  (SP)+,D0
		bsr.w     prtchr
		move.b  #'"',D0
		bra.w     prtchr

show2x		cmp.b   #9,D0
		bhi.b     lshow2x
		add.b   #$30,D0
		bra.w     prtchr
lshow2x		bsr.b     BinHex
		lea     obuf(pc),A0
		addq    #5,A0
		move.b  #'$',(A0)
		subq.l  #1,A0
		move.b  #3,(A0)
		bra.w     msg
show4x		cmp.w   #$FF,D0
		bls.b     show2x
		bsr.b     BinHex
		lea     obuf(pc),A0
		addq    #3,A0
		move.b  #'$',(A0)
		subq.l  #1,A0
		move.b  #5,(A0)
		bra.w     msg
show8x		bsr.b     BinHex
		lea     olen(pc),A0
		bra.w     msg

*******************************************************************************
* Binary-2-Hexadecimal
* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
* INPUTS ;	d0 = Hex in obuf
*******************************************************************************

BinHex		lea     obuf(pc),a0
		move.b  #8,olen-obuf(a0)
		addq.l	#8,a0
		lea     hextab(pc),a1
		moveq   #8-1,d1
NextByte:	move.l	d0,d2
		and.l	#15,d2
		move.b	0(a1,d2),-(a0)
		lsr.l	#4,d0
		dbra	d1,NextByte
		rts

;limit mouse..,Slower-to nesting,escape,dist20 out of place
; search -findhelp-increase nest count enter  esc-nest count-

shopdlabel
		movem.l  D1-D3/A0/A1,-(SP)
		bsr.w     pseudoaddress
		bra.b     shpdlbl
shoffsEP1:
		move.w  (A5)+,D0
		ext.l   D0
		subq.l  #2,D0   * since added before pc advanced
shoffsEP2:
		ext.l   D0      * add displ to pc
		add.l   A5,D0
shoplabel:	movem.l  D1-D3/A0/A1,-(SP)
		bsr.w     pseudoaddress
		moveq   #0,D2
		tst.l   D1
		bne.b     shplbl
shpdlbl		moveq   #-1,D2
shplbl		lea     symtab(pc),A0
.1		move.l  (A0)+,D1
		beq.b     .5
		cmp.l   D1,D0
		bne.b     .2
		move.w  (A0),D1
		lea     sarea(pc),A0
		add.w   D1,A0
		cmp.b   #'*',1(A0)
		beq.b     .5
		cmp.b   #2,(A0)
		bne.b     .10
		cmp.b   #'.',1(A0)
		beq.b     .5
.10		bsr.w     msg
		bra.b     .7
.2		addq.l  #2,A0
		bra.b     .1
.5		tst.l   D2
		beq.b     .50	
		tst.l   D0
		beq.b     .50
		move.l  D0,-(SP)

		move.b	#'$',d0
		bsr.b	prtchr

		move.l  (SP)+,D0
.50		cmp.l   #$FFFFFF,D0
		bhi.b     .6
		movem.l  D0/D2,-(SP)
		tst.l   D0
		bne.b     .51

		move.b	#'0',d0
		bsr.b	prtchr
		bra.b     .52

.51		bsr.w     show6x
.52		movem.l  (SP)+,D0/D2
		tst.l   D2
		bne.b     .7
		tst.l   D0
		beq.b     .7
		bra.b     .7
.6		bsr.w     show8x
.7		movem.l  (SP)+,D1-D3/A0/A1
		rts

pseudoaddress:	moveq   #-1,D1
		lea     segtable(pc),A0
		moveq   #0,D4
.1		move.l  (A0)+,D1
		beq.b     .2
		move.l  (A0)+,D2
		add.l   D2,D4
		move.l  D0,D3
		sub.l   D1,D3
		bmi.b     .1	
		cmp.l   D2,D3
		bge.b     .1
		sub.l   D2,D4
		add.l   D4,D3
		move.l  D3,D0
.2		rts

prtchr		lea     obuf(pc),A1
		move.b  d0,(a1)
		move.l  A1,D2			;d2=string ptr
		moveq   #1,D3			;d3=length
		bra.b     msg1
msg		moveq	#0,d3
		move.b  (a0)+,d3		;d3=string length in bytes
		move.l  a0,d2			;string address pointer
msg1		move.l	d2,a0			;a0=string ptr
		subq.l	#1,d3			;correct length, using dbra!
copy_2_buff:	move.b	(a0)+,(a4)+		;tranfer string into buffer
		dbra	d3,copy_2_buff
		rts

_ASTUB		dc.b	6,'OPRAND'
		even
isize		dc.b	0
		even
hextab		dc.b	'0123456789ABCDEF'
		even
CONDLETS	dc.b	'T RAHILSCCCSNEEQVCVSPLMIGELTGTLE'
		even

*******************************************************************************
* Motorola MC680x0 OP_CODE Table
* ŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻŻ
*	This table contains the op-codes in binary, ascii and also the type.
* Each Op-code entry consists of 10 bytes in the format described below ;-

* FORMAT ; 	2 Bytes	;eg	$4e71		;actual binary opcode (binary)
*		6 Bytes ;eg	"NOP   "	;  "      "      "    (ascii )
*		2 Bytes ;eg	0		;type of register field
*
*******************************************************************************

mtab		dc.b	%11111111,%00000000,%00000000,%00000000,'ORI.  '
		dc.w	EFFADR!SIZE!IMMED!STATUSMODE
		dc.b	%11110001,%10111000,%00000001,%00001000,'MOVEP.'
		dc.w	EFFADR!REGFIELD2
		dc.b	%11110001,%10111000,%00000001,%10001000,'MOVEP.'
		dc.w	EFFADR!REGFIELD1
		dc.b	%11110001,%11000000,%00000001,%00000000,'BTST  '
		dc.w	EFFADR!REGFIELD1
		dc.b	%11110001,%11000000,%00000001,%01000000,'BCHG  '
		dc.w	EFFADR!REGFIELD1
		dc.b	%11110001,%11000000,%00000001,%10000000,'BCLR  '
		dc.w	EFFADR!REGFIELD1
		dc.b	%11110001,%11000000,%00000001,%11000000,'BSET  '
		dc.w	EFFADR!REGFIELD1
		dc.b	%11111111,%00000000,%00000010,%00000000,'AND.  '
		dc.w	EFFADR!SIZE!IMMED!STATUSMODE
		dc.b	%11111111,%00000000,%00000100,%00000000,'SUB.  '
		dc.w	EFFADR!SIZE!IMMED
		dc.b	%11111111,%00000000,%00000110,%00000000,'ADD.  '
		dc.w	EFFADR!SIZE!IMMED
		dc.b	%11111111,%11000000,%00001000,%00000000,'BTST  '
		dc.w	EFFADR
		dc.b	%11111111,%11000000,%00001000,%01000000,'BCHG  '
		dc.w	EFFADR
		dc.b	%11111111,%11000000,%00001000,%10000000,'BCLR  '
		dc.w	EFFADR
		dc.b	%11111111,%11000000,%00001000,%11000000,'BSET  '
		dc.w	EFFADR
		dc.b	%11111111,%00000000,%00001010,%00000000,'EOR.  '
		dc.w	EFFADR!SIZE!IMMED!STATUSMODE
		dc.b	%11111111,%00000000,%00001100,%00000000,'CMP.  '
		dc.w	EFFADR!SIZE!IMMED
		dc.b	%11110000,%00000000,%00010000,%00000000,'MOVE.B'
		dc.w	EFFADR!BYTESIZE
		dc.b	%11110000,%00000000,%00100000,%00000000,'MOVE.L'
		dc.w	EFFADR!LONGSIZE
		dc.b	%11110000,%00000000,%00110000,%00000000,'MOVE.W'
		dc.w	EFFADR!WORDSIZE
		dc.b	%11111111,%11000000,%01000000,%11000000,'MOVE  ' ;* SR
		dc.w	EFFADR
		dc.b	%11111111,%00000000,%01000000,%00000000,'NEGX. '
		dc.w	EFFADR!SIZE
		dc.b	%11110001,%11000000,%01000001,%10000000,'CHK   '
		dc.w	EFFADR!REGFIELD2
		dc.b	%11110001,%11000000,%01000001,%11000000,'LEA   '
		dc.w	EFFADR!AREGFIELD2
		dc.b	%11111111,%00000000,%01000010,%00000000,'CLR.  '
		dc.w	EFFADR!SIZE
		dc.b	%11111111,%11000000,%01000100,%11000000,'MOVE  ' ;* CCR
		dc.w	EFFADR
		dc.b	%11111111,%00000000,%01000100,%00000000,'NEG.  '
		dc.w	EFFADR!SIZE
		dc.b	%11111111,%11000000,%01000110,%11000000,'MOVE  ' ;* SR
		dc.w	EFFADR
		dc.b	%11111111,%00000000,%01000110,%00000000,'NOT.  '
		dc.w	EFFADR!SIZE
		dc.b	%11111111,%11000000,%01001000,%00000000,'NBCD  '
		dc.w	EFFADR
		dc.b	%11111111,%11111000,%01001000,%01000000,'SWAP  '
		dc.w	EFFADR
		dc.b	%11111111,%11111000,%01001000,%10000000,'EXT.W '
		dc.w	EFFADR!WORDSIZE
		dc.b	%11111111,%11111000,%01001000,%11000000,'EXT.L '
		dc.w	EFFADR!LONGSIZE
		dc.b	%11111111,%11000000,%01001000,%01000000,'PEA   '
		dc.w	EFFADR
		dc.b	%11111111,%10000000,%01001000,%10000000,'MOVEM.' ;SIZE!
		dc.w	EFFADR!FLAGMOVEM
		dc.b	%11111111,%00000000,%01001010,%00000000,'TST.  '
		dc.w	EFFADR!SIZE
		dc.b	%11111111,%11000000,%01001010,%11000000,'TAS   '
		dc.w	EFFADR
		dc.b	%11111111,%11111111,%01001010,%11111100,'ILEGAL'
		dc.w	0
		dc.b	%11111111,%10000000,%01001100,%10000000,'MOVEM.'
		dc.w	EFFADR!FLAGMOVEM
		dc.b	%11111111,%11110000,%01001110,%01000000,'TRAP  '
		dc.w	0
		dc.b	%11111111,%11111000,%01001110,%01010000,'LINK  '
		dc.w	EFFADR
		dc.b	%11111111,%11111000,%01001110,%01011000,'UNLK  '
		dc.w	EFFADR	;MOVE TO USP, MOVE FROM USP
		dc.b	%11111111,%11110000,%01001110,%01100000,'MOVE  ' * USP
		dc.w	EFFADR
		dc.b	%11111111,%11111111,%01001110,%01110000,'RESET '
		dc.w	0
		dc.b	%11111111,%11111111,%01001110,%01110001,'NOP   '
		dc.w	0
		dc.b	%11111111,%11111111,%01001110,%01110010,'STOP  '
		dc.w	0
		dc.b	%11111111,%11111111,%01001110,%01110011,'RTE   '
		dc.w	0 *RTD
		dc.b	%11111111,%11111111,%01001110,%01110101,'RTS   '
		dc.w	0
		dc.b	%11111111,%11111111,%01001110,%01110110,'TRAPV '
		dc.w	0
		dc.b	%11111111,%11111111,%01001110,%01110111,'RTR   '
		dc.w	0 *MOVEC
		dc.b	%11111111,%11000000,%01001110,%10000000,'JSR   '
		dc.w	EFFADR!SUBCALL
		dc.b	%11111111,%11000000,%01001110,%11000000,'JMP   '
		dc.w	EFFADR
		dc.b	%11110000,%11111000,%01010000,%11001000,'DB@@  '
		dc.w	EFFADR * LIE R=IRED BY SHOWARG
		dc.w	%1111111111000000,%0101000111000000
		dc.b	'SF    '
		dc.w	EFFADR
		dc.w	%1111000011000000,%0101000011000000
		dc.b	'S@@   '
		dc.w	EFFADR
		dc.w	%1111000100000000,%0101000000000000
		dc.b	'ADDQ. '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100000000,%0101000100000000
		dc.b	'SUBQ. '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111111100000000,%0110000100000000
		dc.b	'BSR.W '
		dc.w	DISPL!SUBCALL!SHORTBRANCH
		dc.w	%1111111100000000,%0110000000000000
		dc.b	'BRA.W '
		dc.w	DISPL!SHORTBRANCH
		dc.w	%1111000000000000,%0110000000000000
		dc.b	'B@@   '
		dc.w	DISPL!SHORTBRANCH
		dc.w	%1111000100000000,%0111000000000000
		dc.b	'MOVEQ '
		dc.w	REGFIELD2!SMALLIMMED
		dc.w	%1111000111000000,%1000000011000000
		dc.b	'DIVU  '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000111110000,%1000000100000000
		dc.b	'SBCD  '
		dc.w	EFFADR!PREDECR
		dc.w	%1111000111000000,%1000000111000000
		dc.b	'DIVS  '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000100000000,%1000000000000000
		dc.b	'OR.   '
		dc.w	EFFADR!SIZE!REGFIELD2
		dc.w	%1111000100000000,%1000000100000000
		dc.b	'OR.   '
		dc.w	EFFADR!SIZE!REGFIELD1
		dc.w	%1111000111000000,%1001000011000000
		dc.b	'SUB.W '
		dc.w	EFFADR!WORDSIZE!AREGFIELD2
		dc.w	%1111000111000000,%1001000111000000
		dc.b	'SUB.L '
		dc.w	EFFADR!LONGSIZE!AREGFIELD2
		dc.w	%1111000100110000,%1001000100000000
		dc.b	'SUBX. '
		dc.w	EFFADR!SIZE!PREDECR
		dc.w	%1111000100000000,%1001000000000000
		dc.b	'SUB.  '
		dc.w	EFFADR!SIZE!REGFIELD2
		dc.w	%1111000100000000,%1001000100000000
		dc.b	'SUB.  '
		dc.w	EFFADR!SIZE!REGFIELD1
		dc.w	%1111000111000000,%1011000011000000
		dc.b	'CMP.W '
		dc.w	EFFADR!WORDSIZE!AREGFIELD2
		dc.w	%1111000111000000,%1011000111000000
		dc.b	'CMP.L '
		dc.w	EFFADR!LONGSIZE!AREGFIELD2
		dc.w	%1111000100000000,%1011000000000000
		dc.b	'CMP.  '
		dc.w	EFFADR!SIZE!REGFIELD2
		dc.w	%1111000100111000,%1011000100001000
		dc.b	'CMPM. '
		dc.w	EFFADR!SIZE!FLAGCMPM
		dc.w	%1111000100000000,%1011000100000000
		dc.b	'EOR.  '
		dc.w	EFFADR!SIZE!REGFIELD1
		dc.w	%1111000111110000,%1100000100000000
		dc.b	'ABCD  '
		dc.w	EFFADR!PREDECR
		dc.w	%1111000111000000,%1100000011000000
		dc.b	'MULU  '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000111111000,%1100000101000000
		dc.b	'EXG   '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000111111000,%1100000101001000
		dc.b	'EXG   '
		dc.w	EFFADR!AREGFIELD2
		dc.w	%1111000111111000,%1100000110001000
		dc.b	'EXG   '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000111000000,%1100000111000000
		dc.b	'MULS  '
		dc.w	EFFADR!REGFIELD2
		dc.w	%1111000100000000,%1100000000000000
		dc.b	'AND.  '
		dc.w	EFFADR!SIZE!REGFIELD2
		dc.w	%1111000100000000,%1100000100000000
		dc.b	'AND.  '
		dc.w	EFFADR!SIZE!REGFIELD1
		dc.w	%1111000111000000,%1101000011000000
		dc.b	'ADD.W '
		dc.w	EFFADR!WORDSIZE!AREGFIELD2
		dc.w	%1111000111000000,%1101000111000000
		dc.b	'ADD.L '
		dc.w	EFFADR!LONGSIZE!AREGFIELD2
		dc.w	%1111000100110000,%1101000100000000
		dc.b	'ADDX. '
		dc.w	EFFADR!SIZE!PREDECR
		dc.w	%1111000100000000,%1101000000000000
		dc.b	'ADD.  '
		dc.w	EFFADR!SIZE!REGFIELD2
		dc.w	%1111000100000000,%1101000100000000
		dc.b	'ADD.  '
		dc.w	EFFADR!SIZE!REGFIELD1
		dc.w	%1111111111000000,%1110000011000000
		dc.b	'ASR   '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110000111000000
		dc.b	'ASL   '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110001011000000
		dc.b	'LSR   '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110001111000000
		dc.b	'LSL   '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110010011000000
		dc.b	'ROXR  '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110010111000000
		dc.b	'ROXL  '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110011011000000
		dc.b	'ROR   '
		dc.w	EFFADR
		dc.w	%1111111111000000,%1110011111000000
		dc.b	'ROL   '
		dc.w	EFFADR
		dc.w	%1111000100011000,%1110000000000000
		dc.b	'ASR.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000100000000
		dc.b	'ASL.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000000001000
		dc.b	'LSR.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000100001000
		dc.b	'LSL.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000000010000
		dc.b	'ROXR. '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000100010000
		dc.b	'ROXL. '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000000011000
		dc.b	'ROR.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	%1111000100011000,%1110000100011000
		dc.b	'ROL.  '
		dc.w	EFFADR!SIZE!SMALLIMMED
		dc.w	0,0
		dc.b	'????  '
		dc.w	0
		even
symtab		dc.l	0
segtable	dc.l	0
nameSR  	dc.b	2,'SR'
nameCCR		dc.b	3,'CCR'
nameUSP		dc.b	3,'USP'
sarea		dc.b	0
olen		dc.b	0
obuf		dcb.b	80,0
		even
