Google
 

Trailing-Edge - PDP-10 Archives - tops20_v6_1_tcpip_installation_tp_ft6 - uetp/lib/rmtmac.mac
There are 4 other files named rmtmac.mac in the archive. Click here to see a list.
	TITLE	RMTMAC	RMS/MACRO UETP test program

	SEARCH	MONSYM,RMSINT

    	TWOSEG	400000

	T1=1			; Temporary ACs
	T2=2			; ...
	T3=3			; ...
	T4=4			; ...
	P1=5			; Permanent ACs
	P2=6			; ...
	P3=7			; ...
	P=17			; Stack pointer

	RELOC

	STKLEN=20
STACK:	BLOCK	STKLEN		; Stack
	RELOC

START:	RESET%			; Start cleanly
	MOVE	P,[IOWD STKLEN,STACK]	; Set up stack
	PUSHJ	P,TSTSEQ
	TRNE	T1,1
	JRST	OKSEQ
BADSEQ:	HRROI	T1,[ASCIZ\?Error in sequential tests
\]
	JRST	ENDSEQ
OKSEQ:	HRROI	T1,[ASCIZ\[Sequential tests successful]
\]
ENDSEQ:	PSOUT%			; Print message
	PUSHJ	P,TSTREL	; Test relative files
	TRNE	T1,1
	JRST	OKREL
BADREL:	HRROI	T1,[ASCIZ\?Error in relative tests
\]
	JRST	ENDREL
OKREL:	HRROI	T1,[ASCIZ\[Relative tests successful]
\]
ENDREL:	PSOUT%			; Print message
	PUSHJ	P,TSTIDX	; Test indexed files
	TRNE	T1,1
	JRST	OKIDX
BADIDX:	HRROI	T1,[ASCIZ\?Error in indexed tests
\]
	JRST	ENDIDX
OKIDX:	HRROI	T1,[ASCIZ\[Indexed tests successful]
\]
ENDIDX:	PSOUT%			; Print message
	HALTF%			; Quit
;
; TSTSEQ creates, writes, and reads a sequential file
;
	RELOC

SEQBUF:	BLOCK	1		; Record buffer

SEQFAB:	FAB$B
	F$FNA	[ASCIZ\RMSRMS.SEQ\]
	F$ORG	FB$SEQ		; Sequential
	F$RFM	FB$FIX		; Fixed format
	F$MRS	1		; One word records
	F$BSZ	^D36		; 36-bit bytes
	F$FAC	FB$GET!FB$PUT!FB$DEL	; Lots of access
	F$FOP	FB$SUP		; Supersede old files
	FAB$E

SEQRAB:	RAB$B
	R$FAB	SEQFAB		; Point at FAB
	R$UBF	SEQBUF		; Point at buffer
	R$RSZ	1		; Records always one byte long
    	R$USZ	1		; Buffer is one word long
	RAB$E

	RELOC

TSTSEQ:	$CREATE	SEQFAB		; Create the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	$CONNECT SEQRAB		; Connect a stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
;
; Write some records to the file.  Each record is
; one word long and contains the number of the
; record, i.e., the 10th record contains 10.
;
	MOVEI	P1,20		; Write 20 records
	MOVEI	T1,1		; Set up buffer
	MOVEM	T1,SEQBUF	; ...
S.LP1:	$PUT	SEQRAB		; Write a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	AOS	SEQBUF		; Increment record
	SOJG	P1,S.LP1	; Check counter and loop
	$DISCONNECT SEQRAB	; Terminate record stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	$CONNECT SEQRAB		; Start over at top of file
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
;
; Read through the file, checking that all 20 records exist.
; Delete every even-numbered record.
;
    	MOVEI	P1,20		; Read 20 records
	MOVEI	P2,1		; Record count
S.LP2:	$GET	SEQRAB		; Read a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	CAME	P2,SEQBUF	; Check that record contains correct data
	  JRST	S.QUIT		; No - quit
	TRNE	P2,1		; Is number even?
	  JRST	S.ODD		; No - skip $DELETE
	$DELETE	SEQRAB		; Yes - delete the record
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
S.ODD:	ADDI	P2,1		; Increment record counter
	SOJG	P1,S.LP2	; Loop until done
;
; At this point, we should have read to EOF.  The next
; $GET should make us bomb.
;
	$GET	SEQRAB		; Try for EOF
	CAIE	T2,ER$EOF	; Correct error?
	  JRST	S.QUIT		; No - quit
	$DISCONNECT SEQRAB	; Try again
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	$CONNECT SEQRAB		; Set to head of file
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
;
; Now read the 10 records which are in the file
;
	MOVEI	P1,10		; Count of records
	MOVEI	P2,1		; For data comparison
S.LP3:	$GET	SEQRAB		; Read a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	CAME	P2,SEQBUF	; Check that record contains correct data
	  JRST	S.QUIT		; No - quit
	ADDI	P2,2		; Increment data comparison by 2
	SOJG	P1,S.LP3	; Loop until done
;
; At this point, we should have read to EOF.  The next
; $GET should make us bomb.
;
	$GET	SEQRAB		; Try for EOF
	CAIE	T2,ER$EOF	; Correct error?
	  JRST	S.QUIT		; No - quit
	$DISCONNECT SEQRAB	; Try again
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	$CLOSE	SEQFAB		; Close the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	S.QUIT		; Yes - quit
	JRST	S.EXIT		; Exit successfully
;
; S.QUIT is the error exit; it sets T1 to 0.
; S.EXIT is the success exit; it sets T1 to 1.
;
S.QUIT:	$CLOSE	SEQFAB		; In case it's still open
	TDZA	T1,T1		; Zero T1
S.EXIT:	MOVEI	T1,1		; Set T1 to success
	POPJ	P,		; End of TSTSEQ
;
; TSTREL creates, writes, and reads a sequential file
;
	RELOC

RELBUF:	BLOCK	1		; Record buffer
RELKEY:	BLOCK	1		; Key buffer

RELFAB:	FAB$B
	F$FNA	[ASCIZ\RMSRMS.REL\]
	F$ORG	FB$REL		; Relative
	F$RFM	FB$FIX		; Fixed format
	F$MRS	1		; One word records
	F$BSZ	^D36		; 36-bit bytes
	F$FAC	FB$GET!FB$PUT!FB$DEL	; Lots of access
	F$FOP	FB$SUP		; Supersede old files
	FAB$E

RELRAB:	RAB$B
	R$FAB	RELFAB		; Point at FAB
	R$UBF	RELBUF		; Point at buffer
	R$RSZ	1		; Records always one byte long
    	R$USZ	1		; Buffer is one word long
	R$KBF	RELKEY		; Point at key buffer
	RAB$E

	RELOC

TSTREL:	$CREATE	RELFAB		; Create the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
	$CONNECT RELRAB		; Connect a stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
;
; Write some records to the file.  Each record is
; one word long and contains the number of the
; record, i.e., the 10th record contains 10.
;
	MOVEI	T1,RB$SEQ	; Set sequential access
	$STORE	T1,RAC,RELRAB	; ...
	MOVEI	P1,20		; Write 20 records
	MOVEI	T1,1		; Set up buffer
	MOVEM	T1,RELBUF	; ...
R.LP1:	$PUT	RELRAB		; Write a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
	AOS	RELBUF		; Increment record
	SOJG	P1,R.LP1	; Check counter and loop
	$DISCONNECT RELRAB	; Terminate record stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
	$CONNECT RELRAB		; Start over at top of file
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
;
; Read the records by key
;
	MOVEI	T1,RB$KEY	; Set keyed access
	$STORE	T1,RAC,RELRAB	; ...
    	MOVEI	P1,20		; Read 20 records
R.LP2:	MOVEM	P1,RELKEY	; Set the key to read on
	$GET	RELRAB		; Read a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
	CAME	P1,RELBUF	; Check that record contains correct data
	  JRST	R.QUIT		; No - quit
	SOJG	P1,R.LP2	; Loop until done
	$CLOSE	RELFAB		; Close the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	R.QUIT		; Yes - quit
	JRST	R.EXIT		; Exit successfully
;
; R.QUIT is the error exit; it sets T1 to 0.
; R.EXIT is the success exit; it sets T1 to 1.
;
R.QUIT:	$CLOSE	RELFAB		; In case it's still open
	TDZA	T1,T1		; Zero T1
R.EXIT:	MOVEI	T1,1		; Set T1 to success
	POPJ	P,		; End of TSTREL
;
; TSTIDX creates, writes, and reads an indexed file
;
	RELOC

IDXBUF:	BLOCK	1		; Record buffer

IDXKEY:	BLOCK	1		; Key buffer

I.XAB1:	XAB$B	KEY
	X$REF	1		; 1st alternate key
	X$DTP	XB$STG		; ASCII data
	X$KNM	[ASCIZ\KEY 1\]	; Key name
	X$POS	1		; Key position
	X$SIZ	1		; Key size
	XAB$E

I.XAB0:	XAB$B	KEY
	X$REF	0		; Primary key
	X$DTP	XB$STG		; ASCII data
	X$KNM	[ASCIZ\KEY 0\]	; Key name
	X$POS	0		; Key position
	X$SIZ	1		; Key size
	X$NXT	I.XAB1		; Next XAB in chain
	XAB$E

IDXFAB:	FAB$B
	F$FNA	[ASCIZ\RMSRMS.IDX\]
	F$ORG	FB$IDX		; Sequential
	F$RFM	FB$FIX		; Fixed format
	F$MRS	2		; Two-character records
	F$BSZ	^D7		; 7-bit bytes
	F$FAC	FB$GET!FB$PUT!FB$DEL	; Lots of access
	F$FOP	FB$SUP		; Supersede old files
	F$XAB	I.XAB0		; Point to XAB chain
	FAB$E

IDXRAB:	RAB$B
	R$FAB	IDXFAB		; Point at FAB
	R$UBF	IDXBUF		; Point at buffer
	R$RSZ	2		; Records always two characters long
	R$KBF	IDXKEY		; Key buffer
	R$RAC	RB$KEY		; Keyed access
	R$USZ	1		; Buffer is one word long
	RAB$E

	RELOC

TSTIDX:	$CREATE	IDXFAB		; Create the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	$CONNECT IDXRAB		; Connect a stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
;
; Write some records to the file.  Each record is
; 2 characters long, and they are in the form
;
;	AZ
;	BY
;	CX
;	etc.
;
	MOVEI	P1,^D26		; Write 26 records
	MOVEI	P2,"A"		; Primary key
	MOVEI	P3,"Z"		; Alternate key
I.LP1:	DPB	P2,[POINT 7,IDXBUF,6]	; Write first "field"
	DPB	P3,[POINT 7,IDXBUF,13]	; Write second "field"
	$PUT	IDXRAB		; Write a record
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	ADDI	P2,1		; Increment to next letter
	SUBI	P3,1		; Decrement to previous letter
	SOJG	P1,I.LP1	; Check counter and loop
	$DISCONNECT IDXRAB	; Terminate record stream
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	$CONNECT IDXRAB		; Start over at top of file
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
;
; Read some records.
;
	MOVEI	T1,0		; Try primary key
	$STORE	T1,KRF,IDXRAB	; ...
	MOVEI	T1,"D"		; Try record starting with "D"
	DPB	T1,[POINT 7,IDXKEY,6]	; Set up the key
	MOVEI	T1,1		; and the key length
	$STORE	T1,KSZ,IDXRAB	; ...
	$GET	IDXRAB		; $GET the record
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	MOVE	T2,[POINT 7,IDXBUF]	; Check the record
	ILDB	T1,T2		; Check the first character
	CAIE	T1,"D"		; Should be "D"
	  JRST	I.QUIT		; No - bug
	ILDB	T1,T2		; Check the second character
	CAIE	T1,"W"		; Should be "W"
	  JRST	I.QUIT		; No - bug
;
; Try the alternate key
;
	MOVEI	T1,1		; Try alternate key
	$STORE	T1,KRF,IDXRAB	; ...
	MOVEI	T1,"D"		; Try record whose second character is "D"
	DPB	T1,[POINT 7,IDXKEY,6]	; Set up the key
	MOVEI	T1,1		; and the key length
	$STORE	T1,KSZ,IDXRAB	; ...
	$GET	IDXRAB		; $GET the record
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	MOVE	T2,[POINT 7,IDXBUF]	; Check the record
	ILDB	T1,T2		; Check the first character
	CAIE	T1,"W"		; Should be "W"
	  JRST	I.QUIT		; No - bug
	ILDB	T1,T2		; Check the second character
	CAIE	T1,"D"		; Should be "D"
	  JRST	I.QUIT		; No - bug
	$CLOSE	IDXFAB		; Close the file
	CAILE	T2,ER$MIN	; Error?
	  JRST	I.QUIT		; Yes - quit
	JRST	I.EXIT		; Exit successfully
;
; I.QUIT is the error exit; it sets T1 to 0.
; I.EXIT is the success exit; it sets T1 to 1.
;
I.QUIT:	$CLOSE	IDXFAB		; In case it's still open
	TDZA	T1,T1		; Zero T1
I.EXIT:	MOVEI	T1,1		; Set T1 to success
	POPJ	P,		; End of TSTIDX
	END	START