; MACROS - MIDAS macros for ITS


IF2 .INEOF			; only assemble on pass 1

define tellversion
if1 [
.tyo6 .ifnm1
printx " "
.tyo6 .ifnm2
printx "  Included in this assembly
"]
termin

tellversion


SUBTTL	Definitions

; Macro to define registers
define	register name
if1 [
name=:.reg.
.reg.==.reg.+1
]
termin

.reg.==0


; Register definitions
register F	; program flags
register P	; pdl ptr
register T	; temporaries
register T1	; (not saved by uuos)
register T2
register A	; A-E saved by subrs
register B
register C
register D
register E

; Define acs for .I and .F
A0==:T
A1==:T1
A2==:T2

TT==:T1				; for using other MACRO packages

; Common byte-pointer LH's
$opcod==:331100		; Instruction op-code
$acfld==:270400		; Instruction AC field


; .BREAK 12, codes (as defined by DDT)
..rcmd==:5			; read command line
..scmd==:400005			; set command line
..rrnd==:14			; read ..URANDM
..srnd==:400014			; set ..URANDM


EQUALS BEGIN,.BEGIN		; BEGIN looks better than .BEGIN
EQUALS VAR,.SCALAR		; Use VAR for vectors and scalars


; Macro to print on tty during assembly
define	inform a,b,c,d,e,f,g
printx á!b!c!d!e!f!g
Š
termin


; Macro to define bit names for use with ac F.
define flag x
if1 [
ife %f.&777777,	.ERR Too many flags declared
%f!x==%f.
.c"%f.==%f._1
]
termin

%f.==1			; for defining flags in RH of F
%f==525252		; for DDT's bit typeout mode


; Macro to define channel no.s
define	channel name
if1 [
name==:.chnl.
.chnl.==.chnl.+1
]
termin

.chnl.==1


; Macro to produce string constant
define	string &x&
440700,,[ascii x] ? .length x termin


; Macro to simulate KL10's ADJSP instruction
define	adjsp sp,amt
ifl amt, sub sp,[-amt,,-amt]
.else [	 add sp,[amt,,amt]
	 jumpl sp,.+2
	  .suset [.sipirq,,[%pipdl]]
	]
termin


; Macro to output string constants
define	sout ch,ctrl,&s&
	move t1,[440700,,[ascii s]]
	movei t2,.length s
	$call siot,[ch,t1,t2][][ctrl]
	 .lose %lssys
termin
