%NOLIST

210	 REMARK    +++++++++++++++++POSITION CURSOR SUBROUTINE++++++++++++++++++++\
		   +   THIS POSITIONING SUBROUTINE WAS WRITTEN FOR THE HAZELTINE +\
		   +  1400/1500/1510 SERIES TERMINAL.  TO CHANGE ADDRESSING FOR  +\
		   +  OTHER CRT DISPLAYS, ALTER THE LINES BELOW.  THE PROGRAM    +\
		   +    CURSOR.BAS ASSIGNS VARIABLES THAT CONTAIN ADDRESSING     +\
		   +  COMMANDS.  BE SURE TO CHANGE THE CALCULATION OF THE X & Y  +\
		   +                          COORDINATES		         +\
		   +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
	CONSOLE
	NO.OF.LINEFEEDS%=INT(X1/64)+64					REMARK  DERIVE Y-LOCATION (16 VERTICAL LINES ASSUMED)
	HORIZONTAL.TAB%=X1-(INT(X1/64)*64)				REMARK  DERIVE X-LOCATION (64 COLUMNS ACROSS ASSUMED)
	IF HORIZONTAL.TAB%<31 THEN HORIZONTAL.TAB%=HORIZONTAL.TAB%+96	REMARK  ADD 96 TO X WHERE 0<= X <= 31

211	PRINT ADDR.CURSOR$;CHR$(HORIZONTAL.TAB%);CHR$(NO.OF.LINEFEEDS%);

	RETURN

215	REMARK ++++++++++++++++++ADVANCE CURSOR RIGHT SUBROUTINE++++++++++++++++
	PRINT LEFT$(X9$,X1-1);
	RETURN


260	REM $$$$$$$$$$$ READ CRT MASK FILE SUBROUTINE $$$$$$$$$$$
	DIM CRTMASK$(16)
	CONSOLE
	READ #19,X0;CRTMASK$(1),CRTMASK$(2),CRTMASK$(3),CRTMASK$(4),\
	CRTMASK$(5),CRTMASK$(6),CRTMASK$(7),CRTMASK$(8),CRTMASK$(9),\
	CRTMASK$(10),CRTMASK$(11),CRTMASK$(12),CRTMASK$(13),CRTMASK$(14),\
	CRTMASK$(15),CRTMASK$(16)
265	PRINT CLEAR.SCREEN$;
	FOR INDEX% = 1 TO 16
	PRINT CRTMASK$(INDEX%)
	NEXT INDEX%
	PRINT CURSOR.HOME$
	CONSOLE
	RETURN


345	REMARK   ++++++++++++++++ALPHABETIC/NUMERIC DATA ENTRY+++++++++++++++


	X2$="****************************************************************"
	GOSUB 210:PRINT LEFT$(X2$,X2)					REMARK  POSITION CURSOR AND DISPLAY ENTRY MASK
	CHAR%=LEAD.IN%:GOSUB 801
	CHAR%=ADDR.CURS%:GOSUB 801
	CHAR%=HORIZONTAL.TAB%:GOSUB 801
	CHAR%=NO.OF.LINEFEEDS%:GOSUB 801
	X0$=""
350	IF CONSTAT% = 0 THEN GOTO 350					REMARK  WAIT FOR OPERATOR TO ENTER CHARACTER
	X%=CONCHAR%
	IF CTRL.C%=1 AND X%=3 THEN RETURN				REMARK  ENABLE SPECIAL ESCAPE SEQUENCE
	IF X%=9 THEN GOTO 345						REMARK  RESTART ENTRY IF CONTROL-I
	IF X%=0DH THEN GOTO 370						REMARK  END DATA ENTRY IF <RETURN> WAS DEPRESSED
	IF X% >= 20H AND X% <= 7AH THEN GOTO 360			REMARK  PROCESS AND VALID ASCII CHARACTER
	IF X% =7EH OR X% = 08H AND LEN(X0$) >= 1\			REMARK  IF BACKSPACE OR RUBOUT, ERASE LAST CHARACTER
	THEN\
	 CHAR%=BACKSPACE%:GOSUB 801:\ 
	 CHAR%=42:GOSUB 801:\
	 CHAR%=BACKSPACE%:GOSUB 801:\ 	
	Z1%=LEN(X0$)-1:X0$=LEFT$(X0$,Z1%)				REMARK  AND TRUNCATE ENTRY STRING
	GOTO 350
360	IF LEN(X0$) < X2 THEN X0$=X0$+CHR$(X%)\				REMARK  IF ENTRY LENGTH WITHIN LIMITS, CONCATENATE
	ELSE\
	 CHAR%=BACKSPACE%:GOSUB 801:\     	    				REMARK  IF ENTRY LENGTH EXCEEDED,KEEP WITHIN MASK LIMITS
	 CHAR%=32:GOSUB 801:\
	 CHAR%=BACKSPACE%:GOSUB 801
	GOTO 350
370	IF X3=0 AND X4=0 THEN RETURN
	X0 = VAL(X0$)
	IF MATCH("!",X0$,1) = 0 AND X0 >= X3 AND X0 <= X4 THEN RETURN	REMARK  PERFORM RANGE CHECKING:IF INVALID, REJECT
 505	X2$="OUT OF RANGE"
	SCRATCH=X1
	GOSUB 615
	X1=SCRATCH
	GOTO 345
 615	REM $$$$$$$$$$$$$$$$FLASH BULLETIN AT LINE 3$$$$$$$$$$$$$$$$$$$$$$$
	CONSOLE
	FOR INDEX% = 1 TO 3
	X1=192:GOSUB 210
	PRINT TAB((64-LEN(X2$))/2);X2$
		FOR X0%=1 TO 60
		NEXT X0%
		X1=192:GOSUB 210:PRINT TAB(64)
		FOR X0%=1 TO 60
		NEXT X0%
		NEXT INDEX%
	RETURN

665           REM $$$$$$$$$$ NUMERIC/ALPHA DATA ENTRY W/PROMPT $$$$$$$$$$$$$$
	PRINT
	X1=64
	GOSUB 210
	PRINT X2$;TAB(66)
	PRINT TAB(64)
	X1=128
	GOSUB 345
	RETURN

673	      REM $$$$$$$$$$ ENTER & DISPLAY DATE AT LOCATION X1 $$$$$$$$$$$$$$
	Z0=X1
	GOSUB 210
	PRINT "          ";
	X2=6
	X3=0
	X4=123199
	GOSUB 345		REM ENTER THAT DATE
	IF LEN(X0$)<5 THEN X1=Z0:GOTO 673
673.5	IF LEN(X0$) < 6 THEN X0$="0"+X0$:GOTO 673.5
	IF MID$(X0$,1,2)>="01" AND MID$(X0$,1,2)<="12"\
	AND MID$(X0$,3,2)>="01" AND MID$(X0$,3,2) <="31" THEN 675
	X2$="INVALID DATE":GOSUB 615:X1=Z0:GOTO 673
675	X0=VAL(X0$)
680	GOSUB 210
680.5	X0$=STR$(X0)
680.6	IF LEN(X0$)<6 THEN X0$="0"+X0$:GOTO 680.6
681	PRINT LEFT$(X0$,2);"/";MID$(X0$,3,2);"/";RIGHT$(X0$,2);
	RETURN
760	REMARK    $$$$$$$$$$$$$$$$ PRINT TELEPHONE NUMBER SUBROUTINE $$$$$$$$$$$$$$
	GOSUB 210	REMARK POSITION THE CURSOR
760.5	X0$=STR$(X0)
761	IF LEN(X0$) < 10 THEN X0$="0"+X0$:GOTO 761\
	ELSE\
	PRINT "(";LEFT$(X0$,3);")";MID$(X0$,4,3);"-";RIGHT$(X0$,4);
	RETURN
801	REMARK  *************************************************\
		*  DIRECT PRINT ROUTINE     12/1/78    MM       *\
		*  =========================================    *\
		*    THIS SUBROUTINE SENDS THE CHARACTER IN     *\
		*  "CHAR%" TO THE CRT SCREEN I/O PORT (PORT 4), *\
		*  AFTER ASCERTAINING THE SCREEN IS READY VIA   *\
		*  THE SCREEN STATUS PORT (PORT 5).             *\
		*************************************************

	IF (INP(3) AND 1) = 0 THEN 801					REMARK CHECK THE STATUS BIT (BIT 0) FOR CRT SCREEN
	OUT 2, CHAR%
	RETURN

%LIST
