SEC56KLP         equ     *
        section sec56klp
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
;*******************************************************************
;       56100 Opcodes
;       READ REGISTERS
;       There are 29 registers in the 56100 which are programmer
;       accessible. All other registers are considered memory
;       locations in X memory.  There are 14 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 24 bits wide since the upper byte of the
;       movep reg,x:xx instructions are all zeros.
;*******************************************************************
GETPREG
        dc      $000000                 ;blank for a
        dc      $38d400                 ;01 move a0,x:ffff
        dc      $399400                 ;02 move a1,x:ffff
        dc      $39d400                 ;03 move a2,x:ffff
        dc      $39d400                 ;blank for b but leave a2 opcode
        dc      $38f400                 ;05 move b0,x:ffff
        dc      $39b400                 ;06 move b1,x:ffff
        dc      $39f400                 ;07 move b2,x:ffff
        dc      $39f400                 ;blank for bcr but leave b2 opcode
        dc      $39f400                 ;blank for ipr but leave b2 opcode
        dc      $3b5400                 ;10 move la,x:ffff
        dc      $391400                 ;11 move lc,x:ffff
        dc      $3a9400                 ;12 move m0,x:ffff
        dc      $3ab400                 ;13 move m1,x:ffff
        dc      $3ad400                 ;14 move m2,x:ffff
        dc      $3af400                 ;15 move m3,x:ffff
        dc      $3b9400                 ;16 move n0,x:ffff
        dc      $3bb400                 ;17 move n1,x:ffff
        dc      $3bd400                 ;18 move n2,x:ffff
        dc      $3bf400                 ;19 move n3,x:ffff
        dc      $395400                 ;20 move omr,x:ffff
        dc      $395400                 ;blank for pc. but leave omr opcode
        dc      $3a1400                 ;22 move r0,x:ffff
        dc      $3a3400                 ;23 move r1,x:ffff
        dc      $3a5400                 ;24 move r2,x:ffff
        dc      $3a7400                 ;25 move r3,x:ffff
        dc      $397400                 ;26 move sp,x:ffff
        dc      $393400                 ;27 move sr,x:ffff
        dc      $3b1400                 ;28 move ssh,x:ffff
        dc      $3b3400                 ;29 move ssl,x:ffff
        dc      $183f00                 ;blank for x but leave x0 opcode
        dc      $183f00                 ;31 move x0,x:ffff
        dc      $385400                 ;32 move x1,x:ffff
        dc      $385400                 ;blank for y but leave x1 opcode
        dc      $187f00                 ;34 move y0,x:ffff
        dc      $387400                 ;35 move y1,x:ffff
;****************************************************************
;       56100 Opcodes
;       WRITE REGISTER
;       All programmer registers have 24 bit opcodes.
;       The last seven registers have to be 32 bit opcode loads.
;****************************************************************
PUTPREG
        dc      $000000                 ;blank for a
        dc      $3cdc00                 ;1  move #>$xxxx,a0
        dc      $3d9c00                 ;2  move #>$xxxx,a1
        dc      $3ddc00                 ;3  move #>$xxxx,a2
        dc      $000000                 ;blank for b
        dc      $3cfc00                 ;5  move #>$xxxx,b0
        dc      $3dbc00                 ;6  move #>$xxxx,b1
        dc      $3dfc00                 ;7  move #>$xxxx,b2
        dc      $000000                 ;blank for bcr
        dc      $000000                 ;blank for ipr
        dc      $3f5c00                 ;10 move #>$xxxx,la
        dc      $3d1c00                 ;11 move #>$xxxx,lc
        dc      $3e9c00                 ;12 move #>$xxxx,m0
        dc      $3ebc00                 ;13 move #>$xxxx,m1
        dc      $3edc00                 ;14 move #>$xxxx,m2
        dc      $3efc00                 ;15 move #>$xxxx,m3
        dc      $3f9c00                 ;16 move #>$xxxx,n0
        dc      $3fbc00                 ;17 move #>$xxxx,n1
        dc      $3fdc00                 ;18 move #>$xxxx,n2
        dc      $3ffc00                 ;19 move #>$xxxx,n3
        dc      $3d5c00                 ;20 move #>$xxxx,omr
        dc      $000000                 ;blank for pc.
        dc      $3e1c00                 ;22 move #>$xxxx,r0
        dc      $3e3c00                 ;23 move #>$xxxx,r1
        dc      $3e5c00                 ;24 move #>$xxxx,r2
        dc      $3e7c00                 ;25 move #>$xxxx,r3
        dc      $3d7c00                 ;26 move #>$xxxx,sp
        dc      $3d3c00                 ;27 move #>$xxxx,sr
        dc      $3f1c00                 ;28 move #>$xxxx,ssh
        dc      $3f3c00                 ;29 move #>$xxxx,ssl
        dc      $000000                 ;blank for x
        dc      $3c1c00                 ;31 move #>$xxxx,x0
        dc      $3c5c00                 ;32 move #>$xxxx,x1
        dc      $000000                 ;blank for y
        dc      $3c3c00                 ;34 move #>$xxxx,y0
        dc      $3c7c00                 ;35 move #>$xxxx,y1
;**********************************************************************
;       56100
;       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 56100 register.
;**********************************************************************
GETOREG
        dc      $8002                 ;0 read OnCE status/control
        dc      $8102                 ;1 read breakpoint ctr. (OMBC)
        dc      $8302                 ;2 read Trace ctr. (OTC)
        dc      $8402                 ;3 read Breakpoint Address (OMBAR)
        dc      $8802                 ;4 read transfer register (OGDBR)
PIPE    dc      $8902                 ;5 read Program data bus (OPDBR)
        dc      $8a02                 ;6 read Program address bus Fetch (OPABFR)
        dc      $8b02                 ;7 read Instruction Latch (OPILR)
        dc      $9102                 ;8 read FIFO1
        dc      $9102                 ;9 read FIFO2
        dc      $9102                 ;10 read FIFO3
	dc	$9002			;11 read program address execute (OPABER)
        dc      $9302                 ;12 read Program Address bus Decode (OPABDR)
        dc      $0001                 ;end of sequence
;**********************************************************************
;       56100
;       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 56100 register.
;**********************************************************************
PUTOREG
        dc      $0004                 ;0 write OnCE status/control
        dc      $0104                 ;1 write breakpoint ctr. (OMBC)
        dc      $0304                 ;2 write Trace ctr. (OTC)
        dc      $0404                 ;3 write breakpoint address (OMBAR)
        dc      $0804                 ;4 write transfer register (OGDBR)
        dc      $0904                 ;5 write Program Data bus (OPDBR)
        dc      $0a04                 ;6 write Program Address bus Fetch (OPABFR)
        dc      $0b04                 ;7 write Instruction Latch (PIIB)
        dc      $1004                 ;8 write FIFO1
        dc      $1004                 ;9 write FIFO2
        dc      $1004                 ;10 write FIFO3
	dc	$1304			;11 write program address execute (OPABER
        dc      $1104                 ;13 write Program Address bus Decode (OPABDR)
        dc      $0001                 ;end of sequence
;**********************************************************************
;       56100
;       This sequence is used to read 56100 programming model register
;       values to display.
;**********************************************************************
REGREAD dc      $0904                 ;write PDB no go,no ex.
        dc      $000000                 ;move reg,x:ffff - opcode -
        dc      $4904                 ;write PDB go,no ex.
        dc      $ffff00                 ;$ffff - operand -
        dc      $8802                 ;read GDB
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       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
;**********************************************************************
;       56100
;       This sequence is used to read Program memory.
;**********************************************************************
OPREAD  dc      $0904                 ;write PDB,no go, no ex.
        dc      $3e1c00                 ;move #$xxxx,r0 - opcode -
        dc      $4904                 ;write PDB, go, no ex.
PREADPTR dc     $000000                 ;#$xxxx operand
PRDLOOP dc      $4904                 ;write PDB, go, no ex.
        dc      $030800                 ;move p:(r0)+,x0 - opcode -
        dc      $4904                 ;write PDB go,no ex.
        dc      $183f00                 ;move x0,x:$ffff
        dc      $8802                 ;Read GDB, no go, no ex.
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       This sequence is used to read X Data memory.
;**********************************************************************
OXREAD  dc      $0904                 ;write PDB,no go, no ex.
        dc      $3e1c00                 ;move #$xxxx,r0 - opcode -
        dc      $4904                 ;write PDB, go, no ex.
XREADPTR dc     $000000                 ;#$xxxx operand
XRDLOOP dc      $4904                 ;write PDB, go, no ex.
        dc      $3c0400                 ;move x:(r0)+,x0 - opcode -
        dc      $4904                 ;write PDB go,no ex.
        dc      $183f00                 ;move x0,x:$ffff
        dc      $8802                 ;Read GDB
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       This sequence is used to write a value to a single
;       Program memory location.
;**********************************************************************
OPWRITE dc      $0904                 ;write PDB
        dc      $3e1c00                 ;move #$xxxx,r0 opcode
        dc      $4904                 ;write PDB
PWRITPTR dc     $000000                 ;#$xxxx operand
PWRLOOP	dc      $0904                 ;write PDB
        dc      $3c1c00                 ;move #$xxxx,x0 opcode
        dc      $4904                 ;write PDB - go, no ex.
PWRITVAL dc     $000000                 ;#$xxxx operand
PWLOOP  dc      $4904                 ;write PDB
        dc      $020800                 ;move x0,p:(r0)+ - opcode
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       This sequence is for block writes.  It is
;       nothing more than a repeat of the opcode in the
;       PDB register.
;**********************************************************************
MWRLOOP dc      $5f08                 ;write no reg.,go,no ex.
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       This sequence is used to write to a single X
;       Data memory location.
;**********************************************************************
OXWRITE dc      $0904                 ;write PDB
        dc      $3e1c00                 ;move #$xxxx,r0 opcode
        dc      $4904                 ;write PDB
XWRITPTR dc     $000000                 ;#$xxxx operand
XWRLOOP	dc      $0904                 ;write PDB
        dc      $3c1c00                 ;move #$xxxx,x0 opcode
        dc      $4904                 ;write PDB - go, no ex.
XWRITVAL dc     $000000                 ;#$xxxx operand
XWLOOP  dc      $4904                 ;write PDB
        dc      $380400                 ;move x0,x:(r0)+ - opcode
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       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.
;**********************************************************************
USERMODE dc     $0904                 ;write PDB no go,no ex.
        dc      $000000                 ;PIIB
        dc      $6910                 ;write PDB go,ex
        dc      $000000                 ;PDB
        dc      $0001
;**********************************************************************
;       56100
;       Restore registers used for write sequences
;**********************************************************************
RESTOREX0 dc    $0904                 ;write PDB no go,no ex.
        dc      $3c1c00                 ;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      $3e1c00                 ;move #$xxxx,r0 -opcode-
        dc      $4904                 ;write PDB go,no ex.
R0VAL   dc      $000000                 ;#$xxxx operand
        dc      $0904                 ;write PDB no go,no ex.
        dc      $3e9c00                 ;move #$xxxx,m0,opcode
        dc      $4904                 ;write PDB go, no ex.
M0VAL   dc      $000000                 ;#$xxxx operand
        dc      $0001                 ;eos
;**********************************************************************
;       56100
;       Save register values before doing multiple write values
;**********************************************************************
SAVEX0  dc      $4904                 ;write PDB no go,no ex.
        dc      $183f00                 ;move x0,x:OGDB - opcode
        dc      $8802                 ;read GDB no go,no ex.
SAVER0  dc      $0904                 ;write PDB go,no ex.
        dc      $3a1400                 ;move r0,x:ffff
        dc      $4904                 ;write PDB go,no ex
        dc      $ffff00                 ;$ffff - operand -
        dc      $8802                 ;read GDB no go,no ex.
SAVEM0  dc      $0904                 ;write PDB no go,no ex.
        dc      $3a9400                 ;move m0,x:ffff - opcode -
        dc      $4904                 ;write PDB go,no ex.
        dc      $ffff00                 ;$ffff -operand -
        dc      $8802                 ;read GDB no go, no ex.
;**********************************************************************
;       56100
;       Change M0 to $ffff
;**********************************************************************
        dc      $0904                 ;write PDB no go,no ex.
        dc      $3e9c00                 ;move #$ffff,m0 -opcode-
        dc      $4904                 ;write PDB go,no ex.
        dc      $ffff00                 ;#$ffff -operand-
        dc      $0001                 ;eos
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
        endsec          ;end of sec16k
;|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ENDSEC5         equ     *

