/25	OS/12 SCOPE HANDLER
/
/
/
/
/
/
/
/
/
/COPYRIGHT  (C)  1974,1975 BY DIGITAL EQUIPMENT CORPORATION
/
/
/
/
/
/
/
/
/
/
/THE INFORMATION IN THIS DOCUMENT IS SUBJECT TO CHANGE WITHOUT NOTICE
/AND SHOULD NOT BE CONSTRUED AS A COMMITMENT BY DIGITAL EQUIPMENT
/CORPORATION.  DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/FOR ANY ERRORS THAT MAY APPEAR IN THIS DOCUMENT.
/
/THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FURNISHED TO THE PURCHASER
/UNDER A LICENSE FOR USE ON A SINGLE COMPUTER SYSTEM AND CAN BE COPIED
/(WITH INCLUSION OF DIGITAL'S COPYRIGHT NOTICE) ONLY FOR USE IN SUCH
/SYSTEM, EXCEPT AS MAY OTHERWISE BE PROVIDED IN WRITING BY DIGITAL.
/
/DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE
/OR RELIABILITY OF ITS SOFTWARE ON EQUIPMENT THAT IS NOT SUPPLIED BY
/DIGITAL.
/
/
/
/
/
/
/
/
/
/

/	NOVEMBER, 1972

/	MARIO DENOBILI, P?S

/	THIS ROUTINE WAS WRITTEN VERY HASTILY.

/	THE FOLLOWING FEATURES SHOULD BE PUT
/	IN, BUT I WAS TOO LAZY TO DO SO.
/	WITH A FEW HOURS WORK, A COMPETENT
/	PROGRAMMER SHOULD BE ABLE TO COMPACT
/	MY HASTY CODE AND EASILY ADD AT LEAST
/	A FEW OF THE FOLLOWING FEATURES:

/1.	TABS SHOULD BE HANDLED CORRECTLY.

/2.	FORM FEEDS SHOULD SIGNAL A NEW
/	SCOPE PAGE. [BRANCH TO LOCATION 'FULL']

/3.	VERTICAL TABS SHOULD BE TREATED AS
/	7 LINE FEEDS.

/4.	THE HANDLER SHOULD RETURN AN ERROR ON READ.

/5.	IF THE BUFFER OVERLAPS THE BETA REGISTER,
/	OR WRAPS AROUND 7777.
/	THIS SHOULD NOT CAUSE A CRAPPY 
/	CHARACTER TO BE DISPLAYED.

/6.	CTRL/Z SHOULD BE CHECKED FOR AND SIGNIFY
/	END OF BUFFER. [BRANCH TO 'FULL' WITH
/	LINK 0]

/7.	THE DISPLAY ALGORITHM SHOULD BE IMPROVED
/	SO THAT THERE IS LESS FLICKER.
/MORE FEATURES TO BE ADDED

/8.	THE RESTRICTION THAT THE USER'S BUFFER 
/	START AT AN EVEN ADDRESS IS USELESS
/	AND SHOULD BE REMOVED.

/9.	THE STATUS OF THE SPECIAL FUNCTIONS
/	REGISTER SHOULD BE SAVED AND RESTORED
/	BEFORE EXITING.

/10.	WHEN ANOTHER LOCATION IS FOUND, THE HANDLER
/	SHOULD BE ABLE TO DETECT PARITY ^C

/11.	SENSE SWITCH 0 SHOULD BE USED TO 
/	SPECIFY SMALL OR LARGE SIZE CHARACTERS.

/12.	OVERFLOW LINES SHOULD BE INDENTED SOME SMALL
/	AMOUNT TO SHOW THAT THEY ARE A CONTINUATION
/	OF THE PREVIOUS LINE
/	OS/8 BUILD HEADER BLOCK

	FIELD 0
	*0

	-1
	DEVICE VR12	/DEVICE NAME
	DEVICE TV	/HANDLER NAME
	1300		/DCB WORD
	4000+SCOPE-200	/2-PAGE FLAG AND RELATIVE ENTRY PT
	ZBLOCK 2

/	TWO PAGE SCOPE DEVICE HANDLER
/	PAGE INDEPENDENT AND REUSABLE

	LINC=6141
	PDP=2
	ESF=4
	CLR=11

	*200

L26,	26
SAVE,	0		/BETA REG SAVE LOC - MAY BE BETA REG
LINKNT,	TAD SAVE	/COUNT OF # OF LINES
YCOORD,	AND SCDF	/DISPLAY ORDIANTE
BETA,	DCA .		/8-MODE ADDRESS OF BETA REGISTER 1
CBASE,	TAD SAVE	/POINTS TO CHARACTER DISPLAY TABLE
BUFEND,	TAD XCIF	/END OF BUFFER
BPTR,	DCA CBASE	/POINTS INTO BUFFER
BUFFER,	TAD X		/BEGINNING OF BUFFER
T1,	DCA BEGIN	/TEMPORARY
L7410,	SKP

	TVERSION="A&77
SCOPE,	TVERSION
BEGIN,	JMS SAVE	/ADDRESS MUST BE EVEN
	AND L70 	/GET DATA FIELD OF BUFFER
	TAD KCDF
	DCA SCDF
	KCC
	RDF 		/GET DATA FIELD
	TAD FULL
	DCA XCIF
X,	TAD I SCOPE	/GET FUNCTION WORD
	CLL RAL
	AND L7700	/GET # OF PAGES
	ISZ SCOPE
	SNA
	JMP OVERX
	TAD I SCOPE	/ADD IN BUFFER START
	DCA BUFEND	/TO GET END OF BUFFER
	TAD I SCOPE	/GET BUFFER START
	DCA BUFFER	/[RESTRICTION: IT MUST BE EVEN]
	CDF 0
	TAD I BETA
	DCA SAVE	/SAVE CONTENTS OF BETA REGISTER
/MAIN LOOP - GET CHARACTERS AND CALL DISPLAY ROUTINE

NEW,	LAS		/LINE COUNT FROM SWITCH REGISTER
	DCA LINKNT
	DCA I BETA	/GO TO LEFT MARGIN
	TAD BUFFER
	DCA BPTR	/POINT TO BEGIN OF BUFFER
	TAD YINIT
	DCA YCOORD	/GO TO TOP OF SCREEN
ENTRY,	JMS	DISP	/DISPLAY 3D CHAR ( ALSO SETS DF)
	TAD	BPTR
	CMA CLL
	TAD	BUFEND	/COMPARE BUFFER PTR WITH BUFFER END
	SNL CLA		/AT END OF BUFFER?
	JMP	FULL	/YES - LINK OFF AT FULL MEANS EXIT
ROTT1,	RTL		/NOTE LINK=1 IF WE FELL INTO HERE!
	RTL		/ROTATE HI ORDER BITS INTO SHIFT REG
	SPA		/TEST FOR SHIFT REGISTER FULL
	JMP	ENTRY	/YES - GO DIAPLAY IT
	DCA	T1	/RESAVE SHIFT REGISTER
	TAD I	BPTR	/GET NEXT BUFFER WORD
	JMS	DISP	/DISPLAY LOW-ORDER
	TAD I	BPTR
	ISZ	BPTR	/BUMP PTR
/	NOP
	AND	L7410	/GET HIGH ORDER - THE 10 IS HARMLESS
	CLL RAL
	TAD	T1	/ADD HIGH ORDER TO SHIFT REGISTER.
	JMP	ROTT1	/INVOLUTED CODE.
/DISPLAY SUBROUTINE - DISPLAYS A CHARACTER

DISP,	0
KCDF,	CDF 0
YINIT,	AND L177
	SNA
	JMP	SCDF	/IGNORE NULLS
	TAD	L7640
	CLL CML
	TAD	L100	/CHECK WHETHER THE CHARACTER
	SZL		/IS OUTSIDE OF THE RANGE [40,137]
	JMP	UGH	/YES - SUBSTITUTE SPACE OR L.F.
	CLL RAL
MAGIC,	TAD CBASE	/ADD IN BASE ADDR
	DCA RIGHT	/GET DISPLAY BIT PATTERN PTR
	TAD I RIGHT
	DCA LEFT	/GET LEFT HALF OF DISPLAY BITS
	ISZ RIGHT
	TAD I RIGHT
	DCA RIGHT	/GET RIGHT HALF
	TAD YCOORD	/PUT ORDINATE IN AC
	LINC
YINC,	1760		/DSC I
LEFT,	0		/DISPLAY LEFT HALF
	1760		/DSC I
RIGHT,	0		/DISPLAY RIGHT HALF
	CLR
	ESF		/SMALL CHARACTERS!
	PDP
	ISZ I BETA	/LEAVE A BISSEL SPACE
	TAD I BETA	/GET ABSCISSA
	TAD LINEND	/COMPARE WITH RIGHT MARGIN
L7700,	SMA CLA		/AT RIGHT EDGE OF SCREEN?
	JMP NEWLIN	/YES, GO TO NEXT LINE
SCDF,	6001		/NO, SET PROPER DF
	JMP I DISP	/RETURN
/DISPLAY ROUTINE CONTINUED

UGH,	TAD L26		/CHECK FOR LINE FEED
LINEND,	RTR		/OR FORM FEED (LINK=0!)
L7640,	SZA CLA
	JMP MAGIC	/OTHER CONTROL CHARS PRINT BLNK
NEWLIN,	DCA I BETA	/BACK TO LEFT MARGIN
	TAD YCOORD
	TAD YINC
	DCA YCOORD	/MOVE DOWN TO NEXT LINE
	ISZ LINKNT	/AT BOTTOM OF SCREEN?
	JMP SCDF	/NO
	CLL CLA CMA RAL	/TAKE QUOT ON DIV BY 2
	AND BPTR	/AND LEAVE IN AC
FULL,	CIF CDF 0	/YES
	KSF		/GO TO NEXT SCOPE PAGE?
	JMP NEW		/NO, REFRESH
	DCA BUFFER	/GET NEW BUFFER 'START'
	SZL		/END OF BUFFER ?
	JMP NOW		/NO, REFRESH
	TAD SAVE
	DCA I BETA	/RESTORE BETA REGISTER
OVERX,	CLA STL RAL IAC	/ADD 3
	TAD SCOPE	/TO RET ADDRESS
	DCA SCOPE
XCIF,	CHRTBL-BEGIN-1	/RESTORE INST FIELD & DATA FIELD
	JMP I SCOPE	/LEAVE
L177,	177
L100,	100
NOW,	KRB
/	AND L177
	TAD M3
	SZA CLA
	JMP NEW
	JMP I .+1
	7605
L70,	70
M3,	-203		/** TEMP
/BETTER STUFF, PRINTS ^C
/NOW,	TAD L7600
/	KRS
/	TAD M7603
/	SZA CLA
/	JMP NEW
/	JMP I L7600
/L7600,	7600
/M7603,	-7603
	PAGE
/THE TABLE OF PATTERN WORDS BEGINS HERE

CHRTBL,	0000; 0000	/SPACE
	7500; 0000	/!
	7000; 0070	/"
	7714; 1477	/#
	5721; 4671	/$
	6661; 4333	/%
	5166; 0526	/&
	0000; 0070	/'
	3600; 0041	/(
	4100; 0036	/)
	2050; 0050	/*
	0404; 0437	/+
	0500; 0006	/,
	0404; 0404	/-
	0001; 0000	/.
	0601; 4030	//
	4536; 3651	/0
	2101; 0177	/1
	4523; 2151	/2
	4122; 2651	/3
	2414; 0477	/4
	5172; 0651	/5
	1506; 4225	/6
	4443; 6050	/7
	5126; 2651	/8
	5122; 3651	/9
	2200; 0000	/:
	4601; 0000	/;
	2410; 0042	/<
	1212; 1212	/=
	4200; 1024	/>
	4020; 2055	/?
	4136; 3656	/@
	4477; 7744  	/A
	5177; 2651	/B
	4136; 2241	/C
	4177; 3641	/D
	4577; 4145	/E
	4477; 4044	/F
	4136; 2645	/G
	1077; 7710	/H
	7741; 0041	/I
	4142; 4076	/J
	1077; 4324	/K
	0177; 0301	/L
	3077; 7730	/M
	3077; 7706	/N
	4177; 7741	/O
	4477; 3044	/P
	4276; 0376	/Q
	4477; 3146	/R
	5121; 4651	/S
	4040; 4077	/T
	0177; 7701	/U
	0176; 7402	/V
	0677; 7701	/W
	1463; 6314	/X
	0770; 7007	/Y
	4543; 6151	/Z
	4177; 0000	/[
	3040; 0106	/\
	0000; 7741	/]
	2000; 2076	/^
	1604; 0404	/_

	$

