;
;   Author:	D. Mischler	25-OCT-87
;
;   This module defines the command and response packets
;   between DBGAID and the DBG task. It also contains the
;   conditional assembly parameters, common macros, and
;   internal data structure definitions.
;
; V1.1	D. Mischler  05-JAN-88	Major redesign.
; V1.7	D. Mischler  22-NOV-88	Flag day: RT.WIN contains target region ID.
; V1.8	D. Mischler  30-NOV-88	Minor cleanup
;
LVL	=	2	; Interaction level used for DBGAID version check.

;
;   Conditional assembly parameters.
;
I$FPP	=	1	; FPP instructions are (partly) supported if defined.
I$MTPS	=	1	; MFPS/MTPS instructions are supported if defined.
			;  This also controls assembly of history and
			;  simulation code.
M$PLUS	=	1	; System is RSX-11M-PLUS if defined.
USEASH	=	7	; Lowest number of shifts for which ASH should be used.
X$FMAP	=	1	; Use fast mapping when possible if defined.

;
;   Assembly-time definitions.
;
CMDLUN	=	1		; Command input LUN.
CR	=	'M-100		; ASCII carriage return (control-M).
HT	=	'I-100		; ASCII horizontal tab (control-I).
IOEFN	=	1		; I/O event flag number.
LF	=	'J-100		; ASCII line feed (control-J).
LOGLUN	=	2		; Log file LUN.
MAXSIM	=	1536.		; Maximum consecutive simulated instructions.
STBLUN	=	3		; Symbol table file LUN.
TI	=	4		; TI: logical unit number (not a file).
TRMLEN	=	80.		; Terminal buffer length.
;
;   Numeric conversion definitions for use with $CBTA.
;   The conversion radix must be placed in the low byte.
;
NC.SGN	=	400		; Signed conversion flag bit.
NC.LDZ	=	1000		; Leading zero flag bit.
NC.LDS	=	3000		; Leading spaces flag bits.
NC.WID	=	4000		; Field width mutiplier.

	.ASECT
;
;   Address space types.
;
AS.UDS	=	0	; User data space (must always be zero).
AS.UIS	=	2	; User instruction space.
AS.SIS	=	4	; Supervisor instruction space (not implemented).

;
;   Command packet layout.
;
	.=0
C.TYP:	.BLKW	1	; Command packet type.
C.WADR:	.BLKW	1	; Window descriptor block address (if necessary).

;
;   Command packet type values.
;
CT.PRO	= <^rPRO>+LVL	; Proceed with execution (no parameters).
CT.SWR	= <^rSWR>+LVL	; Send window by reference (WDB address).
CT.XIT	= <^rXIT>+LVL	; Exit (no parameters).

;
;   Data type codes (type table offsets).
;
	.=1
DT.ADR:	.BLKB	1	; Address
DT.ASC:	.BLKB	1	; ASCII
DT.BYT:	.BLKB	1	; Byte
DT.INS:	.BLKB	1	; Instruction
DT.R50:	.BLKB	1	; RAD50
DT.WRD:	.BLKB	1	; Word

;
;   Breakpoint, tracepoint and watchpoint data structure.
;
	.=0
P.LNK:	.BLKW	1		; Link to next halt point.
P.ADDR:	.BLKW	1		; Address of halt point.
P.VALU:	.BLKW	1		; Value for halt point.
P.LEN:				; Length of halt point block.

;
;   Profile range data structure.
;
	.=0
PR.LNK:	.BLKW	1		; Link to next profile range.
PR.BAS:	.BLKW	1		; Base address of range.
PR.RNG:	.BLKW	1		; Address range size.
PR.CMP:	.BLKW	1		; Compression factor.
PR.SIZ:	.BLKW	1		; Profile range block size in bytes.
PR.CNT:				; Start of counters.

;
;   Response packet layout.
;
	.=0
R.TYP:	.BLKW	1	; Reponse packet type.
R.APR:	.BLKB	1	; Window base APR.
R.ASPC:	.BLKB	1	; Window address space type.
R.WDB:	.BLKW	1	; Window descriptor block address.
R.VDAT:	.BLKW	3	; Variable data (dependent on packet type).
R.MCTX:	.BLKW	1	; Mapping context buffer address.
R.TCTX:	.BLKW	1	; Task context buffer address.

;
;   Response packet types (variable data returned).
;
RT.AFU	= <^rAFU>+LVL	; Invalid command packet received.
RT.BPT	= <^rBPT>+LVL	; Break point trap.
RT.DEB	= <^rDEB>+LVL	; MCR DEBUG command detected.
RT.EMT	= <^rEMT>+LVL	; Non-RSX EMT instruction (low byte of opcode).
RT.FPX	= <^rFPX>+LVL	; PDP-11/40 floating point exception.
RT.IOT	= <^rIOT>+LVL	; IOT instruction.
RT.ILL	= <^rILL>+LVL	; Illegal instruction.
RT.MPV	= <^rMPV>+LVL	; Memory protection violation (MMU status registers).
RT.ODD	= <^rODD>+LVL	; Odd address trap.
RT.STU	= <^rSTU>+LVL	; Startup packet.
RT.TRC	= <^rTRC>+LVL	; Trace trap.
RT.TRP	= <^rTRP>+LVL	; TRAP instruction (low byte of opcode).
RT.WIN	= <^rWIN>+LVL	; Window transmission (target task region ID).

;
;   Task context buffer format.
;
	.=0
TC.R0:	.BLKW	1	; Saved task R0.
TC.R1:	.BLKW	1	; Saved task R1.
TC.R2:	.BLKW	1	; Saved task R2.
TC.R3:	.BLKW	1	; Saved task R3.
TC.R4:	.BLKW	1	; Saved task R4.
TC.R5:	.BLKW	1	; Saved task R5.
TC.SP:	.BLKW	1	; Saved task SP.
TC.PC:	.BLKW	1	; Saved task PC.
TC.PS:	.BLKW	1	; Saved task PSW.
PS.C	=	1	; Carry bit in processor status.
PS.INI	=	170017	; Initial task processor status.
PS.N	=	10	; Negative bit in processor status.
PS.V	=	2	; Overflow bit in processor status.
PS.TRC	=	20	; Trace trap bit in processor status.
PS.USR	=	170000	; Current and previous mode = user.
PS.Z	=	4	; Zero bit in processor status.
TC.DSW:	.BLKW	1	; Saved task DSW.
TC.LEN:			; Length of task context buffer in bytes.

;
;   Macro to define a keyword dispatch table entry.
;
	.MACRO	KEYWRD	TEXT,DISP
	.SAVE
	.PSECT	STRING,D,RO
$$$	=	.
	.ASCIZ	"TEXT"
	.RESTORE
	.WORD	$$$,DISP
	.ENDM	KEYWRD
