Google
 

Trailing-Edge - PDP-10 Archives - integ_tools_tops20_v7_30-apr-86_dumper - tools/tvaxv1/gtvr06.mar
There are 7 other files named gtvr06.mar in the archive. Click here to see a list.
	.TITLE	GTVR06 - HANDLING Q-REGISTERS
	INIT	GTVR06
;	STRING INTO Q-REG
;	IN	R0 = ADDR STRING DESC (A,L)
;		R1 = QREG NR
GTVR06IS::	
	PUSHR	#^M<R6,R7,R8,R9,R10>
	BSBW	CHKREG			;CHECK VALIDITY OF Q-REG NUMBER
	TSTL	(R1)			;NUMBER OR NOT FILLED?
	IF.	*NE			
		TSTL	4(R1)		;TEST LENGTH
		IF.	*LTS		;Q-REG LOCKED
			MOVW	#30,GERRN
			RET
		ENDIF.
		BSBW	MOVBUF		;NO REMOVE OLD STRING
	ENDIF.
	ADDL3	GQBUFFA,LL,R3		;END OF BUFFER
	MOVL	4(R0),R6		;LENGTH TO INSERT
	ADDL3	R6,LL,R4
	CMPL	R4,#GBUFS*512		;LENGTH Q-REG BUF EXCEEDED
	IF.	*GT
		MOVW	#19,GERRN	;YES
		RET
	ENDIF.
	ADDL2	R6,LL
	MOVL	R6,4(R1)		;SET LL STR IN Q-DESC
	MOVL	R3,(R1)			;SET ADDR STR IN Q-DESC
	MOVL	(R0),R1
MOV1:
	CMPL	R6,G64K			;LENGTH TO BE MOVED >= 64K
	IF.	*GT
		MOVC3	G64K,(R1),(R3)	;YES, MOVE 64K
		SUBL2 	G64K,R6
		BRW	MOV1
	ENDIF.
	MOVC3	R6,(R1),(R3)
	POPR	#^M<R6,R7,R8,R9,R10>
	RSB
;
;	Q-REG STRING TO CALLER
;	IN	R1 = Q-REG NR
;	OUT	R0 = LL STRING
;		R1 = ADDR STRING
GTVR06OS::
	BSBW	CHKREG
	TSTL	(R1)			;Q-REG FILLED WITH STRING?
	IF.	*EQ
		MOVW	#2,GERRN 	;NO
		RET
	ENDIF.
	MOVL	4(R1),R0		;LL
	IF.	*LTS
		MCOML	R0,R0		;FORCE POSITIVE
	ENDIF.
	MOVL	(R1),R1			;ADDR
	RSB
;
GTVR06OSL::				;AND LOCK IT
	BSBW	CHKREG
	TSTL	(R1)			;Q-REG FILLED WITH STRING?
	IF.	*EQ
		MOVW	#2,GERRN 	;NO
		RET
	ENDIF.
	TSTL	4(R1)
	IF.	*LTS		;ALREADY LOCKED
		MOVW	#30,GERRN
		RET
	ENDIF.
	MOVL	4(R1),R0
	MCOML	4(R1),4(R1)		;MAKE NEG LENGTH
	MOVL	(R1),R1			;RET ADDR
	RSB
;
GTVR06OSF::
	BSBW	CHKREG			;GET DESC
	MCOML	4(R1),4(R1)		;MAKE LL POS
	RSB
;
;
;	NUMERIC VALUE TO Q-REG
;	IN	R0 = VALUE
;		R1 = Q-REG NR
GTVR06IN::
	PUSHR	#^M<R6,R7,R8,R9,R10>
	BSBW	CHKREG
	TSTL	(R1)			;Q-REG FILLED WITH STRING
	IF.	*NE
		TSTL	4(R1)		;TEST LOCKED
		IF.	*LTS
			MOVW	#30,GERRN
			RET
		ENDIF.
		BSBW	MOVBUF		;YES, REMOVE IT
	ENDIF.
	CLRL	(R1)
	MOVL	R0,4(R1)
	POPR	#^M<R6,R7,R8,R9,R10>
	RSB
;
;	Q-REG NUM VALUE TO CALLER
;	IN	R1 = Q-REG NR
;	OUT	R0 = VALUE
GTVR06ON::
	BSBW	CHKREG
	TSTL	(R1)			;Q-REG FILLED WITH NUMBER?
	IF.	*NE
		MOVW	#3,GERRN	;NO, ERROR
		RET
	ENDIF.
	MOVL	4(R1),R0
	RSB
.PAGE
;	ROUTINE TO SHIFT END OF BUFFER FORWARDS
MOVBUF:
;	IN: (R1)  START ADDR OF STRING TO BE REMOVED
;	    4(R1)   LENGTH OF STRING
	PUSHR	#^M<R0,R1>
	CLRL	R0
MODDES:	CMPL	R0,#72
	IF.	*LT			;36 QUAD ENTRIES IN DESCRIPTION BUFFER
		TSTL	DESBUF[R0]
		IF.	*NE		;NOT FILLED OR FILLED WITH NUMBER
			CMPL	DESBUF[R0],(R1)
			IF.	*GT	;ENTRY IS BEHIND THE TO BE REMOVED ONE
				SUBL2	4(R1),DESBUF[R0]
			ENDIF.
		ENDIF.
		ADDL2	#2,R0
		BRW	MODDES
	ENDIF.
	SUBL3	GQBUFFA,(R1),R8
	SUBL2	4(R1),LL
	SUBL3	R8,LL,R9
	MOVL	(R1),R3
	ADDL3	(R1),4(R1),R1
MOVB1:	CMPL	R9,G64K
	IF.	*GT			;LENGTH > 64K
		MOVC3	G64K,(R1),(R3)		;YES MOVE 64K
		SUBL2	G64K,R9
		BRW	MOVB1
	ENDIF.
	MOVC3	R9,(R1),(R3)
	POPR	#^M<R0,R1>
	RSB
CHKREG:
;	ROUTINE TO CHECK NUMBER OF Q-REG
;	IN	R1 = QREG NR IN FIRST BYTE (ASCII)
;	OUT	R1 = ADDR ENTRY IN DESBUF
;
	CLRL	R2
	SUBB3	#48,R1,R2
	IF.	*GES			;CHAR < 0
		CMPB	R2,#9		;NO
		IF.	*GTS		;CHAR > 9
			BICB2	#^X20,R1	;FORCE UPPER CASE
			SUBB3	#65,R1,R2	;YES
			IF.	*GES		;CHAR >= A
				CMPB	R2,#26	;YES
				IF.	*LTS		;CHAR <= Z
					ADDB2	#10,R2	;CHAR A<=X<=Z
					MOVAQ	DESBUF[R2],R1
					RSB
				ENDIF.
			ENDIF.
			MOVW	#10,GERRN
			RET
		ENDIF.
		MOVAQ	DESBUF[R2],R1		;CHAR 0<=X<=9
		RSB
	ENDIF.
	MOVW	#10,GERRN
	RET
LL:	.LONG
;
;	ONE ENTRY :
;		NUMERIC VALUE		AL4 = 0
;					FL4 = THE VALUE
;
;		STRING			AL4 = ADDR STRING
;					FL4 = LENGTH STRING, NEG IF LOCKED
;
DESBUF:	.BLKQ	36
	.END