; ************************** AMUS Program Label ******************************
; Filename: DATA.M68                                        Date: 06/25/90
; Category: UTIL         Hash Code: 273-740-506-351      Version: 1.0(100)
; Initials: ULTR/AM      Name: DAVID PALLMANN
; Company: ULTRASOFT CORPORATION                   Telephone #: 5163484848
; Related Files: None
; Min. Op. Sys.: AMOSL 1.0                     Expertise Level: BEG
; Special: 
; Description: Sets a TRMDEF into data mode.  Particularly useful for HP
; LaserJet printers; this allows graphics commands to be sent to the printer
; without AMOS tab expansion getting in the way.
; ****************************************************************************

;****************************************************************************
;*									    *
;*				    DATA 				    *
;*		 Puts Printer/Terminal/Modem into Data Mode		    *
;*									    *
;****************************************************************************
;Copyright (C) 1990 UltraSoft Corporation.  All Rights Reserved.
;
;Written by: David Pallmann
;
;Edit History:
;1.0(100)  24-Jun-90  created. /DFP

	VMAJOR	=1
	VMINOR	=0
	VSUB	=0
	VEDIT	=100.
	VWHO	=0

	SEARCH	SYS
	SEARCH	SYSSYM
	SEARCH	TRM

	.OFINI
	.OFDEF	TRMDEF,	4		; TRMDEF name RAD50
	.OFDEF	BUFFER,	8.		; conversion buffer
	.OFSIZ	MEMSIZ

START:	PHDR	-1,0,PH$REE!PH$REU	; program header
	GETIMP	MEMSIZ,A4		; allocate memory for variables
	CLR	D5			; 

CMDLIN:	BYP				; 
	LIN				; 
	JEQ	USAGE			; 

GETNAM:	BYP				; 
	LIN				; 
	JEQ	DONE			; 
	LEA	A1,TRMDEF(A4)		; 
	PACK				; 
	PACK				; 

LOCATE:	MOV	TRMDFC,A5		; 
10$:	CMM	4(A5),TRMDEF(A4)	; 
	BEQ	20$			; 
	TST	@A5			; 
	JEQ	BADNAM			; 
	MOV	@A5,A5			; 
	BR	10$			; 
20$:	ADD	#10,A5			; 

SETMOD:
	ORW	#T$DAT,T.STS(A5)	; 
	INC	D5			; 
	BR	NEXT			; 

BADNAM:	TYPESP	?TRMDEF not found	; 
	PUSH	A2			; 
	LEA	A1,TRMDEF(A4)		; 
	LEA	A2,BUFFER(A4)		; 
	UNPACK				; 
	UNPACK				; 
	CLRB	@A2			; 
	TTYL	BUFFER(A4)		; 
	CRLF				; 
	POP	A2			; 

NEXT:	BYP				; 
	CMPB	(A2)+,#<',>		; 
	JEQ	GETNAM			; 

DONE:	MOV	D5,D1			; 
	BNE	10$			; 
	TYPESP	%No			; 
	BR	20$			; 
10$:	DCVT	0,OT$TRM!OT$TSP		; 
20$:	TYPE	trmdef			; 
	CMP	D1,#1			; 
	BEQ	30$			; 
	TYPE	s			; 
30$:	TYPECR	< set to data mode>	; 
	CRLF				; 
	EXIT				; 

USAGE:	TYPECR	Set data mode on a printer
	TYPECR	Copyright (C) 1990 UltraSoft Corporation.  All Rights Reserved.
	CRLF				; 
	TYPECR	Usage: .DATA trmdef	; 
	CRLF				; 
	EXIT				; 

	END