/ 
/ 
/                   FIRST PRINTING, FEBRUARY 1974
/ 
/ 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 RESPON-
/ SIBILITY FOR ANY ERRORS THAT MAY APPEAR IN THIS
/ DOCUMENT.
/ 
/ THE SOFTWARE DESCRIBED IN THIS DOCUMENT IS FUR-
/ NISHED 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 PRO-
/ VIDED IN WRITING BY DIGITAL.
/ 
/ DIGITAL EQUIPMENT CORPORATION ASSUMES NO RESPONSIBILITY
/ FOR THE USE OR RELIABILITY OF ITS SOFTWARE ON EQUIP-
/ MENT THAT IS NOT SUPPLIED BY DIGITAL.
/ 
/ COPYRIGHT (C) 1974, 1975, BY DIGITAL EQUIPMENT CORPORATION
/ 
/ 
        .EJECT
/THIS IS THE DEVICE-HANDLER FOR THE VW01
/	SONIC DIGITIZER WRITING TABLET
/
/COPYRIGHT 1971,72 DIGITAL EQUIPMENT CORP. MAYNARD, MASS.
/EDIT # 003;	OCT. 9,72
/EDIT # 004	SCR	8/12/75	XVM MESSAGE;GENERAL FIX-UP
/EDIT # 005	SCR	8/13/75	DISABLE BIT PATTERN 142 TO 242
/
/
/LEGAL MACRO'S:
/	.INIT	PROVIDES FOR SOFTWARE INTERRUPT
/		VIA A.P.I. (ADDRESS 73)
/
/	.READ A,M,L,W
/		M (MODE)=0: SINGLE POINT.
/			1: SINGLE POINT MULTIPLEXED.
/			2: DATA INPUT (NOT SCAN!)
/			3: DATA INPUT MULTIPLEXED (SCAN!)
/		L (LINE BUFFER ADDRESS) 
/			POINTER TO 3-WORD BUFFER
/		W (NUMBER OF COORDINATE PAIRS)
/		  EACH COORDINATE PAIR IS REPRESENTED
/		  BY 3 WORDS - STATUS, X & Y.
/
/	.WAIT
/
/	.WAITR
/
/	.CLOSE
/
/	.FSTAT
/
/ALL OTHER MACRO'S WILL BE IGNORED BY THIS HANDLER
/
/
	.EJECT
/WRITING TABLET IOT'S
/
WTSC=703224	/SET WRITING TABLET CONTROL.
WTRX=703222	/READ X-COORDINATE.
WTRY=703242	/READ Y-COORDINATE.
WTRS=703262	/READ STATUS.
WTCD=703241	/CLEAR DATA READY FLAG.
WTCP=703221	/CLEAR PEN DATA FLAG.
WTSK=703261	/WRITING TABLET SKIP.
WTSE=703264	/SELECT TABLET.
/
EXERR=137	/EXPANDED-ERROR PROCESSOR
.MED=3		/REGULAR ERROR PROCESSOR
/
	.EJECT
	.GLOBL VWA.
VWA.	DAC	VWCALP	/SAVE CAL-POINTER.
	DAC	VWARGP	/SAVE ARGUMENT POINTER.
	ISZ	VWARGP	/SET PNTR TO FUNCTION-CODE.
	LAC*	VWARGP	/GET UNIT #.
	RTL
	RTL
	AND (3
	DAC UNIT#
	LAC* VWARGP	/GET FUNCTION CODE
	AND	(17	/SELECT FUNCTION-BITS.
	ISZ	VWARGP	/SET UP FOR LOC+2
	TAD	(JMP VWDISP	/SET UP DISPATCH.
	DAC	.+1
VWDISP	0		/FUNCTION-DISPATCH!
	JMP	VWINIT	/01=.INIT
	JMP	VWFST	/02=.FSTAT
	JMP	VWIGNR	/03=.SEEK    (IGNORED)
	JMP	VWIGNR	/04=.ENTER   (IGNORED)
	JMP	VWRET	/05=.CLEAR   (IGNORED)
	JMP	VWCLOS	/06=.CLOSE
	JMP	VWRET	/07=.MTAPE   (IGNORED)
	JMP	VWREAD	/10=.READ
	JMP	VWILLG	/11=.WRITE   )IGNORED)
	JMP	VWWAIT	/12=.WAIT,.WAITR
	ISZ	VWARGP	/13=.TRAN    (IGNORED)
VWILLG	ISZ	VWARGP
	JMP	VWIGNR
/
/
VWCALP	0		/CAL-POINTER
VWARGP	0		/ARGUMENT-POINTER
/
/
	.EJECT
/FOLLOWING THE SERVICE FOR THE MACRO .INIT AND .CLOSE
/
VWINIT	ISZ	VWARGP	/(004)MAKE VWARGP COMMON WITH CLOSE
	ISZ	VWARGP	/(004)
VWCLOS	DZM	VWIOB	/(004) TURN OFF ALL
	WTCD		/(004) CLEAR DATA READY FLAG
	WTCP		/(004) CLEAR PEN DATA FLAG
	LAC	(242	/(005) CDISABLE INTERRUPTS
	WTSC		/(004)
/
VWCAL	CAL+73		/.SETUP FOR PIC AND APICHANNEL 73
VWBUFF	16
	WTSK	/WRITING TABLET SKIP.
	VWINT		/ADDRESS OF INTERRUPT-HANDLER.
	LAC	(JMP VWRET	/SKIP .SETUP NEXT TIME.
	DAC	VWCAL
VWRET	DBR
	XCT	(JMP* VWARGP	/RETURN PAST CAL.
/
/
VWBUSY	DBR
	XCT	(JMP* VWCALP	/RETURN TO CAL.
/
/
/
	.EJECT
/FOLLOWING THE SERVICE FOR THE MACR0'S:
/	.FSTAT,.DLETE,.RENAM !
/.DLETE AND .RENAM WILL BE IGNORED!
/
/
/
VWFST	LAC*	VWCALP	/GET CAL.
	AND	(3000	/SELECT SUB-FUNCTION BITS.
	SAD	(3000	/TEST FOR .FSTAT!
	SKP		/.FSTAT!
	JMP	VWIGNR	/.DLETE OR .RENAM !
	LAC*	VWARGP	//CLEAR BITS 0-2 OF LOC+2
	AND	(77777	//INDICATING THAT IT IS A
	DAC*	VWARGP	//NON-FILE ORIENTED DEVICE.
	CLA		/AC=0: FILE NOT FOUND.
	JMP	VWIGNR
/
/
/
	.EJECT
/FOLLOWING THE SERVICE FOR THE MACRO .READ !
/
/
/
VWREAD	LAC	VWIOB	/GET BUSY FLAG.
	SZA		/BUSY?
	JMP	VWBUSY	/YES
	DZM	VWMXC	/RESET MULTIPLEX MODE FLAG.
	LAC*	VWARGP	/GET BUFFER-ADDRESS!
	DAC	VWIOB	/SET HANDLER BUSY FLAG!
	DAC	VWBUFF	/STORE BUFFER-ADDRESS.
	AND	(700000	/(004) CHECK LEGAL ADDR IN LOW CORE
	SZA		/(004) SKIP IF OK
	JMP	IOP67	/(004) NO, MESSAGE
	ISZ	VWARGP	/LOC+3
	LAC* VWARGP
	DAC WPCOUNT
	LAC*	VWCALP	/GET CAL FOR THE MODE!
	AND	(3000	/SELECT MODE BITS.
	SWHA		/PUT MODE BITS IN AC BITS 15-17
	TAD	(JMP VWMODE+1
	DAC	.+1	/DISPATCH FOR THE MODES.
VWMODE	0		/DISPATCH LOCATION FOR MODES.
	JMP	VWSP	/SINGLE POINT!
	JMP	VWSPMX	/SINGLE POINT MULTIPLEXED!
	JMP	VWNOS	/NOT SCAN!
	JMP	VWSCAN	/SCAN!
WPCOUNT	0
/
//
/
	.EJECT
/SERVICE FOR THE SINGLE POINT AND NOT SCAN MODE.
/
/
VWSP	JMS GUNIT
	LAC VWSPC
	WTSC
	JMP VWTST
VWNOS	JMS GUNIT
	LAC	VWNOSC	/CONTROL VALUE FOR NOT SCAN.
	WTSC		/SET CONTROL.
	JMP VWTST
GUNIT	0
	LAC UNIT
	TAD	(LAC VWUSC	/PREPARE DISPATCH FOR THE RIGHT CODE.
	DAC	.+1
	0
	WTSE		/SELECT THE REQUESTED WRITING TABLET.
	JMP* GUNIT
/
/
/
	.EJECT
/SERVICE FOR THE SINGLE POINT MULTIPLEXED MODE.
/
VWSPMX	CLA
	WTSE		/CLEAR ALL TABLETS
	LAC VWSPC
	DAC VWMXC
	WTSC		/SELECT WRITING TABLET
	JMP VWTST
/
/
/SERVICE FOR SCAN MODE.
/
VWSCAN	LAC	VWSCC	/GET CONTROL VALUE FOR SCAN.
	WTSC		/SET CONTROL
	JMP	VWTST
/
/
VWTST	WTRS+10
	AND (170000
	SZA
	JMP VWIGNR
VWRTY1	LAW 4
	JMS* (EXERR
	JMP VWRTY
	LAW -4
	.SIXBT	' VW NOT RDY'
VWRTY	WTRS+10
	AND (170000
	SNA
	JMP VWRTY1
	DAC VWIOB
VWIGNR	ISZ	VWARGP	/(004) FIX ARGP FOR EXIT
	JMP	VWRET	/(004) AND GO EXIT
/
/
/
/
VWSPC	421		/WRITING TABLET ENABLE
			/DATA READY INTERRUPT ENABLE
			/SINGLE POINT ENABLE
VWNOSC	1131		/WRITING TABLET ENABLE
			/SCAN DISABLE = NOT SCAN ENABLE
			/DATA READY INTERRUPT ENABL
			/PEN DATA INTERRUPT ENABLE
VWSCC	1125		/WRITING TABLET ENABLE
			/SCAN ENABLE
			/DATA READY INTERRUPT ENABLE
			/PEN DATA INTERRUPT ENABLE
VWUSC	10		/WRITING TABLET 1 SELECT CODE
	10
	4
	2
	1
/
IOP67	LAW	67	/(004)ILLEGAL CORE MESSAGE
	JMP*	(.MED+1	/(004) TO MONITOR ERROR
/
/
/
	.EJECT
/FOLLOWING THE SERVICE FOR THE MACRO .WAIT
/
VWWAIT	LAC*	VWCALP	/GET CAL FOR SUB-FUNCTION
	AND	(1000	/SELECT FUNCTION-CODE BIT
	SZA		/.WAIT?
	JMP	VWWT10	/NO, IT IS .WAITR1
	LAC	VWIOB	/GET INTERRUPT BUSY.
	SZA		/INTERRUPT SERVICE STILL BUSY?
	JMP	VWBUSY	/YES!
	JMP	VWRET
/
/
/
/
/FOLLOWING THE SERVICE FOT THE MACRO .WAITR
/
VWWT10	LAC	VWIOB	/GET INTERRUPT BUSY FLAG.
	SNA		/INTERRUPT STILL BUSY?
	JMP	VWIGNR	/NO.
	LAC	VWCALP	/GET CAL-ADDRESS.
	AND	(700000	/SELECT "DEBREAK" BITS
	DAC	VWCALP	/STORE TEMPORARILY.
	LAC*	VWARGP	/GET WAIT-RETURN ADDRESS.
	AND	(77777	/STRIP OFF THE "DEBREAK" BITS.
	XOR	VWCALP	/INSERT "DEBREAK" BITS FROM CAL!
	DAC	VWARGP
	JMP	VWRET
/
/
/
	.EJECT
/THIS IS THE INTERRUPT HANDLER FOR THE WRITING TABLET.
/
/
/ENTRY SECTION FOR PIC.
/
VWPIC	DAC	VWAC	/(004) DELETE DBA!SAVE AC.
	LAC*	(0	/GET THE ADDRESS WHERE INTERRUPTED.
	DAC	VWPC	/STORE FOR PROPER RETURN.
	LAC	(ION	/GET ION COMMAND.
	JMP	VWNT10	/SHARE REST OF CODING WITH API.
/
/
/
/ENTRY SECTION FOR API.
/ONLY THE FIRST WORD IS USED BY PIC TO TRANSFER 
/CONTROL TO THE PIC-ENTRY
/
/
VWINT	JMP	VWPIC	/THIS IS THE ENTRYFOR PIC.
	DAC	VWAC	/(004)DELETE DBA!THIS IS THE FIRST WORD FOR API.
	LAC	VWINT	/GET ADDRESS WHERE INTERRUPTED.
	DAC	VWPC	/STORE FOR PROPER RETURN.
	LAC	(JMP VWPIC	/GET JUMP TO PIC.
	DAC	VWINT	/RESTORE ENTRY FOR PIC.
	LAC	(700000	/(004) IOT NOP FOR EXIT FROM API
VWNT10	DAC	VWION	/STORE ION OR NOP FOR RETURN.
	WTRS+10		/READ WRITING TABLET STATUS
	DAC*	VWBUFF	/STORE STATUS IN USER-BUFFER.
	ISZ	VWBUFF	/PRESET FOR BUFFER+1.
	WTRX+10		/READ X-COORDINATES.
	DAC*	VWBUFF	/STORE X-COORDINATES.
	ISZ	VWBUFF	/PRESET FOR BUFFER+2
	WTRY+10		/READ Y-COORDINATES.
	DAC*	VWBUFF	/STORE Y-COORDINATES.
	ISZ VWBUFF
	CLA	
	SAD	VWMXC	/SINGLE POINT MULTIPLEXED??
	SKP		/NO.
	WTSE		/CLEAR ALL WRITING TABLETS.
	WTCD		/CLEAR DATA READY FLAG.
	WTCP		/CLEAR PEN DATA FLAG.
	ISZ WPCOUNT
	JMP VWIRT
	LAC	(242	/(005) CHANGE 142 TO 242
	WTSC
	DZM	VWIOB	/CLEAR INTERRUPT SERVICE BUSY.
VWIRT	LAC	VWAC	/RESTORE AC.
VWION	0		/ION OR NOP COMMAND.
	DBR
	JMP*	VWPC	/RETURN TO INTERRUPTED PROGRAM.
/
/
/
VWMXC	0		/MULTIPLEX MODE FLAG
VWIOB	0		/BUSY FLAG FOR THE HANDLER.
VWAC	0		/STORAGE FOR AC.
VWPC	0		/RETURN ADDRESS.
/
/
/
/
	.END
