LTODAT.MAC
.Title	LTODAT - (Fortran) Write today's day & date to the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	11-Jul-81	CVLLIB Routine

.globl	todayt,lretc

		.If eq 1
Called by
		I = LTODAT(dateblock)

writes today's day and date (in the form "Sunday 4-Jan-81") to the terminal.
If no date was set up on the system, nothing is written in, and the function
returns -1.  Otherwise 0 is returned.

The <dateblock> is set up with today's date information.
		.Endc


LTODAT::
	mov	2(r5),r2	;Dateblock address
	call	todayt
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

LTODAY.MAC
.Title	LTODAY - (Fortran) Write today's day & date to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	today,lretc,lr$adj

		.If eq 1
Called by
		INTEGER LTODAY
		I = LTODAY(dateblock,string,last)

writes today's day and date (in the form "Sunday 4-Jan-81") to <string>.
<last> is incremented by the number of bytes filled.  If no date was
set up on the system, nothing is written in, and the function returns -1.
Otherwise 0 is returned.

The <dateblock> is set up with today's date information.
		.Endc


LTODAY::
	mov	2(r5),r2	;Dateblock address
	mov	4(r5),r1	;String
	call	today
	call	lretc		;Set up R0 depending upon carry
	jmp	lr$adj		;and go and set up <last>
.end

LWDAYT.MAC
.Title	LWDAYT - (Fortran) Write name of day to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wdayt

		.If eq 1
Called by
		CALL	LWDAYT(value)

writes the name of the day corresponding to <value> to the
user's terminal.  Numbers from 1 to 7 produce "Sunday" through
"Saturday" respectively; anything else produces "Illegal".
		.Endc

LWDAYT::
	mov	@2(r5),r0
	jmp	wdayt
.end

LWDAY.MAC
.Title	LWDAY - (Fortran) Write name of day to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wday

		.If eq 1
Called by
		CALL	LWDAYT(value,string,last)

writes the name of the day corresponding to <value> to the
string in <string>.  Numbers from 1 to 7 produce "Sunday" through
"Saturday" respectively; anything else produces "Illegal".

<last> is incremented by the number of bytes filled.
		.Endc

LWDAY::
	mov	@2(r5),r0
	call	lw$adj
	.word	wday
.end

LWSDTT.MAC
.Title	LWSDTT - (Fortran) Write system date to the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	wsdatt,lretc

		.If eq 1
Called by
		INTEGER LWSDTT
		I = LWSDTT(dateblock,flag)

sends the system date to the terminal in the form "3-Jan-81".
<dateblock> receives the date information relevant to the present day.

<flag> is used to determine whether to include a leading space should the
day number be less than 10.  If <flag> be negative, there will be a leading
space if the day be <10.

The function returns -1 if no date has been set on the system, and 0 otherwise
		.Endc

LWSDTT::
	mov	@4(r5),r0	;Flag
	mov	2(r5),r2	;Dateblock
	call	wsdatt
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

LWSDAT.MAC
.Title	LWSDAT - (Fortran) Write system date to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	lr$adj,wsdat,lretc

		.If eq 1
Called by
		INTEGER LWSDAT
		I = LWSDAT(dateblock,string,last,flag)

puts the system date into <string> in the form "3-Jan-81".
<last> is incremented by the number of bytes used.
<dateblock> receives the date information relevant to the present day.

<flag> is used to determine whether to include a leading space should the
day number be less than 10.  If <flag> be negative, there will be a leading
space if the day be <10.

The function returns -1 if no system date has been set, 0 otherwise.
		.Endc

LWSDAT::
	mov	@10(r5),r0	;Flag
	mov	4(r5),r1	;String address
	mov	2(r5),r2	;Dateblock
	call	wsdat
	call	lretc		;Set R0/-1 if CS, 0 if CC
	jmp	lr$adj		;Set up <last> and return
.end

LWDATT.MAC
.Title	LWDATT - (Fortran) Write date to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	wdatt

		.If eq 1
Called by
		CALL LWDATT(dateblock,flag)

Types the date from the dateblock to the terminal.

<flag> is used to determine whether or not to print a leading space should the
day value be less than 10.  If <flag> be negative, there will be a leading
space if day be less than 10.
		.Endc

LWDATT::
	mov	2(r5),r2	;Dateblock
	mov	@4(r5),r0	;Flag
	jmp	wdatt
.end

LWDAT.MAC
.Title	LWDAT - (Fortran) Write date to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	wdat,lw$adj

		.If eq 1
Called by
		CALL LWDAT(dateblock,string,last,flag)

Types the date from <dateblock> to the string.
<last> is incremented by the number of bytes filled.

<flag> is used to determine whether or not to print a leading space should the
day value be less than 10.  If <flag> be negative, a leading space will be
printed if day be less than 10.
		.Endc

LWDAT::
	mov	2(r5),r2	;Dateblock
	mov	@4(r5),r0	;Flag
	call	lw$adj
	.word	wdat
.end

LRSDAT.MAC
.Title	LRSDAT - (Fortran) Move System date into dateblock offset RTDAT
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rsdat,lretc
		.If eq 1
Called by
		INTEGER LRSDAT
		I = LRSDAT(dateblock)

places the system date information in the RTDAT offset in <dateblock>
and returns -1 if system date not set up (0 otherwise).
If system date set up, conversion is performed on the date from RT11 format
to words in the appropriate offsets within <dateblock>.
		.Endc

LRSDAT::
	mov	2(r5),r2	;Dateblock
	call	rsdat
	jmp	lretc
.end

LRDATT.MAC
.Title	LRDATT - (Fortran) Read date from terminal
.nlist	bex,sym,toc
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	9-Jan-82	CVLLIB Routine

.globl	rdatt

		.If eq 1
Called by
		INTEGER LRDATT
		I = LRDATT(dateblock,char,flag)

Reads the date from the terminal, storing it in the locations in <dateblock>.
The number of the day in the year is set in the DYEAR offset,
and the RT-11 version of the date in the RTDAT offset.
<char> receives the delimiting character from the input.

The value returned is -1 if an illegal date was typed, or the number (1-7,
Sunday through Saturday) of the day of the week corresponding to that date.

<flag> is an indication of the expected date format.  If <flag> be zero, the
month must be alphabetic, and be between the day and the year.  If positive,
the British convention of day/month/year (numeric month) is permitted, and
if <flag> be negative, the American convention of month/day/year may be used.
		.Endc

LRDATT::
	mov	2(r5),r2	;Dateblock
	mov	@6(r5),r0	;Flag
	call	rdatt
	movb	(r1),@4(r5)
	return
.end

LRDAT.MAC
.Title	LRDAT - (Fortran) Read date from a string
.nlist	bex,sym,toc
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	9-Jan-82	CVLLIB Routine

.globl	lr$adj,rdat

		.If eq 1
Called by
		INTEGER LRDATT
		I = LRDATT(dateblock,string,last,flag)

Reads the date from the string, storing it in the locations in <dateblock>.
The day of the year is also set in the DYEAR offset,
and the RT-11 version of the date in the RTDAT offset.

The value -1 is returned if an illegal date was typed, or the number (1-7,
Sunday through Saturday) of the day of the week corresponding to that date.

<last> is incremented by the number of bytes read from the string.

<flag> is an indication of the expected date format.  If <flag> be zero, the
month must be alphabetic, and be between the day and the year.  If positive,
the British convention of day/month/year (numeric month) is permitted, and
if <flag> be negative, the American convention of month/day/year may be used.
		.Endc

LRDAT::
	mov	2(r5),r2	;Dateblock
	mov	4(r5),r1	;String
	mov	@10(r5),r0	;Flag
	call	rdat
	jmp	lr$adj
.end

LDTDIF.MAC
.Title	LDTDIF	- (Fortran) Calculate difference between dates
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	datdif,lretc
		.If eq 1
Called by
		I = LDTDIF (dateblock-1,dateblock-2,2.value)

Returns in 2.precis integer <2.value> the number of days between the date in
<dateblock-1> to the date in <dateblock-2>.

The value will be negative if the date in <dateblock-2> is earlier.

Should either of the dates be non-existent, or before 1600, this
function will return the value -1 (in I).  Normally it will return 0.
		.Endc


LDTDIF::
	mov	2(r5),r0	;First date
	mov	4(r5),r2	;Second date
	call	datdif
	mov	6(r5),r0	;Address for result
	mov	r2,(r0)+	;High order value in days.
	mov	r3,(r0)		;Low order.
	jmp	lretc		;Return -1 if CS, 0 if CC
.end

LDTCAL.MAC
.Title	LDTCAL - (Fortran) Calculate date from YEAR & DYEAR
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.SBTTL	V2	11-Jul-81

.globl	datcal,lretc
		.If eq 1
Called by
		INTEGER LDTCAL
		I = LDTCAL (dateblock)

Takes the information in the <dateblock> offsets YEAR and DYEAR (year and
day of year) and constructs a date from them, setting up the DAY, MONTH,
YEAR, and DYEAR offsets within the same <dateblock>.

Note that 1-Jan is counted as day 1.  Thus day 0 is 31-Dec of the previous
year, and -1 30-Dec et cetera.

The function returns 0 normally, and -1 should calculations take the date
back before the year 1600.
		.Endc

LDTCAL::
	mov	2(r5),r2	;Dateblock
	call	datcal
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

LAGE.MAC
.Title	LAGE - (Fortran) Age calculation
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	age,lretc
		.If eq 1
Called by
		INTEGER LAGE
		I = LAGE (dateblock-1,dateblock-2,iyears,months)

Takes date of birth from <dateblock-1> and the date on which the age is to
be calculated in <dateblock-2> and calculates age in years (returned in
<iyears>) and months (returned in <months>).

The value returned from this function (I) is 0 if all was well and -1 if
the date of birth is after the date for calculation (ie not born yet).
		.Endc


LAGE::
	mov	2(r5),r0	;Date of birth
	mov	4(r5),r2	;Date for calculation
	call	age
	mov	r0,@6(r5)	;Age in years
	mov	r2,@10(r5)	; and months.
	jmp	lretc		;Return -1 if CS, 0 if CC.
.end

LIDAY.MAC
.Title	LIDAY - (Fortran) Return day of week given date
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	iday
		.If eq 1
Called by
		INTEGER LIDAY
		I = LIDAY(dateblock)
returns -1 if the date were invalid, or 1-7 for Sunday through Saturday
respectively.
		.Endc

LIDAY::
	mov	2(r5),r2	;Dateblock
	jmp	iday
.end

LCRDW.MAC
.Title	LCRDW - (Fortran) Convert RT11 Date to Words
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	crdatw
		.If eq 1
Called by
		CALL LCRDW(dateblock)

Converts the RT11 format date (in the <dateblock> offset RTDAT) into
separate words of day, month, and year, storing these in the relevant
offsets in <dateblock>.

There is no error detection for illegal dates.
		.endc

LCRDW::
	mov	2(r5),r2	;Dateblock
	jmp	crdatw
.end

LCWDR.MAC
.Title	LCWDR - (Fortran) Convert date in integer words into RT11 format
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	cwdatr
		.If eq 1
Called by
		CALL LCWDR(dateblock)

Converts the values from the DAY, MONTH & YEAR offsets in <dateblock>
into the RT11 format for the date, storing this in the RTDAT offset.
{The Rt11 date format is (1b;5b<month>;5b<day>;5b<year-1972>).}
The year may be in full (eg 1981) or part (eg 81).  If before 1972
the year field will be left zero.

There is no error detection on illegal dates.
		.Endc

LCWDR::
	mov	2(r5),r2	;Dateblock
	jmp	cwdatr
.end

LWSTMT.MAC
.Title	LWSTMT - (Fortran) Write system time to the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wstimt

		.If eq 1
Called by
		CALL LWSTMT (timeblock,flag)

sends the system time to the terminal in the form "hh:mm".  The time
information is put into <timeblock>.

<flag> is used to determine whether to type just hh:mm or hh:mm:ss.
If the low-order byte be 0, just hh:mm will be sent; otherwise hh:mm:ss
will be provided. If the sign bit be clear, a leading space will be placed
before the hours digit if that be less than 10.  If the sign bit be set
there will be a leading space if hours < 10.
		.Endc

LWSTMT::
	mov	2(r5),r2	;Timeblock
	mov	@4(r5),r0	;Flag
	jmp	wstimt
.end

LWSTIM.MAC
.Title	LWSTIM - (Fortran) Write system time to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wstim

		.If eq 1
Called by
		CALL LWSTIM (timeblock,string,last,flag)

puts the system time into <string> in the form "hh:mm".
<last> is incremented by the number of bytes written.
The time information is put into <timeblock>.

<flag> is used to determine whether to type just hh:mm or hh:mm:ss.
If the low-order byte be 0, just hh:mm will be sent; otherwise hh:mm:ss
will be provided. If the sign bit be set, a leading space will be placed
before the hours digit if that be less than 10.  If the sign bit be clear
there will be no leading space.
		.Endc

LWSTIM::
	mov	2(r5),r2	;Timeblock
	mov	4(r5),r1	;String address
	mov	@10(r5),r0	;Flag
	call	lw$adj		;Calls WSTIM after setting up R1, and
	.word	wstim		; sets up <last>
.end

LWTIMT.MAC
.Title	LWTIMT - (Fortran) Write time to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	wtimt

		.If eq 1
Called by
		CALL LWTIMT(timeblock,flag)

writes the time from the <timeblock> to the terminal.

<flag> is used to determine how much time to type.  If its low-order byte
contain zero, the time is typed as HH:MM, and if non-zero, HH:MM:SS.
The sign bit is used to determine whether a leading space should precede the
hours digits if HOURS be less than 10.  If the sign bit be set, this leading
space will be included.
		.Endc

LWTIMT::
	mov	2(r5),r2	;Timeblock
	mov	@4(r5),r0	;Flag
	jmp	wtimt
.end

LWTIM.MAC
.Title	LWTIM - (Fortran) Write time to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	wtim,lw$adj

		.If eq 1
Called by
		CALL LWTIM(timeblock,string,last,flag)

writes the time from the <timeblock> to the string.
<last> is increased by the number of bytes written.

<flag> is used to determine how much time to type.  If its low-order byte
contain zero, the time is typed as HH:MM, and if non-zero, HH:MM:SS.
The sign bit is used as a flag to determine whether to include a leading
space should the HOURS value be less than 10.  If the sign bit be set,
the leading space will be included.
		.Endc

LWTIM::
	mov	2(r5),r2	;Timeblock
	mov	@10(r5),r0	;Flag
	call	lw$adj
	.word	wtim
.end

LRSTIM.MAC
.Title	LRSTIM - (Fortran) Read system time into <timeblock> offsets
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rstim

		.If eq 1
Called by
		CALL	LRSTIM(timeblock)

Reads the system time into the offsets RTIM1 & RTIM2 in <timeblock>.
Also sets the TCLOCK offset to either 50 or 60 depending upon the setting of
B.CLK in CONFIG(SYSPTR).  Performs a conversion of the system time
into the relevant HOURS, MINS, SECS and TICKS values in <timeblock>.
		.Endc

LRSTIM::
	mov	2(r5),r2	;Timeblock
	jmp	rstim
.end

LRTIMT.MAC
.Title	LRTIMT - (Fortran) Read time from the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rtimt,lretc

		.If eq 1
Called by
		INTEGER LRTIMT
		I = LRTIMT(timeblock,char)

Reads the time in hours, mins, secs, and ticks from the terminal into
the <timeblock>.  The value returned is zero if all went well, and -1
if an error was found in the specification.

<char> receives the delimiting character.

Note - the TCLOCK offset in <timeblock> contains the number of ticks/second.
Should the user type a value greater than this an error will be reported.

For further details (including interpretation of AM and PM) see RTIM.MAC
		.Endc

LRTIMT::
	mov	2(r5),r2	;Timeblock
	call	rtimt
	movb	(r1),@4(r5)
	jmp	lretc		;Return 0 if CC, -1 if CS
.end

LRTIM.MAC
.Title	LRTIM - (Fortran) Read time from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	rtim,lr$adj,lretc

		.If eq 1
Called by
		INTEGER LRTIM
		I = LRTIM(timeblock,string,last)

Reads the time in hours, mins, secs, and ticks from the string into
<timeblock>.  The value returned is 0 if all went well, and -1 if an
error was found in the specification.

<last> is increased by the number of characters read from <string>.

Note - the TCLOCK offset contains the number of ticks/second.  Should
the user type a value out of range an error will be reported.

For further details (including interpretation of AM and PM) see RTIM.MAC
		.Endc

LRTIM::
	mov	2(r5),r2	;Timeblock
	mov	4(r5),r1	;String
	call	rtim
	call	lretc		;Set up 0 if CC, -1 if CS
	jmp	lr$adj		;Go and tidy up <last>
.end

LCRTW.MAC
.Title	LCRTW - (Fortran) Convert RT11 time to words
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	crtimw

		.if eq 1
Called by
		CALL LCRTW(timeblock)

Converts the two-word RT11 time stored in <timeblock> offsets RTIM1 (hi-ord)
and RTIM2 (lo-ord), using the ticks-per-second supplied in the TCLOCK offset,
into ticks, seconds, minutes, and hours, storing these back in <timeblock>.
		.endc

LCRTW::
	mov	2(r5),r2	;Timeblock
	jmp	crtimw
.end

LCWTR.MAC
.Title	LCWTR - (Fortran) Convert time in integers to RT11 format
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	cwtimr

		.if eq 1
Called by
		CALL LCWTR(timeblock)

Converts the integers in the <timeblock> offsets HOURS, MINS, SECS & TICKS
into the two-word integer time format of ticks after midnight of RT11.
The contents of the offset TCLOCK is used for ticks per second, and the
result is stored in offsets RTIM1 (hi-ord) and RTIM2 (lo-ord).
		.endc

LCWTR::
	mov	2(r5),r2	;Timeblock
	jmp	cwtimr
.end

LWFT.MAC
.Title	LWFT - (Fortran) Write a filename to the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	wft

		.If eq 1
Called by
		CALL LWFT(block,flags)

writes a filename to the user's terminal from the array <block>, in the form:

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<flags> is used to determine whether or not to print the size, and whether
or not to suppress trailing blanks in the various subfields.

Low order byte =  0 - No size printed
	       <> 0 - size printed
Sign bit clear -  no spaces in subfields
	 set   -  spaces in subfields
		.Endc

LWFT::
	mov	2(r5),r2	;Address of <block>
	mov	@4(r5),r0	;Value of <flags>
	jmp	wft
.end

LWF.MAC
.Title	LWF - (Fortran) Write a filename to a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wf

		.If eq 1
Called by
		CALL LWF(block,string,last,flags)

writes a filename in ascii to the array <string> from the array <block>,
which has the form:

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<flags> is used to determine whether or not to print the size, and whether
or not to suppress trailing blanks in the various subfields.

Low order byte =  0 - No size printed
	       <> 0 - size printed
Sign bit clear -  no spaces in subfields
	 set   -  spaces in subfields

<last> is increased by the number of bytes written to <string>.
		.Endc

LWF::
	mov	2(r5),r2	;Address of <block>
	mov	@10(r5),r0	;Value of <flags>
	call	lw$adj		;Call WF and set up <last>
	.word	wf
.end

LRFDT.MAC
.Title	LRFDT - (Fortran) Read a filename from the terminal, with defaults
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rfdt,lretc

		.If eq 1
Called by
		INTEGER LRFDT
		I=LRFT(block,character)

reads a filename from the user's terminal, returning -1 if there was an error
in the filename specified, and 0 if all was well.  The filename is read
into the array <block> such that

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<character> receives the character which delimited the filename.

If the device or extension fields are not specified, their contents will
not be altered on return from LRFT.  Thus these fields may have default
values specified.
		.Endc

LRFDT::
	mov	2(r5),r2	;<block> address
	call	rfdt
	movb	(r1),@4(r5)	;Terminating character
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

LRFD.MAC
.Title	LRFD - (Fortran) Read a filename from a string, with defaults
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$adj,rfd,lretc

		.If eq 1
Called by
		INTEGER LRFD
		I=LRFD(block,string,last)

reads a filename from the array <string>, returning -1 if there was an error
in the filename specified, and 0 if all was well.  The filename is read
into the array <block> such that

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<last> is incremented by the number of bytes read from <string>, up to but
not including that which delimited the filename.

The device and extension words will remain unchanged if the corresponding
field in the filename be unspecified.  This provides a mechanism for
allowing default values.
		.Endc

LRFD::
	mov	2(r5),r2	;<block> address
	mov	4(r5),r1	;<string> address
	call	rfd
	call	lretc		;Return R0/-1 if CS, 0 if CC
	jmp	lr$adj		;Trot off and fix up <last>
.end

LRFT.MAC
.Title	LRFT - (Fortran) Read a filename from the terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rft,lretc

		.If eq 1
Called by
		INTEGER LRFT
		I=LRFT(block,character)

reads a filename from the user's terminal, returning -1 if there was an error
in the filename specified, and 0 if all was well.  The filename is read
into the array <block> such that

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<character> receives the character which delimited the filename.

No defaults are allowed.  Unspecified fields will be returned null.
		.Endc

LRFT::
	mov	2(r5),r2	;<block> address
	call	rft
	movb	(r1),@4(r5)	;Terminating character
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

LRF.MAC
.Title	LRF (Fortran) - Read a filename from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$adj,rf,lretc

		.If eq 1
Called by
		INTEGER LRF
		I=LRF(block,string,last)

reads a filename from the array <string>, returning -1 if there was an error
in the filename specified, and 0 if all was well.  The filename is read
into the array <block> such that

BLOCK(1)	.rad50 /device/
BLOCK(2,3)	.rad50 /filename/
BLOCK(4)	.rad50 /extension/
BLOCK(5)	.word filesize

<last> is increased by the number of bytes read from <string>, up to but
not including that which delimited the filename.

No defaults are allowed.  Unspecified fields will be returned null.
		.Endc

LRF::
	mov	2(r5),r2	;<block> address
	mov	4(r5),r1	;<string> address
	call	rf
	call	lretc		;Return R0/-1 if CS, 0 if CC
	jmp	lr$adj		;Trot off and fix up <last>
.end

LW50FT.MAC
.Title	LW50FT - (Fortran) Write Radix50 (filename set) value to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	9-Jan-82	CVLLIB Routine

.globl	w50ft

		.If eq 1
Called by
		CALL	LW50FT(value)

types 3 radix50 characters from <value> to the terminal, using the filename
convention of "." becoming "%".
		.Endc

LW50FT::
	mov	@2(r5),r0
	jmp	w50ft
.end

LW50F.MAC
.Title	LW50F - (Fortran) Write Radix50 (filename set) value to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	9-Jan-82	CVLLIB Routine

.globl	w50f
		.If eq 1
Called by
		CALL LW50F(value,string)

Writes 3 radix50 characters from <value> into <string>, using the filename
convention of "." becoming "%".
		.Endc

LW50F::
	mov	@2(r5),r0	;Value
	mov	4(r5),r1	;Address of <string>
	jmp	w50f
.end

LW50T.MAC
.Title	LW50T - (Fortran) Write Radix50 value to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2A	9-Jan-82	CVLLIB Routine

.globl	w50t

		.If eq 1
Called by
		CALL	LW50T(value)

types 3 radix50 characters from <value> to the terminal.
		.Endc

LW50T::
	mov	@2(r5),r0
	jmp	w50t
.end

LW50.MAC
.Title	LW50 - (Fortran) Write Radix50 value to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	w50
		.If eq 1
Called by
		CALL LW50(value,string)

Writes 3 radix50 characters from <value> into <string>.
		.Endc

LW50::
	mov	@2(r5),r0	;Value
	mov	4(r5),r1	;Address of <string>
	jmp	w50
.end

LR50ST.MAC
.Title	LR50ST - (Fortran) Read rad50 value from terminal (symbol set)
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	r50st,r50s
		.If eq 1
Called by
		CALL LR50ST(value,character)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

The symbol radix50 character set, excluding <space>, is allowed.
The unassigned rad50 value, 35, is used for the "*" character.
		.Endc

LR50ST::
	mov	2(r5),r2	;Address of <value>
	call	r50st		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50s		;Continue with same string, another 3
	mov	r0,(r2)
	movb	(r1),@4(r5)
	return
.end

LR50S.MAC
.Title	LR50S - (Fortran) Read rad50 value from string, symbol set
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lr$adj,r50s
		.If eq 1
Called by
		INTEGER LR50S
		I=LR50S(value,string,last)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

Returns -1 if the character following (or the delimiter) is not a valid
radix50 character.  Otherwise returns zero.

The symbol radix50 character set, excluding <space>, is allowed.
The unassigned rad50 value, 35, is used for the "*" character.

<last> is increased by the number of characters read from <string>.
		.Endc

LR50S::
	mov	4(r5),r1	;Address of <string>
	mov	2(r5),r2	;Address of <value>
	call	r50s		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50s		;Continue with same string, another 3
	mov	r0,(r2)
	mov	#0,r0		;Clear, for error return, but keep Carry ISQ.
	bcc	10$
	dec	r0		;-1 return if next char is not valid rad50
10$:	jmp	lr$adj		;Scram and set up <last>
.end

LR50FT.MAC
.Title	LR50FT - (Fortran) Read rad50 value from terminal (filename set)
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	r50ft,r50f
		.If eq 1
Called by
		CALL LR50FT(value,character)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

The filename radix50 character set, excluding <space> and ".", is allowed.
The unassigned rad50 value, 35, is used for the "*" character.
		.Endc

LR50FT::
	mov	2(r5),r2	;Address of <value>
	call	r50ft		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50f		;Continue with same string, another 3
	mov	r0,(r2)
	movb	(r1),@4(r5)
	return
.end

LR50F.MAC
.Title	LR50F - (Fortran) Read rad50 value from string, filename set
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lr$adj,r50f
		.If eq 1
Called by
		INTEGER LR50F
		I=LR50F(value,string,last)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

Returns -1 if the character following (or the delimiter) is not a valid
radix50 character.  Otherwise returns zero.

The filename radix50 character set, excluding <space> and ".", is allowed.
The unassigned rad50 value, 35, is used for the "*" character.

<last> is increased by the number of bytes read from <string>.
		.Endc

LR50F::
	mov	4(r5),r1	;Address of <string>
	mov	2(r5),r2	;Address of <value>
	call	r50f		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50f		;Continue with same string, another 3
	mov	r0,(r2)
	mov	#0,r0		;Clear, for error return, but keep Carry ISQ.
	bcc	10$
	dec	r0		;-1 return if next char is not valid rad50
10$:	jmp	lr$adj		;Scram and set up <last>
.end

LR50T.MAC
.Title	LR50T - (Fortran) Read rad50 value from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	r50t,r50
		.If eq 1
Called by
		CALL LR50T(value,character)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

The full radix50 character set, including <space> and ".", is allowed.
The unassigned rad50 value, 35, is used for the "*" character.
		.Endc

LR50T::
	mov	2(r5),r2	;Address of <value>
	call	r50t		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50		;Continue with same string, another 3
	mov	r0,(r2)
	movb	(r1),@4(r5)
	return
.end

LR50.MAC
.Title	LR50 - (Fortran) Read rad50 value from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lr$adj,r50
		.If eq 1
Called by
		INTEGER LR50
		I=LR50(value,string,last)

returns up to 6 radix50 characters in the two words starting at <value>,
and the delimiting character in <character>.

Returns -1 if the character following (or the delimiter) is not a valid
radix50 character.  Otherwise returns zero.

The full radix50 character set, including <space> and ".", is allowed.
The unassigned rad50 value, 35, is used for the "*" character.

<last> is increased by the number of characters read from <string>.
		.Endc

LR50::
	mov	4(r5),r1	;Address of <string>
	mov	2(r5),r2	;Address of <value>
	call	r50		;Read up to 3 rad50 characters from terminal
	mov	r0,(r2)+
	call	r50		;Continue with same string, another 3
	mov	r0,(r2)
	mov	#0,r0		;Clear, for error return, but keep Carry ISQ.
	bcc	10$
	dec	r0		;-1 return if next char is not valid rad50
10$:	jmp	lr$adj		;Scram and set up <last>
.end

LCA50.MAC
.Title	LCA50 - (Fortran) Convert ascii to radix50
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	ca50

		.If eq 1
Called by	INTEGER LCA50
		I=LCA50(CHAR)

Returns the radix50 value of the character in CHAR, or -1 if the character
was illegal in radix50.  The unused radix50 character (value 35) is returned
for the character "*".
		.Endc

LCA50::
	movb	@2(r5),r0
	bic	#^c177,r0
	call	ca50
	bcc	10$
	mov	#-1,r0
10$:	return
.end

LC50A.MAC
.Title	LC50A - (Fortran) Convert radix50 to ascii
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c50a

		.If eq 1
Called by	INTEGER LC50A
		I=LC50A(CHAR)

Returns the ascii value of radix50 value in CHAR, or -1 if the character
was illegal in radix50.  The unused radix50 character (value 35) returns
the character "*".
		.Endc

LC50A::
	movb	@2(r5),r0
	call	c50a
	bcc	10$
	mov	#-1,r0
10$:	return
.end

LWM3PT.MAC
.Title	LWM3PT - (Fortran) Write triple-precision money to terminal, spec pos
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wm3pt,wm3dpt

		.If eq 1
Called by
		CALL LWM3PT(value,nplaces)
	or	CALL LWM3DX(value,nplaces)

prints the value of the triple-precision integer in <value> (3 words) to
the terminal in money format as though the value were cents.
EG 1234567890 becomes $12345678.90

<nplaces> provides the minimum size of the field to be occupied by the
result, right-justified within that field, space filled.

LWM3DX - Provides a leading dollar sign (would have been LWM3DPT but only
		6 characters available!)
LWM3PT - No leading dollar.
		.Endc

LWM3DX::
	mov	2(r5),r0	;Address of <value>
	mov	@4(r5),r2	;Number of places
	jmp	wm3dpt
LWM3PT::
	mov	2(r5),r0
	mov	@4(r5),r2
	jmp	wm3pt
.end

LWM3T.MAC
.Title	LWM3T - (Fortran) Write triple-precision money to terminal.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wm3t,wm3dt

		.If eq 1
Called by
		CALL LWM3T(value)
	or	CALL LWM3DT(value)

prints the value of the triple-precision integer in <value> (3 words) to
the terminal in money format as though the value were cents.
EG 1234567890 becomes $12345678.90

LWM3DT - Provides a leading dollar sign
LWM3T - No leading dollar.
		.Endc

LWM3DT::
	mov	2(r5),r0	;Address of <value>
	jmp	wm3dt
LWM3T::
	mov	2(r5),r0
	jmp	wm3t
.end

LWM3P.MAC
.Title	LWM3P - (Fortran) Write triple-precision money to string, spec pos
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$adj,wm3p,wm3dp

		.If eq 1
Called by
		CALL LWM3P(value,string,last,nplaces)
	or	CALL LWM3DP(value,string,last,nplaces)

prints the value of the triple-precision integer in <value> (3 words) to the
string pointed to in R1 in money format as though the value were cents.
EG 1234567890 becomes $12345678.90

<nplaces> provides the minimum size of the field to be occupied by the
result, right-justified within that field, space filled.

LWM3DP - Provides a leading dollar sign
LWM3P - No leading dollar.
		.Endc

LWM3DP::
	mov	2(r5),r0	;Address of <value>
	mov	@10(r5),r2	;Number of places
	call	lw$adj
	.word	wm3dp
LWM3P::
	mov	2(r5),r0
	mov	@10(r5),r2
	call	lw$adj
	.word	wm3p
.end

LWM3.MAC
.Title	LWM3 - (Fortran) Write triple-precision money to string.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$adj,wm3,wm3d

		.If eq 1
Called by
		CALL LWM3(value,string,last)
	or	CALL LWM3D(value,string,last)

prints the value of the triple-precision integer in <value> (3 words) to the
string pointed to in R1 in money format as though the value were cents.
EG 1234567890 becomes $12345678.90

LWM3D - Provides a leading dollar sign
LWM3 - No leading dollar.
		.Endc

LWM3D::
	mov	2(r5),r0	;Address of <value>
	call	lw$adj
	.word	wm3d
LWM3::
	mov	2(r5),r0
	call	lw$adj
	.word	wm3
.end

LRM3T.MAC
.Title	LRM3T - (Fortran) Read triple-precis money from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rm3t,lretc

		.If eq 1
Called by
		INTEGER LRM3T
		I = LRM3T(value,char)

reads a value in dollars & cents (eg $123.45) from the terminal, returning
a triple-precision integer value in cents in <value>, and the terminating
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
may have terminated before all the digits were read.
		.Endc

LRM3T::
	mov	2(r5),r0	;Address of <value>
	call	rm3t
	movb	(r1),@4(r5)
	jmp	lretc		;Return value according to carry setting
.end

LRM3.MAC
.Title	LRM3 - (Fortran) Read triple-precis money from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	rm3,lr$adj,lretc

		.If eq 1
Called by
		INTEGER LRM3
		I = LRM3(value,string,last)

reads a value in dollars & cents (eg $123.45) from <string>, returning
a triple-precision integer value in cents in <value>.
<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
may have terminated before all the digits were read.
		.Endc

LRM3::
	mov	2(r5),r0	;Address of <value>
	call	rm3
	call	lretc		;Set R0 according to carry
	jmp	lr$adj
.end

LWD3PT.MAC
.Title	LWD3PT - (Fortran) Write triple-precis # to terminal, specify # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wd3pt

		.If eq 1
Called by
		CALL LWD3PT(value,nplaces)

writes 3 words from <value> as a triple-precision signed integer to the
user's terminal.

<nplaces> specifies the minimum size of the field for the result to occupy,
right-justified within that field, filled to the left with spaces.
		.Endc

LWD3PT::
	mov	2(r5),r0	;Address of <value>
	mov	@4(r5),r2	;Number of places to occupy
	jmp	wd3pt
.end

LWD3T.MAC
.Title	LWD3T - (Fortran) Write triple-precis # to terminal.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	wd3t

		.If eq 1
Called by
		CALL LWD3T(value)

writes 3 words from <value> as a triple-precision signed integer to the
user's terminal.
		.Endc

LWD3T::
	mov	2(r5),r0	;Address of <value>
	jmp	wd3t
.end

LWD3P.MAC
.Title	LWD3P - (Fortran) Write triple-precis # to string, specify # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wd3p

		.If eq 1
Called by
		CALL LWD3P(value,string,last,nplaces)

writes 3 words from <value> as a triple-precision signed integer to <string>.
<last> is increased by the number of characters written to <string>.

<nplaces> specifies the minimum size of the field for the result to occupy,
right-justified within that field, filled to the left with spaces.
		.Endc

LWD3P::
	mov	2(r5),r0	;Address of <value>
	mov	@4(r5),r2	;Number of places to occupy
	call	lw$adj
	.word	wd3p
.end

LWD3.MAC
.Title	LWD3 - (Fortran) Write triple-precis # to string.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wd3

		.If eq 1
Called by
		CALL LWD3(value,string,last)

writes 3 words from <value> as a triple-precision signed integer to <string>.
<last> is increased by the number of characters written to <string>.
		.Endc

LWD3::
	mov	2(r5),r0	;Address of <value>
	call	lw$adj
	.word	wd3
.end

LRD3T.MAC
.Title	LRD3T - (Fortran) Read triple-precision integer from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rd3t,lretc

		.If eq 1
Called by
		INTEGER LRD3T
		I = LRD3T(value,char)

reads a triple-precision signed integer from the user's terminal into the
three locations starting at <value>.  <char> receives the delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD3T::
	mov	2(r5),r0
	call	rd3t
	movb	(r1),@4(r5)
	jmp	lretc
.end

LRD3.MAC
.Title	LRD3 - (Fortran) Read triple-precision integer from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	rd3,lr$adj,lretc

		.If eq 1
Called by
		INTEGER LRD3
		I = LRD3(value,string,last)

reads a triple-precision signed integer from <string> into the
three locations starting at <value>.
<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD3::
	mov	2(r5),r0	;Address of number to be read
	mov	4(r5),r1	;String
	call	rd3
	call	lretc		;Set R0 according to carry
	jmp	lr$adj
.end

LMUL31.MAC
.Title	LMUL31 - (Fortran) <triple-precision> * <single-precision> multiply
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	 3-Apr-83	CVLLIB Routine
;Bug fix
.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	mul31,lretc

		.If eq 1
Called by
		INTEGER LMUL31
		I = LMUL31(triplemultiplicand,singlemultiplier,tripleresult)

multiplies <triplemultiplicand> by <singlemultiplier> storing the result in
<tripleresult>.

The value returned is 0 if there were no overflow, -1 if overflow occurred.
		.Endc

LMUL31::
	mov	2(r5),r0	;Multiplicand - move to result locs
	mov	6(r5),r2
	mov	(r0)+,(r2)+	;MUL31 puts result where multiplicand was
	mov	(r0)+,(r2)+
	mov	(r0),(r2)
	cmp	-(r2),-(r2)
	mov	@4(r5),r0	;Multiplier
	call	mul31
	jmp	lretc		;Set R0 according to carry
.end

LMUL33.MAC
.Title	LMUL33 - (Fortran) <triple-precision> * <triple-precision> multiply
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	mul33,lretc

		.If eq 1
Called by
	   INTEGER LMUL33
	   I = LMUL33(triplemultiplicand,triplemultiplier,sextupleresult)

multiplies the two triple-precision signed integers to produce a 6-word long
result.

A value of 0 is returned if the result could have fitted into a triple
precision word.  Should more then 48 bits be required to express the result,
-1 is returned.
		.Endc

LMUL33::
	mov	2(r5),r0
	mov	4(r5),r2
	mov	6(r5),r3
	call	mul33
	jmp	lretc
.end

LDIV31.MAC
.Title	LDIV31 - (Fortran) <triple-precision> / <single-precision> divide
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	div31,lretc

		.If eq 1
Called by

   INTEGER LDIV31
   I = LDIV31(tripledividend,singledivisor,triplequotient,singleremainder)

divides the <tripledividend> by the <singledivisor>, storing the quotient
in <triplequotient> and the remainder in <singleremainder>.

Divide-by-zero is indicated by a -1 value returned.  Otherwise 0 is returned.
		.Endc

LDIV31::
	mov	2(r5),r0	;Transfer dividend to quotient locs
	mov	6(r5),r2
	mov	(r0)+,(r2)+	; as DIV31 stores in its dividend locs
	mov	(r0)+,(r2)+
	mov	(r0),(r2)
	cmp	-(r2),-(r2)
	mov	@4(r5),r0
	call	div31
	mov	r0,@10(r5)
	jmp	lretc
.end

LDIV33.MAC
.Title	LDIV33 - (Fortran) <triple-precision> / <triple-precision> divide
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	div33,lretc

		.If eq 1
Called by

   INTEGER LDIV33
   I = LDIV33(tripledividend,tripledivisor,triplequotient,tripleremainder)

divides the <tripledividend> by the <tripledivisor>, storing the quotient
in <triplequotient> and the remainder in <tripleremainder>.

Divide-by-zero is shown by a value of -1 returned.  Otherwise 0 is returned.
		.Endc

LDIV33::
	mov	2(r5),r0	;Transfer dividend to quotient locs
	mov	6(r5),r2
	mov	(r0)+,(r2)+	; as DIV33 stores in its dividend locs
	mov	(r0)+,(r2)+
	mov	(r0),(r2)
	cmp	-(r2),-(r2)

	mov	4(r5),r1
	mov	10(r5),r0	;Similarly divisor & remainder
	mov	(r1)+,(r0)+
	mov	(r1)+,(r0)+
	mov	(r1),(r0)
	cmp	-(r0),-(r0)

	call	div33
	jmp	lretc
.end

LCMP3.MAC
.Title	LCMP3 - (Fortran) Compare two triple-precision numbers
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	cmp3

		.If eq 1
Called by
		INTEGER LCMP3
		I = LCMP3(triple1,triple2)

provides a means of signed comparison between two triple precision values.
The value returned is 0 if <triple1><EQ><triple2>, 1 if <GT> and -1 if <LT>.
		.Endc

LCMP3::
	mov	#-1,r1
	mov	2(r5),r0
	mov	4(r5),r2
	call	cmp3
	blt	20$
	beq	10$
	inc	r1
10$:	inc	r1
20$:	mov	r1,r0
	return
.end

LADD3.MAC
.Title	LADD3 - (Fortran) Triple-precision addition
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	17-Feb-82	CVLLIB Routine

		.If eq 1
Called by
		INTEGER LADD3
		I = LADD3(triple,triple,tripleresult)

adds the two triple-precision values, storing the result in <tripleresult>.

A value of 0 is returned unless overflow occurs, in which case a negative
value is returned.
		.Endc

LADD3::
	clr	r0		;For returning overflow
	mov	2(r5),r1	;First Argument
	mov	(r1)+,r2	;Highest order word
	mov	(r1)+,r3
	mov	(r1),r4
	mov	4(r5),r1	;Second argument

	add	4(r1),r4
	adc	r3
	adc	r2
	bvc	10$
	dec	r0
10$:
	add	2(r1),r3
	adc	r2
	bvc	20$
	dec	r0
20$:
	add	(r1),r2
	bvc	30$
	dec	r0
30$:
	mov	6(r5),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)+
	mov	r4,(r1)

	return	
.END

LSUB3.MAC
.Title	LSUB3 - (Fortran) Triple-precision subtraction
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	17-Feb-82	CVLLIB Routine

		.If eq 1
Called by
		INTEGER LSUB3
		I = LSUB3(triple,triple,tripleresult)

subtracts the first from the second triple-precision value, storing the result
in <tripleresult>.

A value of 0 is returned unless overflow occurs, in which case a negative
value is returned.
		.Endc

LSUB3::
	clr	r0		;For returning overflow
	mov	4(r5),r1	;Second Argument - Subtrahend
	mov	(r1)+,r2	;Highest order word
	mov	(r1)+,r3
	mov	(r1),r4
	mov	2(r5),r1	;First argument - Subtractor

	sub	4(r1),r4
	sbc	r3
	sbc	r2
	bvc	10$
	dec	r0
10$:
	sub	2(r1),r3
	sbc	r2
	bvc	20$
	dec	r0
20$:
	sub	(r1),r2
	bvc	30$
	dec	r0
30$:
	mov	6(r5),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)+
	mov	r4,(r1)

	return	
.END

LNEG3.MAC
.Title	LNEG3 - (Fortran) Negate a triple-precision integer
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	neg3

		.If eq 1
Called by
		CALL LNEG3(triplevalue)

negates the value contained in the 3 words of <triplevalue>.
		.Endc

LNEG3::
	mov	2(r5),r0
	jmp	neg3
.end

LMOV3.MAC
.Title	LMOV3 - (Fortran) Move a triple-precision integer
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

		.If eq 1
Called by
		CALL LMOV3(3value-1,3value-2)

Moves the three words comprising <3value-1> into the three words starting
at <3value-2>.
		.Endc

LMOV3::
	mov	2(r5),r0	;Start of first triple-precision integer
	mov	4(r5),r1	;ibid, second
	mov	(r0)+,(r1)+
	mov	(r0)+,(r1)+	;Transfer 3 words
	mov	(r0),(r1)
	return
.end

LWMPT.MAC
.Title	LWMPT - (Fortran) Write d/precis money to terminal, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lw$2pt,wmpt,wmdpt

		.If eq 1
Called by
		CALL LWMPT(value,nplaces)
	or	CALL LWMDPT(value,nplaces)

writes <value> to the terminal as a money value in cents,
eg 4502 becomes "$45.02", to a minimum of <nplaces> characters,
right-justified, filled with spaces.

LWMDPT - Provides a leading dollar sign
LWMPT  - No leading dollar
		.Endc

LWMDPT::
	call	lw$2pt
	.word	wmdpt
LWMPT::
	call	lw$2pt
	.word	wmpt
.end

LWMT.MAC
.Title	LWMT - (Fortran) Write d/precis money to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lw$2t,wmt,wmdt

		.If eq 1
Called by
		CALL LWMT(value)
	or	CALL LWMDT(value)

writes <value> to the terminal as a money value in cents.

LWMDT - Provides a leading dollar sign
LWMT  - No leading dollar
		.Endc

LWMDT::
	call	lw$2t
	.word	wmdt
LWMT::
	call	lw$2t
	.word	wmt
.end

LWMP.MAC
.Title	LWMP - (Fortran) Write d/precis money to string, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$2p,wmp,wmdp

		.If eq 1
Called by
		CALL LWMP(value,string,last,nplaces)
	or	CALL LWMDP(value,string,last,nplaces)
where <value> is to be written to the <string> as a signed money value
in cents, eg 12345 becomes $123.45, to a minimum of <nplaces> characters,
right-justified, filled with spaces.

<last> is increased by the number of characters written to <string>.

LWMDP - Provides a leading dollar sign
LWMP  - No leading dollar
		.Endc

LWMDP::
	call	lw$2p
	.word	wmdp
LWMP::
	call	lw$2p
	.word	wmp
.end

LWM.MAC
.Title	LWM - (Fortran) Write d/precis money to string.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$2,wm,wmd

		.If eq 1
Called by
		CALL LWM(value,string,last)
	or	CALL LWMD(value,string,last)

where <value> is to be written to the <string> as a monetary value
in cents, eg 13579 becomes $135.79.

<last> is increased by the number of characters written to <string>.

LWMD - Provides a leading dollar sign
LWM  - No leading dollar
		.Endc

LWMD::
	call	lw$2
	.word	wmd
LWM::
	call	lw$2
	.word	wm
.end

LRMT.MAC
.Title	LRMT - (Fortran) Read d/precis money value from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$2t,rmt

		.If eq 1
Called by
		INTEGER LRMT
		I = LRMT(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.  A leading dollar sign is permitted, and a sign
may precede or follow such a dollar.  The value returned is in cents.
(Note: $3.5 will return 350).

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
may have terminated before all the digits were read.
		.Endc

LRMT::
	call	rmt
	jmp	lr$2t
.end

LRM.MAC
.Title	LRM - (Fortran) Read d/precis money value from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$2,rm

		.If eq 1
Called by
		INTEGER LRM
		I = LRM(value,string,last)

returns a double-length integer value in <value>.

<last> is increased by the number of characters read from <string>.

A leading dollar sign is permitted, and a sign may precede or follow
such a dollar.  The value returned is in cents.
(Note: $3.5 will return 350).

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
may have terminated before all the digits were read.
		.Endc

LRM::
	call	lr$2
	.word	rm
.end

LWD2PT.MAC
.Title	LWD2PT - (Fortran) Write d/precis decimal # to terminal, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2pt,wd2pt

		.If eq 1
Called by
		CALL LWD2PT(value,nplaces)

writes <value> to the terminal as a signed decimal number, to a minimum
of <nplaces> characters, right-justified, filled with spaces.
		.Endc

LWD2PT::
	call	lw$2pt
	.word	wd2pt
.end

LWD2T.MAC
.Title	LWD2T - (Fortran) Write d/precis decimal # to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2t,wd2t

		.If eq 1
Called by
		CALL LWD2T(value)

writes <value> to the terminal as a signed decimal number.
		.Endc

LWD2T::
	call	lw$2t
	.word	wd2t
.end

LWD2P.MAC
.Title	LWD2P - (Fortran) Write d/precis decimal # to string, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2p,wd2p

		.If eq 1
Called by
		CALL LWD2P(value,string,last,nplaces)

where <value> is to be written to the <string> as a signed decimal number,
to a minimum of <nplaces> characters, right-justified, filled with spaces.

<last> is increased by the number of characters written to <string>.
		.Endc

LWD2P::
	call	lw$2p
	.word	wd2p
.end

LWD2.MAC
.Title	LWD2 - (Fortran) Write d/precis decimal # to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2,wd2

		.If eq 1
Called by
		CALL LWD2(value,string,last)

where <value> is to be written to the <string> as a signed decimal number.

<last> is increased by the number of characters written to <string>.
		.Endc

LWD2::
	call	lw$2
	.word	wd2
.end

LW82SX.MAC
.Title	LW82SX - (Fortran) Write d/precis octal # to terminal, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2pt,w82spt

		.If eq 1
Called by
		CALL LW82SX(value,nplaces)

writes <value> to the terminal as a signed octal number, to a minimum
of <nplaces> characters, right-justified, filled with spaces.
		.Endc

LW82SX::
	call	lw$2pt
	.word	w82spt
.end

LW82PT.MAC
.Title	LW82PT - (Fortran) Write d/precis octal # to terminal, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2pt,w82pt

		.If eq 1
Called by
		CALL LW82PT(value,nplaces)

writes <value> to the terminal as an unsigned octal number, to a minimum
of <nplaces> characters, right-justified, filled with spaces.
		.Endc

LW82PT::
	call	lw$2pt
	.word	w82pt
.end

LW82ST.MAC
.Title	LW82ST - (Fortran) Write d/precis octal # to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2t,w82st

		.If eq 1
Called by
		CALL LW82ST(value)

writes <value> to the terminal as a signed octal number.
		.Endc

LW82ST::
	call	lw$2t
	.word	w82st
.end

LW82T.MAC
.Title	LW82T - (Fortran) Write d/precis octal # to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$2t,w82t

		.If eq 1
Called by
		CALL LW82T(value)

writes <value> to the terminal as an unsigned octal number.
		.Endc

LW82T::
	call	lw$2t
	.word	w82t
.end

LW82SP.MAC
.Title	LW82SP - (Fortran) Write d/precis octal # to string, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2p,w82sp

		.If eq 1
Called by
		CALL LW82SP(value,string,last,nplaces)

where <value> is to be written to the <string> as a signed octal number,
to a minimum of <nplaces> characters, right-justified, filled with spaces.

<last> is increased by the number of characters written to <string>.
		.Endc

LW82SP::
	call	lw$2p
	.word	w82sp
.end

LW82P.MAC
.Title	LW82P - (Fortran) Write d/precis octal # to string, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2p,w82p

		.If eq 1
Called by
		CALL LW82P(value,string,last,nplaces)

where <value> is to be written to the <string> as an unsigned octal number,
to a minimum of <nplaces> characters, right-justified, filled with spaces.

<last> is increased by the number of characters written to <string>.
		.Endc

LW82P::
	call	lw$2p
	.word	w82p
.end

LW82S.MAC
.Title	LW82S - (Fortran) Write d/precis octal # to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2,w82s

		.If eq 1
Called by
		CALL LW82S(value,string,last)

where <value> is to be written to the <string> as a signed octal number.

<last> is increased by the number of characters written to <string>.
		.Endc

LW82S::
	call	lw$2
	.word	w82s
.end

LW82.MAC
.Title	LW82 - (Fortran) Write d/precis octal # to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lw$2,w82

		.If eq 1
Called by
		CALL LW82(value,string,last)

where <value> is to be written to the <string> as an unsigned octal number.

<last> is increased by the number of characters written to <string>.
		.Endc

LW82::
	call	lw$2
	.word	w82
.end

LWH2PT.MAC
.Title	LWH2PT - (Fortran) Write d/precis hex # to terminal, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$2pt,wh2pt,whl2pt

		.If eq 1
Called by
		CALL LWH2PT(value,nplaces)
or		CALL LWHL2X(value,nplaces)

writes <value> to the terminal as an unsigned hex number, to a minimum
of <nplaces> characters, right-justified, filled with spaces.

Two entry points are provided:	LWH2PT which uses capital letters A-F, and
				LWHL2X which uses lower case.
		.Endc

LWH2PT::
	call	lw$2pt
	.word	wh2pt

LWHL2X::
	call	lw$2pt
	.word	whl2pt
.end

LWH2T.MAC
.Title	LWH2T - (Fortran) Write d/precis hexadecimal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$2t,wh2t,whl2t

		.If eq 1
Called by
		CALL LWH2T(value)

writes <value> to the terminal as an unsigned hexadecimal number.

Two entry points are provided:	LWH2T which uses capital letters A-F, and
				LWHL2T which uses lower case.
		.Endc

LWH2T::
	call	lw$2t
	.word	wh2t

LWHL2T::
	call	lw$2t
	.word	whl2t
.end

LWH2P.MAC
.Title	LWH2P - (Fortran) Write d/precis hex # to string, specif # places
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$2p,wh2p,whl2p

		.If eq 1
Called by
		CALL LWH2P(value,string,last,nplaces)

where <value> is to be written to the <string> as an unsigned octal number,
to a minimum of <nplaces> characters, right-justified, filled with spaces.
<last> is increased by the number of characters written to <string>.

Two entry points are provided:	LWH2P uses capital letters A-F, and
				LWHL2P uses lower case.
		.Endc

LWH2P::
	call	lw$2p
	.word	wh2p

LWHL2P::
	call	lw$2p
	.word	wh2p
.end

LWH2.MAC
.Title	LWH2 - (Fortran) Write d/precis hexadecimal number to string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$2,wh2,whl2

		.If eq 1
Called by
		CALL LWH2(value,string,last)

where <value> is to be written to the <string> as an unsigned octal number.
<last> is increased by the number of characters written to <string>.

Two entry points are provided:	LWH2 uses upper case letters A-F, and
				LWHL2 uses lower case.
		.Endc

LWH2::
	call	lw$2
	.word	wh2

LWHL2::
	call	lw$2
	.word	whl2

.end

LRN2T.MAC
.Title	LRN2T - (Fortran) Read 2/precis (octal, decimal or hex) from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	7-May-83	CVLLIB Routine

.globl	rn2t,lr$2t
		.If eq 1
Called by
		INTEGER LRN2T
		I = LRN2T(2.value,char)

Provides a signed number in <2.value>.
The function returns 0 if no overflow occurred, -1 if it did.

<char> receives the terminating character.

For the discrimination between decimal, octal and hex numbers, see RN.MAC
		.Endc

LRN2T::
	call	rn2t
	jmp	lr$2t
.end

LRN2.MAC
.Title	LRN2 - (Fortran) Read 2/precis (octal, decimal or hex) from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	7-May-83	CVLLIB Routine

.globl	lr$2,rn2
		.If eq 1
Called by
		INTEGER LRN2
		I = LRN2(2.value,string,last)

Provides a signed number in <2.value>.
The function returns 0 if no overflow occurred, -1 if it did.

The number is read from the string of ascii characters in <string>.

<last> is increased by the number of characters read from <string>.

For the discrimination between decimal, octal and hex numbers, see RN.MAC.
		.Endc

LRN2::
	call	lr$2
	.word	rn2
.end

LRD2ST.MAC
.Title	LRD2ST - (Fortran) Read signed decimal d/precis # from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$2t,rd2st

		.If eq 1
Called by
		INTEGER LRD2ST
		I = LRD2ST(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD2ST::
	call	rd2st
	jmp	lr$2t
.end

LRD2T.MAC
.Title	LRD2T - (Fortran) Read unsigned decimal d/precis # from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$2t,rd2t

		.If eq 1
Called by
		INTEGER LRD2T
		I = LRD2T(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD2T::
	call	rd2t
	jmp	lr$2t
.end

LRD2S.MAC
.Title	LRD2S - (Fortran) Read signed decimal d/precis # from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$2,rd2s

		.If eq 1
Called by
		INTEGER LRD2S
		I = LRD2S(value,string,last)

returns a double-length integer value in <value>

<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD2S::
	call	lr$2
	.word	rd2s
.end

LRD2.MAC
.Title	LRD2 - (Fortran) Read unsigned decimal d/precis # from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$2,rd2

		.If eq 1
Called by
		INTEGER LRD2
		I = LRD2(value,string,last)

returns a double-length integer value in <value>

<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD2::
	call	lr$2
	.word	rd2
.end

LR82ST.MAC
.Title	LR82ST - (Fortran) Read signed octal d/precis # from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$2t,r82st

		.If eq 1
Called by
		INTEGER LR82ST
		I = LR82ST(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR82ST::
	call	r82st
	jmp	lr$2t
.end

LR82T.MAC
.Title	LR82T - (Fortran) Read unsigned octal d/precis # from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$2t,r82t

		.If eq 1
Called by
		INTEGER LR82T
		I = LR82T(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR82T::
	call	r82t
	jmp	lr$2t
.end

LR82S.MAC
.Title	LR82S - (Fortran) Read signed octal d/precis # from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$2,r82s

		.If eq 1
Called by
		INTEGER LR82S
		I = LR82S(value,string,last)

returns a double-length integer value in <value>

<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR82S::
	call	lr$2
	.word	r82s
.end

LR82.MAC
.Title	LR82 - (Fortran) Read unsigned octal d/precis # from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lr$2,r82

		.If eq 1
Called by
		INTEGER LR82
		I = LR82(value,string,last)

returns a double-length integer value in <value>

<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR82::
	call	lr$2
	.word	r82
.end

LRH2T.MAC
.Title	LRH2T - (Fortran) Read hexadecimal d/precis # from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lr$2t,rh2t

		.If eq 1
Called by
		INTEGER LRH2T
		I = LRH2T(value,char)

returns a double-length integer value in <value> and the delimiting
character in <char>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRH2T::
	call	rh2t
	jmp	lr$2t
.end

LRH2.MAC
.Title	LRH2 - (Fortran) Read hexadecimal d/precis # from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lr$2,rh2

		.If eq 1
Called by
		INTEGER LRH2
		I = LRH2(value,string,last)

returns a double-length integer value in <value>

<last> is increased by the number of characters read from <string>.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRH2::
	call	lr$2
	.word	rh2
.end

LWDSPT.MAC
.Title	LWDSPT - (Fortran) write signed decimal no. to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	27-Mar-86	CVLLIB Routine

.globl	wdspt
		.If eq 1
Called by
		CALL LWDSPT(number,nplaces)

where <number> is the number to be typed, and <nplaces> the minimum number of
places to be occupied, the field being left-filled with spaces.  Should
more places be required, the field is expanded with no error message.
		.endc

LWDSPT::
	mov	@4(r5),r2	;<nplaces>
	mov	@2(r5),r0	;<number>
	jmp	wdspt
.end

LWDPT.MAC
.Title	LWDPT - (Fortran) write unsigned decimal no. to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	27-Mar-86	CVLLIB Routine
;Make LWDPT unsigned
.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	wdpt
		.If eq 1
Called by
		CALL LWDPT(number,nplaces)

where <number> is the number to be typed, and <nplaces> the minimum number of
places to be occupied, the field being left-filled with spaces.  Should
more places be required, the field is expanded with no error message.
		.endc

LWDPT::
	mov	@4(r5),r2	;<nplaces>
	mov	@2(r5),r0	;<number>
	jmp	wdpt
.end

LWDST.MAC
.Title	LWDST - (Fortran) Write signed decimal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	27-Mar-86	CVLLIB Routine

.globl	wdst
		.If eq 1
Called by
		CALL LWDST(number)

Where <number> is the number to be typed with no leading or trailing spaces
		.Endc

LWDST::
	mov	@2(r5),r0
	jmp	wdst
.end

LWDT.MAC
.Title	LWDT - (Fortran) Write unsigned decimal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	27-Mar-86	CVLLIB Routine
;Make LWDT unsigned
.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	wdt
		.If eq 1
Called by
		CALL LWDT(number)

Where <number> is the number to be typed with no leading or trailing spaces
		.Endc

LWDT::
	mov	@2(r5),r0
	jmp	wdt
.end

LWDSP.MAC
.Title	LWDSP - (Fortran) write signed decimal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	27-Mar-86	CVLLIB Routine

.globl	lw$p,wdsp
		.If eq 1
Called by
		CALL LWDSP(number,string,last,nplace)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, <last> is increased by
the number of bytes written to the string, and <nplace> is
the minimum number of places (left padded with spaces if necessary) to
be filled.  Thus the call CALL LWDSP(234,STRING(1),LAST,4) with LAST=1
would lead to the characters " 234<null>" from STRING(1) to STRING(5)
with LAST=5.
		.Endc

LWDSP::
	call	lw$p
	.word	wdsp
.end

LWDP.MAC
.Title	LWDP - (Fortran) write unsigned decimal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	27-Mar-86	CVLLIB Routine
;Make LWDP unsigned
.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$p,wdp
		.If eq 1
Called by
		CALL LWDP(number,string,last,nplace)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, <last> is increased by
the number of bytes written to the string, and <nplace> is
the minimum number of places (left padded with spaces if necessary) to
be filled.  Thus the call CALL LWDP(234,STRING(1),LAST,4) with LAST=1
would lead to the characters " 234<null>" from STRING(1) to STRING(5)
with LAST=5.
		.Endc

LWDP::
	call	lw$p
	.word	wdp
.end

LWDS.MAC
.Title	LWDS - (Fortran) write signed decimal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	27-Mar-86	CVLLIB Routine

.globl	lw$adj,wds
		.If eq 1
Called by
		CALL LWDS(number,string,last)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, and <last> is increased
by the number of characters written to the string.
Thus the call CALL LWD(234,STRING(1),LAST) with LAST=1 would lead to the
characters "234<null>" from STRING(1) to STRING(4) with LAST=4.
		.Endc

LWDS::
	mov	@2(r5),r0	;Number
	call	lw$adj
	.word	wds
.end

LWD.MAC
.Title	LWD - (Fortran) write unsigned decimal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	27-Mar-86	CVLLIB Routine
;Make LWD unsigned
.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$adj,wd
		.If eq 1
Called by
		CALL LWD(number,string,last)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, and <last> is increased
by the number of characters written to the string.
Thus the call CALL LWD(234,STRING(1),LAST) with LAST=1 would lead to the
characters "234<null>" from STRING(1) to STRING(4) with LAST=4.
		.Endc

LWD::
	mov	@2(r5),r0	;Number
	call	lw$adj
	.word	wd
.end

LW8SPT.MAC
.Title	LW8SPT - (Fortran) write signed octal no. to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	w8spt
		.If eq 1
Called by
		CALL LW8SPT(number,nplaces)

where <number> is the number to be typed, and <nplaces> the minimum number of
places to be occupied, the field being left-filled with spaces.  Should
more places be required, the field is expanded with no error message.
		.endc

LW8SPT::
	mov	@4(r5),r2	;<nplaces>
	mov	@2(r5),r0	;<number>
	jmp	w8spt
.end

LW8PT.MAC
.Title	LW8PT - (Fortran) write unsigned octal no. to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	w8pt
		.If eq 1
Called by
		CALL LW8PT(number,nplaces)

where <number> is the number to be typed, and <nplaces> the minimum number of
places to be occupied, the field being left-filled with spaces.  Should
more places be required, the field is expanded with no error message.
		.endc

LW8PT::
	mov	@4(r5),r2	;<nplaces>
	mov	@2(r5),r0	;<number>
	jmp	w8pt
.end

LW8ST.MAC
.Title	LW8ST - (Fortran) write signed octal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	w8st
		.If eq 1
Called by
		CALL LW8ST(number)

where <number> is the number to be typed with no leading or trailing spaces
		.Endc

LW8ST::
	mov	@2(r5),r0
	jmp	w8st
.end

LW8T.MAC
.Title	LW8T - (Fortran) write unsigned octal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-80	CVLLIB Routine

.globl	w8t
		.If eq 1
Called by
		CALL LW8T(number)

where <number> is the number to be typed with no leading or trailing spaces
		.Endc

LW8T::
	mov	@2(r5),r0
	jmp	w8t
.end

LW8SP.MAC
.Title	LW8SP - (Fortran) write signed octal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$p,w8sp
		.If eq 1
Called by
		CALL LW8SP(number,string,last,nplace)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, <last> is increased
by the number of bytes written to the string, and <nplace> is
the minimum number of places (left padded with spaces if necessary) to
be filled.  Thus the call CALL LW8SP(-8,STRING(1),LAST,4) with LAST=1 would
lead to the characters " -10<null>" from STRING(1) to STRING(5) with LAST=5.
		.Endc

LW8SP::
	call	lw$p
	.word	w8sp
.end

LW8P.MAC
.Title	LW8P - (Fortran) write unsigned octal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$p,w8p
		.If eq 1
Called by
		CALL LW8P(number,string,last,nplace)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, <last> is increased
by the number of characters written to the string, and <nplace> is
the minimum number of places (left padded with spaces if necessary) to
be filled.  Thus the call CALL LW8P(64,STRING(1),LAST,4) with LAST=1 would
lead to the characters " 100<null>" from STRING(1) to STRING(5) with LAST=5.
		.Endc

LW8P::
	call	lw$p
	.word	w8p
.end

LW8S.MAC
.Title	LW8S - (Fortran) write signed octal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$adj,w8s
		.If eq 1
Called by
		CALL LW8S(number,string,last)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, and <last> is increased
by the number of bytes written to the string.
Thus the call CALL LW8S(-64,STRING(1),LAST) with LAST=1 would lead to the
characters "-100<null>" from STRING(1) to STRING(5) with LAST=5.
		.Endc

LW8S::
	mov	@2(r5),r0	;Number
	call	lw$adj
	.word	w8s
.end

LW8.MAC
.Title	LW8 - (Fortran) write signed octal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V4	28-Jul-81	CVLLIB Routine

.globl	lw$adj,w8
		.If eq 1
Called by
		CALL LW8(number,string,last)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, and <last> is increased
by the number of bytes written to the string.
Thus the call CALL LW8(-64,STRING(1),LAST) with LAST=1 would lead to the
characters "177700<null>" from STRING(1) to STRING(7) with LAST=7.
		.Endc

LW8::
	mov	@2(r5),r0	;Number
	call	lw$adj
	.word	w8
.end

LWHPT.MAC
.Title	LWHPT - (Fortran) write hexadecimal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	whpt,whlpt

		.If eq 1
Called by
		CALL LWHPT(number,nplaces)

where <number> is the number to be typed, and <nplaces> the minimum number of
places to be occupied, the field being left-filled with spaces.  Should
more places be required, the field is expanded with no error message.

Two entry points are provided:	LWHPT uses upper case letters A-F, and
				LWHLPT uses lower case.
		.endc

LWHPT::
	mov	@4(r5),r2	;<nplaces>
	mov	@2(r5),r0	;<number>
	jmp	whpt

LWHLPT::
	mov	@4(r5),r2
	mov	@2(r5),r0
	jmp	whlpt
.end

LWHT.MAC
.Title	LWHT - (Fortran) write hexadecimal number to terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	wht,whlt
		.If eq 1
Called by
		CALL LWHT(number)

where <number> is the number to be typed with no leading or trailing spaces

Two entry points are provided:	LWHT uses capital letters A-F, and
				LWHLT uses lower case.
		.Endc

LWHT::
	mov	@2(r5),r0
	jmp	wht

LWHLT::
	mov	@2(r5),r0
	jmp	whlt
.end

LWHP.MAC
.Title	LWHP - (Fortran) write hexadecmial number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$p,whp,whlp

		.If eq 1
Called by
		CALL LWHP(number,string,last,nplace)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, <last> is increased
by the number of characters written to the string, and <nplace> is
the minimum number of places (left padded with spaces if necessary) to
be filled.  Thus the call CALL LWHP(64,STRING(1),LAST,4) with LAST=1 would
lead to the characters "  40<null>" from STRING(1) to STRING(5) with LAST=5.

Two entry points are provided:	LWHP uses upper case letters A-Z, and
				LWHLP uses lower case.
		.Endc

LWHP::
	call	lw$p
	.word	whp

LWHLP::
	call	lw$p
	.word	whlp

.end

LWH.MAC
.Title	LWH - (Fortran) write hexadecimal number into a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lw$adj,wh,whl
		.If eq 1
Called by
		CALL LWH(number,string,last)

Where <number> is the number to be converted into a string, <string> is the
starting position into which data is to be written, and <last> is increased
by the number of bytes written to the string.
Thus the call CALL LWH(-64,STRING(1),LAST) with LAST=1 would lead to the
characters "FFC0<null>" from STRING(1) to STRING(5) with LAST=5.

Two entry points are provided:	LWH uses capital letters A-F, and
				LWLH uses lower case.
		.Endc

LWH::
	mov	@2(r5),r0	;Number
	call	lw$adj
	.word	wh

LWLH::
	mov	@2(r5),r0
	call	lw$adj
	.word	whl

.end

LRNT.MAC
.Title	LRNT - (Fortran) Read a number (octal, decimal or hex) from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2B	15-Apr-83	CVLLIB Routine
;Include hex.
.Sbttl	V2A	 3-Apr-83	CVLLIB Routine
;Bug fix.
.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	rnt,lretc
		.If eq 1
Called by
		INTEGER LRNT
		I = LRNT(value,char)

Provides a signed number in <value>.
The function returns 0 if no overflow occurred, -1 if it did.

<char> receives the terminating character.

For the discrimination between decimal, octal and hex numbers, see RN.MAC
		.Endc

LRNT::
	call	rnt
	mov	r0,@2(r5)	;Value returned
	movb	(r1),@4(r5)	;Delimiting character
	jmp	lretc
.end

LRN.MAC
.Title	LRN - (Fortran) Read a number (octal, decimal or hex) from a string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3A	15-Apr-83	CVLLIB Routine
;Include hex
.Sbttl	V3	28-Jul-81	CVLLIB Routine

.globl	lr$,rn
		.If eq 1
Called by
		INTEGER LRN
		I = LRN(value,string,last)

Provides a signed number in <value>.
The function returns 0 if no overflow occurred, -1 if it did.

The number is read from the string of ascii characters in <string>.

<last> is increased by the number of characters read from <string>.

For the discrimination between decimal, octal and hex numbers, see RN.MAC.
		.Endc

LRN::
	call	lr$
	.word	rn
.end

LRDST.MAC
.Title	LRDST - (Fortran) read signed decimal number from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rdst,lretc
		.If eq 1
Called by
		INTEGER LRDST
		I = LRDST(number,char)

Where <number> is the number returned, and <char> the (byte) delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRDST::
	call	rdst
	mov	r0,@2(r5)
	movb	(r1),@4(r5)
	jmp	lretc
.end

LRDT.MAC
.Title	LRDT - (Fortran) read unsigned decimal number from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	rdt,lretc
		.If eq 1
Called by
		INTEGER LRDT
		I = LRDT(number,char)

Where <number> is the number returned, and <char> the (byte) delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRDT::
	call	rdt
	mov	r0,@2(r5)
	movb	(r1),@4(r5)
	jmp	lretc
.end

LRDS.MAC
.Title	LRDS - (Fortran) read signed decimal number from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	lr$,rds
		.If eq 1
Called by
		INTEGER LRDS
		I = LRDS(number,string,last)

Where <number> receives the number read, <string> contains the string to be
decoded and <last> is increased by the number of characters read from
<string>.
Thus if STRING(1-5) contain "97ABC" and LAST=1, on return NUMBER will
contain 97, and LAST will contain 3.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRDS::
	call	lr$
	.word	rds
.end

LRD.MAC
.Title	LRD - (Fortran) read unsigned decimal number from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	lr$,rd
		.If eq 1
Called by
		INTEGER LRD
		I = LRD(number,string,last)

Where <number> receives the number read, <string> contains the string to be
decoded and <last> is increased by the number of characters read from
<string>.
Thus if STRING(1-5) contain "97ABC" and LAST=1, on return NUMBER will
contain 97, and LAST will contain 3.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRD::
	call	lr$
	.word	rd
.end

LR8ST.MAC
.Title	LR8ST - (Fortran) read signed octal number from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	r8st,lretc
		.If eq 1
Called by
		INTEGER LR8ST
		I = LR8ST(number,char)

Where <number> is the number returned, and <char> the (byte) delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR8ST::
	call	r8st
	mov	r0,@2(r5)
	movb	(r1),@4(r5)
	jmp	lretc
.end

LR8T.MAC
.Title	LR8T - (Fortran) read unsigned octal number from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	r8t,lretc
		.If eq 1
Called by
		INTEGER LR8T
		I = LR8T(number,char)

Where <number> is the number returned, and <char> the (byte) delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR8T::
	call	r8t
	mov	r0,@2(r5)
	movb	(r1),@4(r5)
	jmp	lretc
.end

LR8S.MAC
.Title	LR8S - (Fortran) read signed octal number from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	lr$,r8s
		.If eq 1
Called by
		INTEGER LR8S
		I = LR8S(number,string,last)

Where <number> receives the number read, <string> contains the string to be
decoded and <last> is increased by the number of characters read from
<string>.
Thus if STRING(1-5) contain "349BC" and LAST=1, on return NUMBER will
contain 34 (octal), and LAST will contain 3.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR8S::
	call	lr$
	.word	r8s
.end

LR8.MAC
.Title	LR8 - (Fortran) read unsigned octal number from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V5	28-Jul-81	CVLLIB Routine

.globl	lr$,r8
		.If eq 1
Called by
		INTEGER LR8
		I = LR8(number,string,last)

Where <number> receives the number read, <string> contains the string to be
decoded and <last> is increased by the number of characters read from
<string>.
Thus if STRING(1-5) contain "349BC" and LAST=1, on return NUMBER will
contain 34 (octal), and LAST will contain 3.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LR8::
	call	lr$
	.word	r8
.end

LRHT.MAC
.Title	LRHT - (Fortran) read hexadecimal number from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	rht,lretc
		.If eq 1
Called by
		INTEGER LRHT
		I = LRHT(number,char)

Where <number> is the number returned, and <char> the (byte) delimiting
character.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRHT::
	call	rht
	mov	r0,@2(r5)
	movb	(r1),@4(r5)
	jmp	lretc
.end

LRH.MAC
.Title	LRH - (Fortran) read hexadecimal number from string
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	lr$,rh
		.If eq 1
Called by
		INTEGER LRH
		I = LRH(number,string,last)

Where <number> receives the number read, <string> contains the string to be
decoded and <last> is increased by the number of characters read from
<string>.
Thus if STRING(1-5) contain "34XYZ" and LAST=1, on return NUMBER will
contain 34 (hex), and LAST will contain 3.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
will have continued to the end of the number.
		.Endc

LRH::
	call	lr$
	.word	rh
.end

LW2PT.MAC
.Title	LW$2PT - (Fortran) Common pathway for LWx2PT
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

		.If eq 1
Final common pathway for fortran routines writing double-precision
integers with a fixed number of places to the user's terminal.
These have a calling sequence in the form

	CALL LWx2PT (value,nplaces)

where <value> is the double-precision integer to be printed, and
<nplaces> the minimum number of places (right-justified, filled with
spaces) for it to occupy.

The calling sequence is

	JSR	PC,LW$2PT
	.WORD	<address of routine to use to print number>

Return is made not to this call but to the original calling sequence.
		.Endc

LW$2PT::
	mov	2(r5),r0	;Get double-precision value in R2,R3
	mov	(r0)+,r2
	mov	(r0),r3
	mov	@4(r5),r0	;Number of places to occupy
	mov	@(sp),(sp)	;Move address of printing sequence in place
	return			; of return address, and jump to it.
.end

LW2T.MAC
.Title	LW$2T - (Fortran) Common pathway for LWx2T
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

		.If eq 1
Final common pathway for fortran routines writing double-precision
integers to the user's terminal.  These have a calling sequence in the form

	CALL LWx2T (value)

where <value> is the double-precision integer to be printed.

The calling sequence is

	JSR	PC,LW$2T
	.WORD	<address of routine to use to print number>

Return is made not to this call but to the original calling sequence.
		.Endc

LW$2T::
	mov	2(r5),r0	;Get double-precision value in R2,R3
	mov	(r0)+,r2
	mov	(r0),r3
	mov	@(sp),(sp)	;Move address of printing sequence in place
	return			; of return address, and jump to it.
.end

LW2P.MAC
.Title	LW$2P - (Fortran) Common pathway for LWx2P
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$adj

		.If eq 1
Final common pathway for fortran routines writing double-precision
integers with a fixed number of places to a string.
These have a calling sequence in the form

	CALL LWx2P (value,string,last,nplaces)

where <value> is the double-precision integer to be printed,
<string> is the string into which it is to be assembled,
<last> receives the index to the next free byte in <string>, and
<nplaces> is the minimum number of places (right-justified, filled with
spaces) for it to occupy.

The calling sequence is

	JSR	PC,LW$2P
	.WORD	<address of routine to use to print number>

Return is made not to this call but to the original calling sequence.
		.Endc

LW$2P::
	mov	2(r5),r0	;Get double-precision value in R2,R3
	mov	(r0)+,r2
	mov	(r0),r3
	mov	@10(r5),r0	;Number of places to occupy
	jmp	lw$adj		;Routine which calls required sequence and
				; calculates the value for <last>.
.end

LW2.MAC
.Title	LW$2 - (Fortran) Common pathway for LWx2
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$adj

		.If eq 1
Final common pathway for fortran routines writing double-precision
integers to a string.
These have a calling sequence in the form

	CALL LWx2 (value,string,last)

where <value> is the double-precision integer to be printed,
<string> is the string into which it is to be assembled, and
<last> receives the index to the next free byte in <string>.

The calling sequence is

	JSR	PC,LW$2
	.WORD	<address of routine to use to print number>

Return is made not to this call but to the original calling sequence.
		.Endc

LW$2::
	mov	2(r5),r0	;Get double-precision value in R2,R3
	mov	(r0)+,r2
	mov	(r0),r3
	jmp	lw$adj		;Routine which calls required sequence and
				; calculates the value for <last>.
.end

LWP.MAC
.Title	LW$P - (Fortran) Common pathway for LWxP
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	lw$adj

		.If eq 1
Final common pathway for fortran routines writing single-precision
integers with a fixed number of places to a string.
These have a calling sequence in the form

	CALL LWxP (value,string,last,nplaces)

where <value> is the single-precision integer to be printed,
<string> is the string into which it is to be assembled,
<last> receives the index to the next free byte in <string>, and
<nplaces> is the minimum number of places (right-justified, filled with
spaces) for it to occupy.

The calling sequence is

	JSR	PC,LW$P
	.WORD	<address of routine to use to print number>

Return is made not to this call but to the original calling sequence.
		.Endc

LW$P::
	mov	@2(r5),r0	;Value to be printed
	mov	@10(r5),r2	;Number of places to occupy
	jmp	lw$adj		;Routine which calls required sequence and
				; calculates the value for <last>.
.end

LR.MAC
.Title	LR$ - (Fortran) Common pathway for LRx
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$adj,lretc

		.If eq 1
Final common pathway for fortran routines reading single-precision
integers from strings.
These have a calling sequence in the form

	I = LRx (value,string,last)

where <value> is the single-precision integer to be read,
<string> is the string from which the number is to be read, and
<last> is to receive an index to the byte which delimited the number read.

A value of 0 is returned unless overflow occurred on reading the number,
in which case -1 is returned.  In this case the scan of the input data
may have terminated before all the digits were read.

The calling sequence is

	JSR	PC,LR$
	.WORD	<address of routine to use to read number>

Return is made not to this call but to the original calling sequence.
		.Endc

LR$::
	mov	4(r5),r1	;Address of string
	mov	@(sp),(sp)	;Move address of read routine to stack top
	call	@(sp)+
	mov	r0,@2(r5)	;Return value.
	call	lretc		;Set up R0 according to carry
	jmp	lr$adj		;Calculates value for <last>, and returns.
.end

LMUL22.MAC
.Title	LMUL22 - (Fortran) Double * double signed multiplication
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	mul22,lretc

		.If eq 1
Called by
		INTEGER LMUL22
		I = LMUL22(double,double,doubleresult)

this routine provides a means of handling double-precision integers directly
in the form .word <high-order bits>,<low-order bits>, in contradistinction
to the SYSLIB facilities which reverse these words.

Overflow is indicated by a returned value of -1 rather than 0.
		.Endc

LMUL22::
	mov	2(r5),r0
	mov	(r0)+,r2	;High order multiplier
	mov	(r0),r3		;Low order multiplier
	mov	4(r5),r0	;Addr of multiplicand
	call	mul22
	mov	6(r5),r0
	mov	r2,(r0)+	;High order result
	mov	r3,(r0)		;Low order result
	jmp	lretc		;Set R0 according to carry bit
.end

LMUL21.MAC
.Title	LMUL21 - (Fortran) Double * single signed multiplication
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	mul21,lretc

		.If eq 1
Called by
		INTEGER LMUL21
		I = LMUL21(double,single,result)

this routine provides a means of handling double-precision integers directly
in the form .word <high-order bits>,<low-order bits>, in contradistinction
to the SYSLIB facilities which reverse these words.

Overflow is indicated by a returned value of -1 rather than 0.
		.Endc

LMUL21::
	mov	2(r5),r0
	mov	(r0)+,r2	;High order multiplicand
	mov	(r0),r3		;Low order multiplicand
	mov	@4(r5),r0	;Single-precision multiplier
	call	mul21
	mov	6(r5),r0
	mov	r2,(r0)+	;High order result
	mov	r3,(r0)		;Low order result
	jmp	lretc		;Set R0 according to carry bit
.end

LDIV21.MAC
.Title	LDIV21 - (Fortran) Double / single signed division
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	div21,lretc

		.If eq 1
Called by
		INTEGER LDIV21
		I = LDIV21(double,single,doublequotient,remainder)

this routine provides a means of handling double-precision integers directly
in the form .WORD <high-order bits>,<low-order bits>, in contradistinction
to the SYSLIB facilities which reverse these words.

Divide-by-zero is indicated by a returned value of -1, rather than 0.
		.Endc

LDIV21::
	mov	2(r5),r0
	mov	(r0)+,r2	;High order dividend
	mov	(r0),r3		;Low order dividend
	mov	@4(r5),r0	;Divisor
	call	div21
	mov	r0,@10(r5)	;Remainder
	mov	6(r5),r0
	mov	r2,(r0)+	;High-order quotient
	mov	r3,(r0)
	jmp	lretc		;Set R0 according to carry
.end

LADD2.MAC
.Title	LADD2 - (Fortran) Double-precision addition
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

		.If eq 1
Called by
		INTEGER LADD2
		I = LADD2(2/value,2/value,2/result)
adds the two double-precision integer values (with high-order word first)
to produce a double-precision result.  Overflow is indicated by a
negative returned value (rather than 0).
		.Endc

LADD2::
	clr	r0		;For returning overflow
	mov	2(r5),r1	;First Argument
	mov	(r1)+,r2	;Highest order word
	mov	(r1),r3
	mov	4(r5),r1	;Second argument

	add	2(r1),r3
	adc	r2
	bvc	20$
	dec	r0
20$:
	add	(r1),r2
	bvc	30$
	dec	r0
30$:
	mov	6(r5),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)

	return	
.END

LSUB2.MAC
.Title	LSUB2 - (Fortran) Double-precision subtraction
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

		.If eq 1
Called by
		INTEGER LSUB2
		I = LSUB2(2/value,2/value,2/result)
subtracts the first double-precision integer value (with high-order
word first) from the second, to produce a double-precision result.
Overflow is indicated by a negative returned value (rather than 0).
		.Endc

LSUB2::
	clr	r0		;For returning overflow
	mov	4(r5),r1	;Second Argument - Subtrahend
	mov	(r1)+,r2	;Highest order word
	mov	(r1),r3
	mov	2(r5),r1	;First argument - Subtractor

	sub	2(r1),r3
	sbc	r2
	bvc	20$
	dec	r0
20$:
	sub	(r1),r2
	bvc	30$
	dec	r0
30$:
	mov	6(r5),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)

	return	
.end

LCMP2.MAC
.Title	LCMP2 - (Fortran) Compare two Double-precision numbers
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

		.If eq 1
Called by
		INTEGER LCMP2
		I = LCMP2(2/value1,2/value2)

provides a means of signed comparison between two double precision values.
The value returned is 0 if <2/value1><EQ><2/value2>, 1 if <GT> and -1 if <LT>.
		.Endc

LCMP2::
	clr	r0
	tst	(r5)+
	mov	(r5)+,r1	;Address of first value
	mov	(r5),r2		;Address of second value.

	cmp	(r1)+,(r2)+	;Compare high order words
	bgt	10$
	blt	20$
	cmp	(r1),(r2)	;Compare low order if high orders equal
	bhi	10$		;HI implies GT
	blo	20$		;LO implies LT
	return
10$:
	inc	r0
	return
20$:
	dec	r0
	return
.end

LNEG2.MAC
.Title	LNEG2 - (Fortran) Negate a double-precision integer
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

		.If eq 1
Called by
		CALL LNEG2(doublevalue)
negates the double precision integer in situ.
		.Endc

LNEG2::
	mov	2(r5),r0
	neg	(r0)+		;High order word first
	neg	(r0)		;then low
	sbc	-(r0)		;and tidy the carry up.
	return
.end

LC12.MAC
.Title	LC12 - (Fortran) Convert single to double precision
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c12

		.If eq 1
Called by
		CALL LC12(single,double)

converts the single-precision integer <single> into a double-precision
integer in <double> (high order word first).
		.Endc

LC12::
	mov	@2(r5),r0	;Single
	call	c12
	mov	4(r5),r0	;Address of double
	mov	r2,(r0)+
	mov	r3,(r0)
	return
.end

LC13.MAC
.Title	LC13 - (Fortran) Convert single-precision to triple-precision
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c13

		.If eq 1
Called by
		CALL LC13(single,triple)

converts the single-precision integer <single> into a triple-precision
integer stored in <triple>, high-order word first.
		.Endc

LC13::
	mov	@2(r5),r0	;Single
	mov	4(r5),r2	;Address of triple
	jmp	c13
.end

LC23.MAC
.Title	LC23 - (Fortran) Convert double to triple precision
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c23

		.If eq 1
Called by
		CALL LC23(double,triple)

converts a double-precision integer in <double> (high order word first)
into a triple-precision integer in <triple> (ibid).
		.Endc

LC23::
	mov	2(r5),r0	;Address of <double>
	mov	(r0)+,r2	;High order word
	mov	(r0),r3		;Low order word
	mov	4(r5),r0	;Address of <triple>
	jmp	c23
.end

LC21.MAC
.Title	LC21 - (Fortran) Convert double to single precision
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c21,lretc

		.If eq 1
Called by
		INTEGER LC21
		I = LC21(double,single)

converts the double-precision integer in <double> (high-order word first)
to a single-precision integer in <single>.  Normally the value returned
by the function will be zero.  Should it be impossible to fit the value
in the double-precision word into a single-precision word the returned
value will be -1.
		.Endc

LC21::
	mov	2(r5),r0	;Address of <double>
	mov	(r0)+,r2	;High-order word
	mov	(r0),r3		;Low-order word
	call	c21
	mov	r0,@4(r5)
	jmp	lretc		;Return R0 depending on carry bit
.end

LC32.MAC
.Title	LC32 - (Fortran) Convert triple-precision to double-precision
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c32,lretc

		.If eq 1
Called by
		INTEGER LC32
		I = LC32(triple,double)

converts the triple-precision integer in <triple> (highest order word first)
to a double precision integer in <double> (ibid).  Should it be impossible
to fit the value contained in <triple> into a double-precision word, the
function returns the value -1.  Normally 0 will be returned.
		.Endc

LC32::
	mov	2(r5),r0	;Address of <triple>
	call	c32
	mov	4(r5),r0	;Address of <double>
	mov	r2,(r0)+
	mov	r3,(r0)+
	jmp	lretc		;Return R0 according to carry bit.
.end

LC31.MAC
.Title	LC31 - (Fortran) Convert triple-precision to single
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	c31,lretc

		.If eq 1
Called by
		INTEGER LC31
		I = LC31(triple,single)

converts a triple-precision integer in <triple> (highest-order word first)
into a single-precision integer in <single>.  Should it not be possible to
confine the value in <triple> into a single-precision word, this function
returns the value -1.  Otherwise 0 is returned.
		.Endc

LC31::
	mov	2(r5),r2	;Address of <triple>
	call	c31
	mov	r0,@4(r5)	;Single
	jmp	lretc		;Return R0 according to carry bit
.end

LSCG.MAC
.Title	LSCG - (Fortran) String Compare (General)
.Enabl	lc
.Nlist	bex,toc,sym
.dsabl	gbl

.psect	cvllib

.Sbttl	V1A	30-May-85	CVLLIB Routine
;Don't expect a second INDEX argument.
.Sbttl	V1	22-Feb-82	CVLLIB Routine

.globl	scg
		.If eq 1
Called by
	I = LSCG(string1,index,string2)

compares <string1> and <string2>, returning

	-1	if string1 < string2
	0	if string1 = string2
and	1	if string1 > string2

<index> provides an index to the last character
in each string examined.

Upper and lower case alphabetic characters are taken to be the same,
and the parity bit is ignored.

To match, the strings must be the same length.
		.Endc


LSCG::
	mov	#-1,r4		;For returned value
	mov	2(r5),r0	;Address of first string
	mov	6(r5),r1	;Address of second string
	call	scg
	blt	20$
	beq	10$
	inc	r4		;greater than - return 1
10$:	inc	r4		;equal        - return 0
20$:				;less than    - return -1
	sub	2(r5),r0
	mov	r0,@4(r5)

	mov	r4,r0
	return
.end

LSCX.MAC
.Title	LSCX - (Fortran) String Compare (Exact)
.Enabl	lc
.Nlist	bex,toc,sym
.dsabl	gbl

.psect	cvllib

.Sbttl	V1A	30-May-85	CVLLIB Routine
;Don't expect second INDEX arg
.Sbttl	V1	22-Feb-82	CVLLIB Routine

.Globl	scx
		.If eq 1
Called by
	I = LSCX(string1,index,string2)

compares <string1> and <string2>, returning

	-1	if string1 < string2
	0	if string1 = string2
and	1	if string1 > string2

<index> provides an index to the last character
in each string examined.

Upper and lower case alphabetic characters are taken to be different,
but the parity bit is ignored.

To match, the strings must be the same length.
		.Endc

LSCX::
	mov	#-1,r4		;For returned value
	mov	2(r5),r0	;Address of first string
	mov	6(r5),r1	;Address of second string
	call	scx
	blt	20$
	beq	10$
	inc	r4		;greater than - return 1
10$:	inc	r4		;equal        - return 0
20$:				;less than    - return -1
	sub	2(r5),r0
	mov	r0,@4(r5)

	mov	r4,r0
	return
.end

LSCGV.MAC
.Title	LSCGV - (Fortran) String Compare (General, Differing Lengths)
.Enabl	lc
.Nlist	bex,toc,sym
.dsabl	gbl

.psect	cvllib

.Sbttl	V1B	30-May-85	CVLLIB Routine
;Don't expect second INDEX arg
.Sbttl	V1A	14-Apr-83	CVLLIB Routine
.Sbttl	V1	22-Feb-82	CVLLIB Routine

.globl	scgv
		.If eq 1
Called by
	I = LSCGV(string1,index,string2)

compares <string1> and <string2>, returning

	-1	if string1 < string2
	0	if string1 = string2
and	1	if string1 > string2

<index> provides an index to the last character
in each string examined.

Upper and lower case alphabetic characters are taken to be the same,
and the parity bit is ignored.

The first string may be shorter than the second string,
and as long as all the characters up to the end of the first string
match, equality will be returned.
		.Endc

LSCGV::
	mov	#-1,r4		;For returned value
	mov	2(r5),r0	;Address of first string
	mov	6(r5),r1	;Address of second string
	call	scgv
	blt	20$
	beq	10$
	inc	r4		;greater than - return 1
10$:	inc	r4		;equal        - return 0
20$:				;less than    - return -1
	sub	2(r5),r0
	mov	r0,@4(r5)

	mov	r4,r0
	return
.end

LSCXV.MAC
.Title	LSCXV - (Fortran) String Compare (Exact, Differing Lengths)
.Enabl	lc
.Nlist	bex,toc,sym
.dsabl	gbl

.psect	cvllib

.Sbttl	V1B	30-May-85	CVLLIB Routine
;Don't expect second INDEX arg
.Sbttl	V1A	14-Apr-83	CVLLIB Routine
.Sbttl	V1	22-Feb-82	CVLLIB Routine

.Globl	scxv
		.If eq 1
Called by
	I = LSCXV(string1,index,string2)

compares <string1> and <string2>, returning

	-1	if string1 < string2
	0	if string1 = string2
and	1	if string1 > string2

<index> provides an index to the last character
in each string examined.

Upper and lower case alphabetic characters are taken to be different,
but the parity bit is ignored.

The first string may be shorter than the second string,
and as long as all the characters up to the end of the first string
match, equality will be returned.
		.Endc

LSCXV::
	mov	#-1,r4		;For returned value
	mov	2(r5),r0	;Address of first string
	mov	6(r5),r1	;Address of second string
	call	scxv
	blt	20$
	beq	10$
	inc	r4		;greater than - return 1
10$:	inc	r4		;equal        - return 0
20$:				;less than    - return -1
	sub	2(r5),r0
	mov	r0,@4(r5)

	mov	r4,r0
	return
.end

LWAT.MAC
.Title	LWAT - (Fortran) Write an ASCII character to the terminal
.Nlist	bex,toc
.Enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

.globl	wat
			.If eq 1
Called by

		CALL LWAT(character)

sends the relevant character to the user's terminal.  If the character
be a control character, it is sent in the form "<bel=7>", with the name and
the octal value of the character concerned.  The more common characters
(tab [rather than "ht"], lf,ff,cr, esc, and rubout [rather than "del"] do
not get their octal values printed.  Characters with the parity bit set are
sent in the form "<200+A>", "<200+<bel=7>>".
				.Endc

LWAT::
	mov	@2(r5),r0	;character
	jmp	wat
.end

LWA.MAC
.Title	LWA - (Fortran) Write an ASCII character
.Nlist	bex,toc
.Enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

.globl	wa,lw$adj
			.If eq 1
Called by

		CALL LWA(character,string,last)

sends the relevant character to the string. If the character
be a control character, it is sent in the form "<bel=7>", with the name and
the octal value of the character concerned.  The more common characters
(tab [rather than "ht"], lf,ff,cr, esc, and rubout [rather than "del"] do
not get their octal values printed.  Characters with the parity bit set are
sent in the form "<200+a>", "<200+<bel=7>>".

<last> receives an index to the terminating null.
				.Endc

LWA::
	mov	@2(r5),r0	;character
	call	lw$adj
	.word	wa
.end

LYES.MAC
.Title	LYES - (Fortran) Request Yes or other answer from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	yes,lretc
		.If eq 1
Called by
		I=LYES()

Waits for a line from the user, and returns the value 0 if the
first character of the user's line were "Y" or "y".  Otherwise returns
the value -1.
		.Endc

LYES::
	call	yes
	jmp	lretc
.end

LYESNO.MAC
.Title	LYESNO - (Fortran) Request Yes or No answer from terminal
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.globl	yesno,lretc
		.If eq 1
Called by
		I=LYESNO()

Waits for a line from the user, and returns the value 0 if the
first character of the user's line were "Y" or "y".  Returns -1
if the first character were "N" or "n".  For any other response it
prompts the user to try again.
		.Endc

LYESNO::
	call	yesno
	jmp	lretc
.end

LTLIN.MAC
.Title	LTLIN - (Fortran) Get a line from the terminal with .TTYIN's
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	tlin
		.If eq 1
Called by
		INTEGER LTLIN
		I=LTLIN(STRING,LAST)
Commences at STRING, providing a null-terminated (not <cr><lf>) line, and
setting LAST such that STRING(LAST) points to the terminating null.

Returns a value 0 if the line was not terminated by ^C, and -1 if it was.
The ^C character is available in the line for the user.
		.ENDC

LTLIN::
	mov	2(r5),r1	;STRING Starting address
	call	tlin
	bic	r2,r2		;For result, but don't use CLR as clears C bit
	bcc	10$
	dec	r2
10$:
	sub	r1,r0		;R1 start of string, R0 end.
	inc	r0		;Fortran arrays start at 1 not 0
	mov	r0,@4(r5)
	mov	r2,r0
	return
.end

LCHR.MAC
.Title	LCHR - (Fortran) Type a character or characters
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.mcall	.ttyou

		.If eq 1
Called by
		CALL LCHR(char[,char-2, ... ,char-n])
types each <char> as a single character to the terminal.  An indefinite
number of arguments is permitted.
		.Endc

LCHR::
	mov	(r5)+,r1	;Number of arguments
	ble	20$
10$:
	movb	@(r5)+,r0
	.ttyou
	dec	r1
	bne	10$
20$:
	return
.end

LPRINT.MAC
.Title	LPRINT - (Fortran) Printing Prompt from Fortran
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	11-Jul-81	CVLLIB Routine

.mcall	.ttyou

		.If eq 1
Provides the ability to send a prompt from Fortran in the format

		CALL LPRINT('This is a string')

such that the string (null terminated) is printed with no carriage-return
following.
		.Endc

LPRINT::
	mov	2(r5),r1
10$:
	movb	(r1)+,r0
	bic	#177600,r0
	beq	20$		;Terminate on either <200> or <0>
	.ttyou
	br	10$
20$:
	return
.end

LIRAN.MAC
.Title	LIRAN - (Fortran) Interface for IRAN
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl 	V3	14-Oct-81	CVLLIB Routine

.globl	iran,ran$nm

		.If eq 1
Called by
		I=LIRAN(N)
Returns
	a random integer from 0 to <n-1>.
AND
		CALL LRNSET(N)
	to initialize the random seed to <n>
	(though this will not be value returned)
		.Endc

LIRAN::
	mov	@2(r5),r0
	jmp	iran

LRNSET::
	mov	@2(r5),ran$nm
	return
.end

JSWSET.MAC
.Title	JSWSET - (Fortran) Provides access to JSW bits from fortran
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	1-Mar-81	CVLLIB Routine

		.If eq 1
Two fortran-callable subroutines are provided, for setting and clearing
bits in the JSW (RT-11 job status word).  They are called by

	CALL JSWSET(bits)	to set appropriate bits, and
	CALL JSWCLR(bits)	to clear bits.
		.Endc

jsw=44

JSWSET::
	bis	@2(r5),@#jsw
	return
JSWCLR::
	bic	@2(r5),@#jsw
	return
.end

LLTRIM.MAC
.Title	LLTRIM - (Fortran) Trim Left of String
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	28-Jul-81	CVLLIB Routine

.globl	ltrim

		.If eq 1
Called by
		I = LLTRIM(string)

returns the number of bytes from <string> which contain leading spaces
or tabs.  Thus if <string> contain "   123" the call to LLTRIM will
return the value 3, for the three leading spaces.  A value of zero will
be returned should there be no leading spaces.
		.Endc

LLTRIM::
	mov	2(r5),r1	;Address of <string>
	call	ltrim
	sub	2(r5),r1	;Difference after trimming
	mov	r1,r0
	return
.end

LRTRIM.MAC
.Title	LRTRIM - (Fortran) Trim Trailing Spaces
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	28-Jul-81	CVLLIB Routine

.globl	rtrim

		.If eq 1
Called by
		I = LRTRIM (string)

returns the number of bytes (working BACKWARDS from <string>) which contain
spaces or tabs.  Thus if <string> contain "fred.dat    " and the call
I=LRTRIM(STRING(12)) be used, the value 4 will be returned (for the four
spaces).
		.Endc

LRTRIM::
	mov	2(r5),r1	;Address of <string>
	call	rtrim
	mov	2(r5),r0
	sub	r1,r0		;Difference without trailing spaces
	return
.end

LDIG3.MAC
.Title	LDIG3 - (Fortran) Provide 3 digit Rad50 from Number
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	30-Jul-81	CVLLIB Routine

.globl	dig3,lretc

		.If eq 1
Called by
		I = LDIG3(nvalue,irvalue)

returns with I=0 if all was well, -1 if the value provided in <nvalue> were
above 999.

Takes the value in <nvalue> and converts it into the radix50 representation
of that number, in three digits, with leading zeroes, and returns it in
<irvalue>.
		.Endc

LDIG3::
	mov	@2(r5),r0
	call	dig3
	mov	r0,@4(r5)
	jmp	lretc		;Return R0 value as per carry bit
.end

LR2T.MAC
.Title	LR$2T - (Fortran) Common pathway for LRx2T
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$adj,lretc

		.If eq 1
Final common pathway for fortran routines reading double-precision
integers from the user's terminal.
These have a calling sequence in the form

	I = LRx2T (value,char)

where <value> is the double-precision integer to be read, and
<char> receives the value of the byte which delimited the number.

The value returned (I) is zero unless carry has been set by the
number-reading routine, in which case it is -1.

The calling sequence is

	JMP	LR$2T
with the number-reading routine already having been called.
		.Endc

LR$2T::
	movb	(r1),@4(r5)	;Delimiting character.
	mov	2(r5),r0	;Put double-precision value in place
	mov	r2,(r0)+
	mov	r3,(r0)
	jmp	lretc		;Set R0 according to carry.
.end

LR2.MAC
.Title	LR$2 - (Fortran) Common pathway for LRx2
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V3	11-Jul-81	CVLLIB Routine

.globl	lr$adj,lretc

		.If eq 1
Final common pathway for fortran routines reading double-precision
integers from strings.
These have a calling sequence in the form

	I = LRx2 (value,string,last)

where <value> is the double-precision integer to be read,
<string> is the string from which the number is to be read, and
<last> is to receive an index to the byte which delimited the number read.

The value returned is zero unless carry is returned set from the
number-reading routine, in which case -1 is returned.

The calling sequence is

	JSR	PC,LR$2
	.WORD	<address of routine to use to read number>

Return is made not to this call but to the original calling sequence.

[V4	1-Apr-83]
Bug fix for incorrect string address calculation.
		.Endc

LR$2::
	mov	4(r5),r1	;Address of string
	mov	@(sp),(sp)	;Move address of read routine to stack top
	call	@(sp)+
	mov	2(sp),r0	;Transfer value from R2,R3
	mov	r2,(r0)+
	mov	r3,(r0)
	call	lretc		;Set up R0 according to carry
	jmp	lr$adj		;Calculates value for <last>, and returns.
.end

LWADJ.MAC
.Title	LW$ADJ - (Fortran) Common pathways for string I/O
.nlist	bex,toc,sym
.enabl	lc

.Sbttl	V3	28-Jul-81	CVLLIB Routine

		.If eq 1
Provides a mechanism for Fortran routines with calling sequences
in the form
		CALL ROUTINE(value,string,last[,nplaces])

which after reading from or writing to <string>, need to calculate the byte
count to be added to <last>.

LW$ADJ - should be entered with a pointer to the routine to be used on the
		stack, and registers other than R1 (string pointer) already
		set up.  It sets up the string pointer, calls the routine,
		clears the next byte, then adjusts <last>.

LR$ADJ - purely sets the value for <last>.  R1 is altered, but R0
		may be used to return a value to the calling programme.
		.Endc

LW$ADJ::
	mov	4(r5),r1	;String pointer
	mov	@(sp),(sp)	;Get address of desired routine on to stack
	call	@(sp)+
	clrb	(r1)
LR$ADJ::
	sub	4(r5),r1	;Calculate length of used portion of string
	add	r1,@6(r5)
	return
.end

