SEC56800        equ     *
        section sec56800
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;*******************************************************************
;       56800 Opcodes
;	2-26-96
;       READ REGISTERS
;       There are 21 registers in the 56800 which are programmer
;       accessible. All other registers are considered memory
;       locations in X memory.  There are 10 registers total in
;       the OnCE port.  The following moves are register moves to
;       the OGDB which is a memory mapped register in X I/O space.
;       The opcodes are 2 16 bit words.
;
;*******************************************************************
GETPREG dc      $e04000                 ;00 move x0,x0
        dc      $800800                 ;01 move a0,x0
        dc      $800600                 ;02 move a1,x0
        dc      $800a00                 ;03 move a2,x0
        dc      $800900                 ;04 move b0,x0
        dc      $800700                 ;05 move b1,x0
        dc      $800b00                 ;06 move b2,x0
        dc      $801f00                 ;07 move la,x0
        dc      $801e00                 ;08 move lc,x0
        dc      $800c00                 ;09 move m01,x0
        dc      $801500                 ;10 move n,x0
        dc      $801800                 ;11 move omr,x0
        dc      $801000                 ;12 move r0,x0
        dc      $801100                 ;13 move r1,x0
        dc      $801200                 ;14 move r2,x0
        dc      $801300                 ;15 move r3,x0
        dc      $800f00                 ;16 move sp,x0
        dc      $801d00                 ;17 move sr,x0
	dc	$801b00			;18 move hws,x0
        dc      $800100                 ;19 move y0,x0
        dc      $800300                 ;20 move y1,x0
;****************************************************************
;       56800 Opcodes
;       WRITE REGISTER
;       All programmer registers have 21 bit opcodes.
;****************************************************************
PUTPREG
        dc      $87c000                 ;00 move #>$xxxx,x0
        dc      $87c800                 ;01 move #>$xxxx,a0
        dc      $87c600                 ;02 move #>$xxxx,a1
        dc      $87ca00                 ;03 move #>$xxxx,a2
        dc      $87c900                 ;04 move #>$xxxx,b0
        dc      $87c700                 ;05 move #>$xxxx,b1
        dc      $87cb00                 ;06 move #>$xxxx,b2
        dc      $87df00                 ;07 move #>$xxxx,la
        dc      $87de00                 ;07 move #>$xxxx,lc
        dc      $87cc00                 ;10 move #>$xxxx,m01
        dc      $87d500                 ;11 move #>$xxxx,n
        dc      $87d800                 ;12 move #>$xxxx,omr
        dc      $87d000                 ;13 move #>$xxxx,r0
        dc      $87d100                 ;14 move #>$xxxx,r1
        dc      $87d200                 ;15 move #>$xxxx,r2
        dc      $87d300                 ;16 move #>$xxxx,r3
        dc      $87cf00                 ;17 move #>$xxxx,sp
        dc      $87dd00                 ;18 move #>$xxxx,sr
	dc	$87db00			;19 move #>xxxx,hws
        dc      $87c100                 ;20 move #>$xxxx,y0
        dc      $87c300                 ;21 move #>$xxxx,y1
	dc	$000001			;end of sequence
;**********************************************************************
;       56800
;       This sequence is used to read the OnCE controller registers
;       one at a time or in groups.  This routine is normally called
;       when the debug mode is entered from a user program or when
;       the user wishes to read the OnCE controller registers similar
;       to a 56800 register.
;**********************************************************************
GETOREG
	dc	$8902		;0 read Program opcode fetch (OPDBR)
	dc      $8902		;1 read Program data bus (OPILR)
        dc      $8102		;2 read breakpoint ctr. (OCNTR)
	dc      $8202		;3 read debug control reg. (OCR)
        dc      $8402		;4 read memory address reg. (OMAR)
        dc      $8802		;5 read PDB bus transfer reg. (OGDBR)
PIPE	dc      $8a02		;6 read Program address bus Fetch (OPABFR)
        dc      $9002		;7 read Program Address EXECUTE- (OPABER)
        dc      $9302		;8 read Program Address bus Decode (OPABDR)
	dc	$9002		;9 read Program address FIFO (OPABF0)
	dc	$9002		;10 read Program address FIFO (OPABF0)
	dc      $9002		;11 read Program address FIFO (OPABF0)
	dc      $9002		;12 read Program address FIFO (OPABF0)
        dc      $0001		;end of sequence
;**********************************************************************
;       56800
;       This sequence is used to write the OnCE controller registers
;       one at a time or in groups.  This routine is normally called
;       when the debug mode is entered from a user program or when
;       the user wishes to read the OnCE controller registers similar
;       to a 56LP100 register.
;**********************************************************************
PUTOREG
	dc	$0904			;0 write program opcode fetch (OPDBR)
        dc      $0904                 ;1 write Program Data bus (OPILR)
        dc      $0104                 ;2 write breakpoint ctr. (OCNTR)
        dc      $0204                 ;3 write debug control reg. (OCR)
        dc      $0404                 ;4 write breakpoint address (OMAR)
        dc      $0804                 ;5 write transfer register (OGDBR)
        dc      $0a04                 ;6 write Program Address bus Fetch (OPABFR)
        dc      $1004                 ;7 write Program address EXECUTE (OPABER)
        dc      $1304                 ;8 write Program Address bus decode (OPABDR)
        dc      $1004                 ;9 write Program Address FIFO (OPABF0)
	dc      $1004                 ;10 write Program Address FIFO (OPABF0)
	dc      $1004                 ;11 write Program Address FIFO (OPABF0)
	dc      $1004                 ;12 write Program Address FIFO (OPABF0)

        dc      $0001                 ;end of sequence
;**********************************************************************
;       56800
;       This sequence is used to read 56800 programming model register
;       values to display.
;**********************************************************************
REGREAD dc	$4904			;write PDB no go,no ex.
        dc      $000000                 ;move reg, operand
	dc	$4904			;write PDB go,no ex.
	dc	$907f00			;move x0,x:<<$ffff
        dc      $8802			;read OPDB
        dc      $000001                 ;eos
;**********************************************************************
;       56800
;       This sequence is used to write to 56100 programming model registers.
;**********************************************************************
REGWRITE dc     $0904                 ;write PDB
        dc      $000000                 ;opcode
        dc      $4904                 ;write PDB
REGVAL  dc      $000000                 ;operand
        dc      $0001                 ;eos
;**********************************************************************
;       56800
;       This sequence is used to read Program memory.
;**********************************************************************
OPREAD  dc      $0904           ;write PDB,no go, no ex.
        dc      $87d200         ;move #$xxxx,r2 - opcode -
        dc      $4904           ;write PDB, go, no ex.
PREADPTR dc     $000000         ;#$xxxx operand
PRDLOOP dc      $4904           ;write PDB, go, no ex.
        dc      $e02200		;move p:(r2)+,x0 - opcode -
        dc      $4904		;write PDB go,no ex.        
	dc      $907f00		;move x0,x:ffff
        dc      $8802		;Read GDB, no go, no ex.
        dc      $0001           ;eos
;**********************************************************************
;       56800
;       This sequence is used to read X Data memory.
;**********************************************************************
OXREAD  dc      $0904		;write PDB,no go, no ex.
        dc      $87d200		;move #$xxxx,r2 - opcode -
        dc      $4904		;write PDB, go, no ex.
XREADPTR dc     $000000		;#$xxxx operand
XRDLOOP dc      $4904		;write PDB, go, no ex.
	dc	$f00200		;move x:(r2)+,x0 - opcode -
        dc      $4904		;write PDB go,no ex.
	dc      $907f00		;move x0,x:$ffff
        dc      $8802		;Read GDB
        dc      $0001		;eos
;**********************************************************************
;       56800
;       This sequence is used to write a value to a single
;       Program memory location.
;**********************************************************************
OPWRITE dc      $0904			;write PDB
        dc      $87d200                 ;move #$xxxx,r2 opcode
        dc      $4904			;write PDB
PWRITPTR dc     $000000                 ;#$xxxx operand
PWRLOOP dc      $0904			;write PDB
        dc      $87c000                 ;move #$xxxx,x0 opcode
        dc      $4904			;write PDB - go, no ex.
PWRITVAL dc     $000000                 ;#$xxxx operand
PWLOOP  dc      $4904			;write PDB
        dc      $e00200			;move x0,p:(r2)+ - opcode
	dc	$4904			;write PDB
	dc	$de1200			;lea (r2)- Decrement r2 since 
					;  are forced to do a post increment
					;  in the previous instruction
	dc	$4904			;write PDB
	dc	$e02200			;move p:(r2)+,x0
        dc      $0001			;eos
;**********************************************************************
;       56800
;       This sequence is for block writes.  It is
;       nothing more than a repeat of the opcode in the
;       PDB register.
;**********************************************************************
MWRLOOP dc      $4008                 ;write no reg.,go,no ex.
        dc      $0001                 ;eos
;**********************************************************************
;       56800
;       This sequence is used to write to a single X
;       Data memory location.
;**********************************************************************
OXWRITE dc      $0904                 ;write PDB
        dc      $87d200                 ;move #$xxxx,r2 opcode
        dc      $4904                 ;write PDB
XWRITPTR dc     $000000                 ;#$xxxx operand
XWRLOOP dc      $0904                 ;write PDB
        dc      $87c000                 ;move #$xxxx,x0 opcode
        dc      $4904                 ;write PDB - go, no ex.
XWRITVAL dc     $000000                 ;#$xxxx operand
XWLOOP  dc      $4904                 ;write PDB
        dc      $d01600                 ;move x0,x:(r2) - opcode
	dc	$4904                 ;write PDB
	dc	$f00200			;move x:(r2)+,x0
        dc      $0001                 ;eos
;**********************************************************************
;       56800
;       This sequence is used to re-enter the User Program
;       from the debug state.  This sequence is used for Go immediate
;       from current address or Go from a new address.  When called
;       it sends the Instruction Latch value or a Jmp instruction.
;**********************************************************************
USERMODE1
	dc	$0904			;write PDB no go,no ex 
        dc      $000000			;PDB
	dc	$6910			;write PDB go, ex
	dc	$000000			;PDB
        dc      $0001

USERMODE2 dc	$0904			;write PDB no go,no ex 
        dc      $000000			;PDB
	dc      $4904			;write PDB go,no ex
        dc      $000000			;PDB
	dc	$6910			;write PDB (nop) go, ex
	dc	$e04000			;nop
        dc      $0001
;**********************************************************************
;       56800
;       Restore registers used for write sequences
;**********************************************************************
RESTOREX0 dc    $0904                 ;write PDB no go,no ex.
        dc      $87c000                 ;move #$xxxx,x0 opcode
        dc      $4904                 ;write PDB go,no ex.
X0VAL   dc      $000000                 ;#$xxxx operand
        dc      $0904                 ;write PDB no go,no ex.
        dc      $87d200                 ;move #$xxxx,r2 -opcode-
        dc      $4904                 ;write PDB go,no ex.
R0VAL   dc      $000000                 ;#$xxxx operand

;        dc      $0904                 ;write PDB no go,no ex.
;        dc      $87d500                 ;move #$xxxx,n,opcode
;        dc      $4904                 ;write PDB go, no ex.
;M0VAL   dc      $000000                 ;#$xxxx operand
	dc      $0001                 ;eos
;**********************************************************************
;       56800
;       Save register values before doing multiple write values
;**********************************************************************
SAVEX0  dc      $4904                 ;write PDB no go,no ex.
        dc      $907f00                 ;move x0,x:OGDB - opcode
        dc      $8802                 ;read GDB no go,no ex.
SAVER0  dc      $4904                 ;write PDB go,no ex.
        dc      $9a7f00                 ;move r2,x:ffff
        dc      $8802                 ;read GDB no go,no ex.
;SAVEM0  dc      $0904                 ;write PDB no go,no ex.
;        dc      $9d7f00                 ;move n,x:ffff - opcode -
;        dc      $4904                 ;write PDB go,no ex.
;        dc      $ffff00                 ;$ffff -operand -
;	dc      $8802                 ;read GDB no go, no ex.
;**********************************************************************
;       56800
;       Change M0 to $ffff
;**********************************************************************
;        dc      $0904                 ;write PDB no go,no ex.
;        dc      $87d500                 ;move #$0000,n -opcode-
;        dc      $4904                 ;write PDB go,no ex.
;        dc      $000000                 ;#$0000 -operand-
        dc      $0001                 ;eos
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
        endsec          ;end of 56800 section
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ENDSEC6         equ     *

