;       SCCSID = @(#)debprt.inc	6.1 90/11/17
;      SCCSID = @(#)debprt.inc	13.3 89/10/24
;***	DEBPRT.INC
;
;	This include file contains the opcode definitions
;	for the table printer and modifier interpreter.
;
;
;
;	OpInterpret routine opcodes
;
; Defects:
;
; 155531    RJM 23 May 1996 Included SMP routines for .MK
;

EndOp		macro	numargs
		extrn	_EndOp:ABS
		extrn	_EndOpArg:ABS
		IFB	<numargs>
			db	_EndOp
		else
			db	_EndOpArg, numargs
		endif
		endm

OutBlank	macro
		extrn	_OutBlank:ABS
		db	_OutBlank
		endm


OutBlanks	macro	num
		?ErrIFB	num
		extrn	_OutBlanks:ABS
		db	_OutBlanks, num
		endm

OutCrLf		macro
		extrn	_OutCrLf:ABS
		db	_OutCrLf
		endm

OutChar		macro	char
		?ErrIFB	char
		extrn	_OutChar:ABS
		db	_OutChar, char
		endm

OutStr		macro	str
		?ErrIFB	<str>
		extrn	_OutStr:ABS
		db	_OutStr, str, 0
		endm

OutStrlc	macro	str
		?ErrIFB	<str>
		extrn	_OutStrlc:ABS
		db	_OutStrlc, str, 0
		endm

OutMsg		macro	addr
		?ErrIFB	addr
		extrn	_OutMsg:ABS
		db	_OutMsg
		dw	dataOFFSET addr
		endm

OutMsglc	macro	addr
		?ErrIFB	addr
		extrn	_OutMsglc:ABS
		db	_OutMsglc
		dw	dataOFFSET addr
		endm

OutMsgArg	macro	argnum
		?ErrIFB	argnum
		extrn	_OutMsgArg:ABS
		db	_OutMsgArg, argnum
		endm

OutMsgArglc	macro	argnum
		?ErrIFB	argnum
		extrn	_OutMsgArglc:ABS
		db	_OutMsgArglc, argnum
		endm

OutStrPtr	macro	offst,maxlen
		?ErrIFB	offst
		?ErrIFB	maxlen
		extrn	_OutStrPtr:ABS
		db	_OutStrPtr, offst, maxlen
		endm

OutStrPtrlc	macro	offst,maxlen
		?ErrIFB	offst
		?ErrIFB	maxlen
		extrn	_OutStrPtrlc:ABS
		db	_OutStrPtrlc, offst, maxlen
		endm

OutByteHexPtr	macro	offst
		?ErrIFB	offst
		extrn	_OutByteHexPtr:ABS
		db	_OutByteHexPtr, offst
		endm

;;155531
OutByteHexAddr  macro   addr
                ?ErrIFB addr
                extrn   _OutByteHexAddr:ABS
                db      _OutByteHexAddr
                dw      dataOFFSET addr
                endm

;;155531
OutWordHexAddr  macro   addr
                ?ErrIFB addr
                extrn   _OutWordHexAddr:ABS
                db      _OutWordHexAddr
                dw      dataOFFSET addr
                endm

;;155531
OutDwordHexAddr  macro   addr
                ?ErrIFB addr
                extrn   _OutDwordHexAddr:ABS
                db      _OutDwordHexAddr
                dw      dataOFFSET addr
                endm

;;155531
OutMsgIfBitSetAddrlc    macro   addr, offst, bitnum, addr1
                        ?ErrIFB addr
                        ?ErrIFB offst
                        ?ErrIFB bitnum
                        ?ErrIFB addr1
                        extrn   _OutMsgIfBitSetAddrlc:ABS
                        db      _OutMsgIfBitSetAddrlc
                        dw      dataOFFSET addr
                        db      offst, bitnum
                        dw      dataOFFSET addr1
                        endm

;;155531
JumpIfEQ                macro   word, addr, opaddr
                        ?ErrIFB word
                        ?ErrIFB addr
                        ?ErrIFB opaddr
                        extrn   _JumpIfEQ:ABS
                        db      _JumpIfEQ
                        dw      word, dataOFFSET addr, dataOFFSET opaddr
                        endm


OutWordHexPtr	macro	offst
		?ErrIFB	offst
		extrn	_OutWordHexPtr:ABS
		db	_OutWordHexPtr, offst
		endm

OutWordHexArg	macro	argnum
		?ErrIFB	argnum
		extrn	_OutWordHexArg:ABS
		db	_OutWordHexArg, argnum
		endm

OutDescBasePtr	macro
		extrn	_OutDescBasePtr:ABS
		db	_OutDescBasePtr
		endm

OutDescLimitPtr	macro
		extrn	_OutDescLimitPtr:ABS
		db	_OutDescLimitPtr
		endm

OutGateOffstPtr	macro
		extrn	_OutGateOffstPtr:ABS
		db	_OutGateOffstPtr
		endm

Out24HexPtr	macro	offst
		?ErrIFB	offst
		extrn	_Out24HexPtr:ABS
		db	_Out24HexPtr, offst
		endm

Out24HexArg	macro	argnum
		?ErrIFB	argnum
		extrn	_Out24HexArg:ABS
		db	_Out24HexArg, argnum
		endm

OutDwordHexPtr	macro	offst
		?ErrIFB	offst
		extrn	_OutDwordHexPtr:ABS
		db	_OutDwordHexPtr, offst
		endm

OutDwordHexArg	macro	argnum
		?ErrIFB	argnum
		extrn	_OutDwordHexArg:ABS
		db	_OutDwordHexArg, argnum
		endm

IFDEF DECIMAL

OutByteDecPtr	macro	offst, numdigits
		?ErrIFB	offst
		?ErrIFB	numdigits
		extrn	_OutByteDecPtr:ABS
		db	_OutByteDecPtr, offst, numdigits
		endm

OutWordDecPtr	macro	offst, numdigits
		?ErrIFB	offst
		?ErrIFB	numdigits
		extrn	_OutWordDecPtr:ABS
		db	_OutWordDecPtr, offst, numdigits
		endm

ENDIF ; DECIMAL

OutBitFHexPtr	macro	offst, startbit, bitwidth, numdigits
		?ErrIFB	offst
		?ErrIFB	startbit
		?ErrIFB bitwidth
		extrn	_OutBitFHexPtr:ABS
		db	_OutBitFHexPtr, offst, startbit, bitwidth
		IFB	<numdigits>	;; numdigits is optional
		db	0		;; no padding
		else
		db	numdigits	;; pad to this many digits
		endif
		endm

OutBitFHexArg	macro	argnum, startbit, bitwidth, numdigits
		?ErrIFB	argnum
		?ErrIFB	startbit
		?ErrIFB bitwidth
		extrn	_OutBitFHexArg:ABS
		db	_OutBitFHexArg, argnum, startbit, bitwidth
		IFB	<numdigits>	;; numdigits is optional
		db	0		;; no padding
		else
		db	numdigits	;; pad to this many digits
		endif
		endm

OutMsgIfBitSet	macro	offst, bitnum, addr
		?ErrIFB	offst
		?ErrIFB	bitnum
		?ErrIFB addr
		extrn	_OutMsgIfBitSet:ABS
		db	_OutMsgIfBitSet, offst, bitnum
		dw	dataOFFSET addr
		endm

OutMsgIfBitClr	macro	offst, bitnum, addr
		?ErrIFB	offst
		?ErrIFB	bitnum
		?ErrIFB addr
		extrn	_OutMsgIfBitClr:ABS
		db	_OutMsgIfBitClr, offst, bitnum
		dw	dataOFFSET addr
		endm

OutMsgIfBitSetArg	macro	argnum, bitnum, addr
			?ErrIFB	argnum
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitSetArg:ABS
			db	_OutMsgIfBitSetArg, argnum, bitnum
			dw	dataOFFSET addr
			endm

OutMsgIfBitClrArg	macro	argnum, bitnum, addr
			?ErrIFB	argnum
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitClrArg:ABS
			db	_OutMsgIfBitClrArg, argnum, bitnum
			dw	dataOFFSET addr
			endm

OutMsgIfBitSetlc	macro	offst, bitnum, addr
			?ErrIFB	offst
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitSetlc:ABS
			db	_OutMsgIfBitSetlc, offst, bitnum
			dw	dataOFFSET addr
			endm

OutMsgIfBitClrlc	macro	offst, bitnum, addr
			?ErrIFB	offst
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitClrlc:ABS
			db	_OutMsgIfBitClrlc, offst, bitnum
			dw	dataOFFSET addr
			endm

OutMsgIfBitSetArglc	macro	argnum, bitnum, addr
			?ErrIFB	argnum
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitSetArglc:ABS
			db	_OutMsgIfBitSetArglc, argnum, bitnum
			dw	dataOFFSET addr
			endm

OutMsgIfBitClrArglc	macro	argnum, bitnum, addr
			?ErrIFB	argnum
			?ErrIFB	bitnum
			?ErrIFB addr
			extrn	_OutMsgIfBitClrArglc:ABS
			db	_OutMsgIfBitClrArglc, argnum, bitnum
			dw	dataOFFSET addr
			endm

PushData	macro	args
		extrn	_PushData:ABS
		irp	x, <args>
			db	_PushData
			dw	x
		endm
		endm

PushArg		macro	args
		extrn	_PushArg:ABS
		irp	x, <args>
			db	_PushArg, x
		endm
		endm

LoadCache	macro	offst
		?ErrIFB	offst
		extrn	_LoadCache:ABS
		db	_LoadCache, offst
		endm

CallOp		macro	addr, args
		?ErrIFB	addr
		PushData <args>
		extrn	_CallOp:ABS
		db	_CallOp
		dw	dataOFFSET addr
		endm

JumpOp		macro	addr
		?ErrIFB	addr
		extrn	_JumpOp:ABS
		db	_JumpOp
		dw	dataOFFSET addr
		endm

OutMsgBitF	macro	offst, startbit, bitwidth, tableaddr
		?ErrIFB	offst
		?ErrIFB	startbit
		?ErrIFB bitwidth
		?ErrIFB tableaddr
		extrn	_OutMsgBitF:ABS
		db	_OutMsgBitF, offst, startbit, bitwidth
		dw	dataOFFSET tableaddr
		endm

OutMsgBitFlc	macro	offst, startbit, bitwidth, tableaddr
		?ErrIFB	offst
		?ErrIFB	startbit
		?ErrIFB bitwidth
		?ErrIFB tableaddr
		extrn	_OutMsgBitFlc:ABS
		db	_OutMsgBitFlc, offst, startbit, bitwidth
		dw	dataOFFSET tableaddr
		endm

JumpIfBitF	macro	offst, startbit, bitwidth, value, opaddr
		?ErrIFB	offst
		?ErrIFB	startbit
		?ErrIFB bitwidth
		?ErrIFB value
		?ErrIFB opaddr
		extrn	_JumpIfBitF:ABS
		db	_JumpIfBitF, offst, startbit, bitwidth
		dw	value, dataOFFSET opaddr
		endm

JumpIfBitSet	macro	offst, bitnum, addr
		?ErrIFB	offst
		?ErrIFB	bitnum
		?ErrIFB addr
		extrn	_JumpIfBitSet:ABS
		db	_JumpIfBitSet, offst, bitnum
		dw	dataOFFSET addr
		endm

JumpIfBitClr	macro	offst, bitnum, addr
		?ErrIFB	offst
		?ErrIFB	bitnum
		?ErrIFB addr
		extrn	_JumpIfBitClr:ABS
		db	_JumpIfBitClr, offst, bitnum
		dw	dataOFFSET addr
		endm

JumpIfDwordNull	macro	offst, addr
		?ErrIFB	offst
		?ErrIFB	addr
		extrn	_JumpIfDwordNull:ABS
		db	_JumpIfDwordNull, offst
		dw	dataOFFSET addr
		endm

JumpIfEnv386	macro	addr
		?ErrIFB addr
		extrn	_JumpIfEnv386:ABS
		db	_JumpIfEnv386
		dw	dataOFFSET addr
		endm

JumpIfEnv286	macro	addr
		?ErrIFB addr
		extrn	_JumpIfEnv286:ABS
		db	_JumpIfEnv286
		dw	dataOFFSET addr
		endm

CaseJump	macro	offst, startbit, bitwidth
		?ErrIFB	offst
		?ErrIFB	startbit
		?ErrIFB bitwidth
		extrn	_CaseJump:ABS
		db	_CaseJump, offst, startbit, bitwidth
		endm

CaseEntry	macro	value, opaddr
		?ErrIFB value
		?ErrIFB opaddr
		ifidn	<opaddr>,<0>
			%out CaseEntry has a zero argument
			.err
		endif
		dd	value
		dw	dataOFFSET opaddr
		endm

CaseEnd		macro
		dw	0, 0, 0
		endm

InSwitchStr	macro
		extrn	_InSwitchStr:ABS
		db	_InSwitchStr
		endm

SwitchEntry	macro	straddr, opaddr
		?ErrIFB	straddr
		?ErrIFB	opaddr
		ifidn	<straddr>,<0>
			%out SwitchEntry has a zero argument
			.err
		endif
		dw	dataOFFSET straddr, dataOFFSET opaddr
		endm

SwitchEnd	macro	opaddr
		?ErrIFB	opaddr
		dw	0, dataOFFSET opaddr
		endm

InBytePtr	macro	offst
		?ErrIFB	offst
		extrn	_InBytePtr:ABS
		db	_InBytePtr, offst
		endm

InWordPtr	macro	offst
		?ErrIFB	offst
		extrn	_InWordPtr:ABS
		db	_InWordPtr, offst
		endm

InWordArg	macro	argnum
		?ErrIFB	argnum
		extrn	_InWordArg:ABS
		db	_InWordArg, argnum
		endm

In24bitArg	macro	argnum
		?ErrIFB	argnum
		extrn	_In24bitArg:ABS
		db	_In24bitArg, argnum
		endm

InDwordArg	macro	argnum
		?ErrIFB	argnum
		extrn	_InDwordArg:ABS
		db	_InDwordArg, argnum
		endm

InBitFArg	macro	argnum, startbit, bitwidth
		?ErrIFB	argnum
		?ErrIFB	startbit
		?ErrIFB bitwidth
		extrn	_InBitFArg:ABS
		db	_InBitFArg, argnum, startbit, bitwidth
		endm

SetBitArg	macro	argnum, bitnum
		?ErrIFB	argnum
		?ErrIFB	bitnum
		extrn	_SetBitArg:ABS
		db	_SetBitArg, argnum, bitnum
		endm

ClearBitArg	macro	argnum, bitnum
		?ErrIFB	argnum
		?ErrIFB	bitnum
		extrn	_ClearBitArg:ABS
		db	_ClearBitArg, argnum, bitnum
		endm

ToggleBitArg	macro	argnum, bitnum
		?ErrIFB	argnum
		?ErrIFB	bitnum
		extrn	_ToggleBitArg:ABS
		db	_ToggleBitArg, argnum, bitnum
		endm

GetInBuf	macro
		extrn	_GetInBuf:ABS
		db	_GetInBuf
		endm

JumpIfInCharEQ	macro	char, addr
		?ErrIFB	char
		?ErrIFB	addr
		extrn	_JumpIfInCharEQ:ABS
		db	_JumpIfInCharEQ, char
		dw	dataOFFSET addr
		endm

JumpIfEOL	macro	addr
		?ErrIFB	addr
		extrn	_JumpIfEOL:ABS
		db	_JumpIfEOL
		dw	dataOFFSET addr
		endm

; Checks if an argument is blank. Forces an assembler error if so.

?ErrIFB		macro	arg
		IFB	<arg>
			%out ******* missing argument error ********
			.err
		endif
		endm
