;CRT terminal function calls

UNIVERSAL

DEFINE	CRT	ARG1,ARG2
	IF	B,ARG2
		MOVW	#<-1_8.>,D1
		ADDW	ARG1,D1
		ENDC
	IF	NB,ARG2
		MOVW	ARG1,D1
		ROLW	D1,#8.
		ADDW	ARG2,D1
		ENDC
	TCRT
	ENDM

DEFINE	CURSOR	ROW,COL
	MOVW	ROW,D1
	ROLW	D1,#8.
	ADDW	COL,D1
	TCRT
	ENDM

DEFINE	CLS = CRT #0
DEFINE	HOME = CRT #1
DEFINE	NEWLIN = CRT #2
DEFINE	UP = CRT #3
DEFINE	DOWN = CRT #4
DEFINE	LEFT = CRT #5
DEFINE	RIGHT = CRT #6
DEFINE	KLOCK = CRT #7
DEFINE	KUNLOK = CRT #8.
DEFINE	CLREOL = CRT #9.
DEFINE	CLREOS = CRT #10.
DEFINE	LOW = CRT #11.
DEFINE	HIGH = CRT #12.
DEFINE	DELLIN = CRT #15.
DEFINE	INSLIN = CRT #16.
DEFINE	C.ON = CRT #28.
DEFINE	C.OFF = CRT #29.
DEFINE	REVERS=CRT #32.
DEFINE	REVOFF=CRT #33.

DEFINE	TYPEAT	ROW,COL,TEXT
	CURSOR	#ROW,#COL
	TYPE	<TEXT>
	ENDM

DEFINE	HEADER	TEXT1,TEXT2
	CLS
	HIGH
	NCHR	SZ,<TEXT1>
	CURSOR	#1,#<<80.-SZ>/2>-1
	TYPE	TEXT1
	NCHR	SZ,<TEXT2>
	CURSOR	#2,#<<80.-SZ>/2>-1
	TYPE	TEXT2
	LOW
	CRLF
	CRLF
	ENDM

DEFINE	CENTER	ROW,TEXT
	NCHR	SZ,<TEXT>
	CURSOR	#ROW,#<<80.-SZ>/2>
	TYPE	TEXT
	ENDM

END