From:	ADVAX::"""l_leahy""@star.enet.dec.com" "Lee Leahy DTN 381-0570 17-May-1991 1016" 17-MAY-1991 15:24:33.80
To:	arisia::everhart
CC:	
Subj:	MONLAT.MAR - Last section of 4

Received: by ADVAX.DECnet (utk-mail11 v1.5) ; Fri, 17 May 91 15:23:02 EDT
Received:  from mcnc by ge-dab.GE.COM (5.61/GE-DAB 1.15) with UUCP
	id AA16411 for ; Fri, 17 May 91 14:41:23 -0400
Received: from enet-gw.pa.dec.com by mcnc.mcnc.org (5.59/MCNC/3-21-91)
	id AA13598; Fri, 17 May 91 10:16:18 -0400
	for ARISIA.dnet.ge.com!EVERHART
Received: by enet-gw.pa.dec.com; id AA27392; Fri, 17 May 91 07:15:27 -0700
Message-Id: <9105171415.AA27392@enet-gw.pa.dec.com>
Received: from star.enet; by decwrl.enet; Fri, 17 May 91 07:15:41 PDT
Date: Fri, 17 May 91 07:15:41 PDT
From: Lee Leahy DTN 381-0570  17-May-1991 1016 <"l_leahy"@star.enet.dec.com>
To: arisia::everhart
Subject: MONLAT.MAR - Last section of 4
 
 
20$:	PUSHL	R3			; Save R3
	PUSHL	R1			; Save R1
	MOVL	NUMGC,R1		; Get number already stored
30$:	CMPL	R1,#GCMAX		; Any more room?
	BGEQU	40$			; If GEQU, no more room
	FFS	#0,#32,GCMASK,R3	; Look for a set bit
	BEQL	40$			; If EQL, none found
	BBCC	R3,GCMASK,35$		; Clear the bit
35$:	ADDB3	R0,R3,GCODES(R1)	; Save group code number
	INCL	R1			; Count group code number
	BRB	30$			; Look for more
40$:	MOVL	R1,NUMGC		; Save new number of Group codes
	POPL	R1			; Restore R1
	POPL	R3			; Restore R3
	RSB				; Done with this longword

GET_GCODE:
 
; Get group code to watch for
 
	MOVL	#18,INPSTRDSC
	PUSHAB	INPSIZ
	PUSHAB	GPRMT
	PUSHAB	INPSTRDSC
	CALLS	#3,G^LIB$GET_INPUT
 
; Convert group code
 
	CLRL	R1
	CLRW	R2
10$:	MOVZBL	INPSTR(R2),R0
	SUBL2	#^A/0/,R0
	MULL2	#^D10,R1
	ADDL2	R0,R1
	INCW	R2
	CMPW	R2,INPSIZ
	BLSS	10$
	MOVB	R1,GCODE
	RSB

GET_ADDR:
 
; Get the address to look for from the user.
 
	MOVL	#18,INPSTRDSC		; Maximum input size is 18 bytes
	PUSHAB	INPSIZ			; Place to store # of bytes entered
	PUSHAB	APRMT			; Prompt to display
	PUSHAB	INPSTRDSC		; Place to store input string
	CALLS	#3,G^LIB$GET_INPUT
 
	CLRL	R1			; Index to next input character
	CLRL	R3			; Index to next address byte
 
; Get the first digit of the next address byte.
 
10$:	MOVZBL	INPSTR(R1),R0		; Get next input character
	INCL	R1			; Bump input character index
	CMPB	R0,#^A/A/		; Is this a letter or greater?
	BGEQU	20$			; If GEQU, yes, so branch
	SUBL3	#^A/0/,R0,R2		; Convert digit character to digit
	BRB	30$			; Get the next input character
20$:	SUBL2	#^A/A/,R0		; Convert letter character to digit
	ADDL3	#^D10,R0,R2		; Add ten to have correct digit
 
; Get the second digit of the next address byte.
 
30$:	MULL2	#^D16,R2		; Put the first digit into its place
	MOVZBL	INPSTR(R1),R0		; Get next input character
	INCL	R1			; Bump input character index
	CMPB	R0,#^A/A/		; Is this a letter or greater?
	BGEQU	40$			; If GEQU, yes, so branch
	SUBL2	#^A/0/,R0		; Convert digit character to digit
	BRB	50$			; Go to add the second digit
40$:	SUBL2	#^A/A/,R0		; Convert letter character to digit
	ADDL2	#^D10,R0		; Add ten to have correct digit
50$:	ADDL	R0,R2			; Add lower digit to address
 
; Store this address byte and see if we need to do more.
 
	MOVB	R2,DSTADR(R3)		; Store this address byte
	INCL	R3			; Bump to next address byte
	CMPL	R3,#^D06		; Have we processed 6 bytes?
	BLSS	60$			; Branch if not, more to do
	RSB				; Else return to caller
60$:	INCL	R1			; Skip over "-" in input string
	BRW	10$			; Do next address byte

GET_TIME:
 
; Get number of hours to run test for
 
GET_HOUR:
	BSBW	BLANK
	MOVL	#6,INPSTRDSC
	PUSHAB	INPSIZ
	PUSHAB	HPRMT
	PUSHAB	INPSTRDSC
	CALLS	#3,G^LIB$GET_INPUT
 
; Convert number of hours
 
	CLRL	R1
	CLRW	R2
NUM_LOOP2:
	MOVZBL	INPSTR(R2),R0
	SUBL2	#^A/0/,R0
	MULL2	#^D10,R1
	ADDL2	R0,R1
	INCW	R2
	CMPW	R2,INPSIZ
	BLSS	NUM_LOOP2
	CMPL	R1,#^D23
	BGTR	GET_HOUR
	MOVL	R1,HOURS
 
; Get number of minutes to run test for
 
GET_MINUTE:
	MOVL	#6,INPSTRDSC
	PUSHAB	INPSIZ
	PUSHAB	MPRMT
	PUSHAB	INPSTRDSC
	CALLS	#3,G^LIB$GET_INPUT
 
; Convert number of minutes
 
	CLRL	R1
	CLRW	R2
NUM_LOOP3:
	MOVZBL	INPSTR(R2),R0
	SUBL2	#^A/0/,R0
	MULL2	#^D10,R1
	ADDL2	R0,R1
	INCW	R2
	CMPW	R2,INPSIZ
	BLSS	NUM_LOOP3
	CMPL	R1,#^D59
	BGTR	GET_MINUTE
	MOVL	R1,MINUTES
 
; Get number of seconds to run test for
 
GET_SECOND:
	MOVL	#6,INPSTRDSC
	PUSHAB	INPSIZ
	PUSHAB	SPRMT
	PUSHAB	INPSTRDSC
	CALLS	#3,G^LIB$GET_INPUT
 
; Convert number of seconds
 
	CLRL	R1
	CLRW	R2
NUM_LOOP4:
	MOVZBL	INPSTR(R2),R0
	SUBL2	#^A/0/,R0
	MULL2	#^D10,R1
	ADDL2	R0,R1
	INCW	R2
	CMPW	R2,INPSIZ
	BLSS	NUM_LOOP4
	CMPL	R1,#^D59
	BGTR	GET_SECOND
	MOVL	R1,SECONDS
	RSB
 
SET_TIME:
 
; Determine the time to stop the test
 
; Now put the total time into one string
 
	MOVL	#80,FAOLEN
	$FAO_S	CTRSTR=DTIME,-
		OUTLEN=FAOLEN,-
		OUTBUF=FAODESC,-
		P1=HOURS,-
		P2=MINUTES,-
		P3=SECONDS
 
; Change the ASCII string for the time to a quadword value.
 
	$BINTIM_S-
		TIMBUF=FAODESC,-
		TIMADR=TIME
	MNEGL	TIME+4,TIME+4
	MNEGL	TIME,TIME
	SBWC	#0,TIME+4
 
; Now get the present time and add the test time to get the end time.
 
	$GETTIM_S-
		TIMADR=ENDTIM
	ADDL	TIME,ENDTIM
	ADWC	TIME+4,ENDTIM+4
	RSB

NEXT_R1:
 
; Get the next node entry to print.  We do this based on a scan of the
; nodes in the node table.  Any node that has LBS in the first entry has
; already been printed.  Note that the caller has to set the low order
; bit when it's done with the entry.
;
; Output:
;	R0 = LBS if a node was found, else LBC
;	R2 = address of entry if R0=LBS
 
	MOVL	NODCNT,R0
	MOVAL	NODTBL,R2
10$:	BLBC	(R2),20$		; If LBC, this is a real entry
	ADDL	#NODSIZ,R2		; Get to next entry
	SOBGTR	R0,10$			; Loop if more to check
	CLRL	R0			; No more
	RSB
 
20$:	MOVL	R2,R1			; Save current lowest as current
 
30$:	ADDL	#NODSIZ,R1		; Get to next entry
	BLBS	(R1),50$		; If LBS, this is not a real entry
	CMPL	(R1),(R2)		; Is the new entry lower?
	BGTRU	50$			; If GTR, no
	BLSSU	40$			; If LSS, yes
	CMPW	4(R1),4(R2)		; Is the new entry lower?
	BGEQU	50$			; If GEQ, no
40$:	MOVL	R1,R2			; Save new lowest
50$:	SOBGTR	R0,30$			; Loop if more to check
	MOVL	#1,R0			; Found one
	RSB	

EXIT:
	BSBW	BLANK
	PUSHAB	DNEMSG
	CALLS	#1,G^LIB$PUT_OUTPUT
	BSBW	BLANK
 
	$DASSGN_S-
		CHAN=CHNLAT
	$DASSGN_S-
		CHAN=CHNRMC
 
	$EXIT_S

BLANK:
 
; Print blank line
 
	PUSHAB	BLNKMSG
	CALLS	#1,G^LIB$PUT_OUTPUT
	RSB

; An error has occured, so print R0 value and 2nd longword of IOSB.
 
ERROR:	PUSHL	R0			; Pass R0 error code
	CALLS	#1,RBL$ERCODE		; Print error code
 
; Print IOSB 2nd longword value in hex
 
	MOVL	#80,FAOLEN
	$FAO_S	CTRSTR=IOMSG,-
		OUTLEN=FAOLEN,-
		OUTBUF=FAODESC,-
		P1=IOSB+4
 
	PUSHAB	FAODESC
	CALLS	#1,G^LIB$PUT_OUTPUT
 
	BRW	EXIT			; Now exit normally
 
	.PAGE
 
; RBL$ERCODE
;
; This subroutine accepts a VMS error code in binary
; and print the message on the terminal.
;
; INPUT:	4(AP) = Error Code
;
; OUTPUT:	all registers saved except R0 and R1
;
; CALLING SEQ:	PUSHx	error code
;		CALL_S	#1,RBL$ERCODE
;
 
	.ENTRY	RBL$ERCODE,^M<R3,R4>
 
	MOVL	4(AP),R3		; Get error code
 
	$GETMSG_S-			; Convert error code to message
		MSGID=R3,-
		MSGLEN=ERRMSG_LEN,-
		BUFADR=ERRMSG_BUF_DESC
 
	PUSHAB	ERRMSG_BUF_DESC
	CALLS	#1,G^LIB$PUT_OUTPUT
 
	RET				; Return to caller
 
; Structures used to build error message from error code
 
ERRMSG_BUF_DESC:
ERRMSG_LEN:
	.LONG	256
	.ADDRESS-
		ERRMSG_BUF
ERRMSG_BUF:
	.BLKB	256

; Node table for node addresses already found
;
; The node table contains:
;
; 06 bytes for the current address
; 32 bytes for the mask
; 06 bytes for the node name
; 06 bytes for the service name
 
NODSIZ = 50
NODMAX = 1000
NODCNT:	.LONG	0			; Number currently in the table
NODTBL:	.BLKB	NODMAX*NODSIZ		; Node entries
 
	.END	START
