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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	todayt,lretc,csvr,carg

		.If eq 1
Called by
		i = ctodat(&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


CTODAT::
	call	csvr
	mov	carg(sp),r2	;Dateblock address
	call	todayt
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.END

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	today,lretc,csvr,carg

		.If eq 1
Called by
		i = ctoday(&strpnt,&dateblock);

writes today's day and date (in the form "Sunday 4-Jan-81") to the string
pointed to in <strpnt>, which is advenced to point to the next free byte
(which is zeroed).  If no date was set up on the system, nothing is written
and the function returns -1.  Normally 0 is returned.

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


CTODAY::
	call	csvr
	mov	@carg(sp),r1	;String address
	mov	carg+2(sp),r2	;Dateblock address
	call	today
	mov	r1,@carg(sp)
	jmp	lretc		;Set up R0 depending upon carry
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wdayt

		.If eq 1
Called by
		cwdayt(int);

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

CWDAYT::
	mov	2(sp),r0
	jmp	wdayt
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	cw$adj,wday,csvr,carg

		.If eq 1
Called by
		cwdayt(&strpnt,int);

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

<strpnt> is advanced to point to the next free byte, which is cleared.
		.Endc

CWDAY::
	call	csvr
	mov	carg+2(sp),r0
	call	cw$adj
	.word	wday
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wsdatt,lretc,csvr,carg

		.If eq 1
Called by
		i = cwsdtt(&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

CWSDTT::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	mov	carg+2(sp),r0	;Flag
	call	wsdatt
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wsdat,lretc,csvr,carg

		.If eq 1
Called by
		i = cwsdat(&strpnt,&dateblock,flag);

puts the system date into the string pointed to in <strpnt> in the form
"3-Jan-81", leaving <strpnt> pointing to the next free byte, which has
been cleared.

<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

CWSDAT::
	call	csvr
	mov	@carg(sp),r1	;String address
	mov	carg+2(sp),r2	;Dateblock
	mov	carg+4(sp),r0	;Flag
	call	wsdat
	mov	r1,@carg(sp)
	jmp	lretc		;Set R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wdatt,csvr,carg

		.If eq 1
Called by
		cwdatt(&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

CWDATT::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	mov	carg+2(sp),r0	;Flag
	jmp	wdatt
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wdat,cw$adj,csvr,carg

		.If eq 1
Called by
		cwdat(&strpnt,&dateblock,flag);

Types the date from <dateblock> to the string.  <strpnt> is left pointing to
the next available byte, which is zeroed.

<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

CWDAT::
	call	csvr
	mov	carg+2(sp),r2	;Dateblock
	mov	carg+4(sp),r0	;Flag
	call	cw$adj
	.word	wdat
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rsdat,lretc,csvr,carg
		.If eq 1
Called by
		i = crsdat(&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

CRSDAT::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	call	rsdat
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rdatt,csvr,carg
		.If eq 1
Called by
		i = crdatt(&strpnt,&dateblock,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.
<strpnt> receives a pointer to the delimiting character.

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

CRDATT::
	call	csvr
	mov	carg+2(sp),r2	;Dateblock
	mov	carg+4(sp),r0	;Flag
	call	rdatt
	mov	r1,@carg(sp)	;Strpnt
	return
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rdat,csvr,carg

		.If eq 1
Called by
		i = crdatt(&strpnt,&dateblock,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.

<strpnt> is left pointing to the delimiter.

<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

CRDAT::
	call	csvr
	mov	@carg(sp),r1	;String
	mov	carg+2(sp),r2	;Dateblock
	mov	carg+4(sp),r0	;Flag
	call	rdat
	mov	r1,@carg(sp)
	return
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	datdif,lretc,csvr,carg
		.If eq 1
Called by
		i = cdtdif (&dateblock-1,&dateblock-2,&long);

Returns in 2.precis integer <long> 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


CDTDIF::
	call	csvr
	mov	carg(sp),r0	;First dateblock
	mov	carg+2(sp),r2	;Second dateblock
	call	datdif
	mov	carg+4(sp),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

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	datcal,lretc,csvr,carg
		.If eq 1
Called by
		i = cdtcal (&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

CDTCAL::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	call	datcal
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.END

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	age,lretc,csvr,carg
		.If eq 1
Called by
		i = cage (&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

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

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	iday,csvr,carg
		.If eq 1
Called by
		i = ciday(&dateblock);

returns -1 if the date were invalid, or 1-7 for Sunday through Saturday
respectively.
		.Endc

CIDAY::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	jmp	iday
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	crdatw,csvr,carg
		.If eq 1
Called by
		ccrdw(&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

CCRDW::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	jmp	crdatw
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	cwdatr,csvr,carg
		.If eq 1
Called by
		ccwdr(&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

CCWDR::
	call	csvr
	mov	carg(sp),r2	;Dateblock
	jmp	cwdatr
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wstimt,csvr,carg
		.If eq 1
Called by
		cwstmt (&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

CWSTMT::
	call	csvr
	mov	carg(sp),r2	;Timeblock
	mov	carg+2(sp),r0	;Flag
	jmp	wstimt
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	cw$adj,wstim,csvr,carg

		.If eq 1
Called by
		cwstim (&strpnt,&timeblock,flag);

puts the system time into the string in the form "hh:mm".
<strpnt> is left pointing to the next free byte, which has been cleared.
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

CWSTIM::
	call	csvr
	mov	carg+2(sp),r2	;Timeblock
	mov	carg+4(sp),r0	;Flag
	call	cw$adj		;Calls WSTIM after setting up R1, and
	.word	wstim		; sets up <strpnt>
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wtimt,csvr,carg
		.If eq 1
Called by
		cwtimt(&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

CWTIMT::
	call	csvr
	mov	carg(sp),r2	;Timeblock
	mov	carg+2(sp),r0	;Flag
	jmp	wtimt
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wtim,cw$adj,csvr,carg

		.If eq 1
Called by
		cwtim(&strpnt,&timeblock,flag)

writes the time from the <timeblock> to the string.  <strpnt> is left pointing
to the next free byte, which has been cleared.

<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

CWTIM::
	call	csvr
	mov	carg+2(sp),r2	;Timeblock
	mov	carg+4(sp),r0	;Flag
	call	cw$adj
	.word	wtim
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rstim,csvr,carg
		.If eq 1
Called by
		crstim(&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

CRSTIM::
	call	csvr
	mov	carg(sp),r2	;Timeblock
	jmp	rstim
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rtimt,lretc,csvr,carg

		.If eq 1
Called by
		i = crtimt(&strpnt,&timeblock);

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.

<strpnt> is set to point to the delimiting character.

Note - the TCLOCK offset in <timeblock> 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

CRTIMT::
	call	csvr
	mov	carg+2(sp),r2	;Timeblock
	call	rtimt
	mov	r1,@carg(sp)
	jmp	lretc		;Return 0 if CC, -1 if CS
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rtim,lretc,csvr,carg

		.If eq 1
Called by
		i = crtim(&strpnt,&timeblock);

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.

<strpnt> is left pointing to the delimiting character.

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

CRTIM::
	call	csvr
	mov	@carg(sp),r1	;String
	mov	carg+2(sp),r2	;Timeblock
	call	rtim
	mov	r1,@carg(sp)
	jmp	lretc		;Set up 0 if CC, -1 if CS
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	crtimw,csvr,carg
		.if eq 1
Called by
		ccrtw(&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

CCRTW::
	call	csvr
	mov	carg(sp),r2	;Timeblock
	jmp	crtimw
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	cwtimr,csvr,carg
		.If eq 1
Called by
		ccwtr(&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

CCWTR::
	call	csvr
	mov	carg(sp),r2	;Timeblock
	jmp	cwtimr
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	wft,csvr,carg

		.If eq 1
Called by
		cwft(&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

CWFT::
	call	csvr
	mov	carg(sp),r2	;Address of <block>
	mov	carg+2(sp),r0	;Value of <flags>
	jmp	wft
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	cw$adj,wf,csvr,carg

		.If eq 1
Called by
		cwf(&strpnt,&block,flags);

writes a filename in ascii to the 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

<strpnt> is returned pointing to the next (cleared) byte in the string.
		.Endc

CWF::
	call	csvr
	mov	carg+2(sp),r2	;Address of <block>
	mov	carg+4(sp),r0	;Value of <flags>
	call	cw$adj		;Call WF and set up <strpnt>
	.word	wf
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rfdt,lretc,csvr,carg

		.If eq 1
Called by
		i=crft(&strpnt,&block);

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

<strpnt> receives a pointer to the delimiting character.

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

CRFDT::
	call	csvr
	mov	carg+2(sp),r2	;<block> address
	call	rfdt
	mov	r1,@carg(r5)	;Terminating character pointer
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rfd,lretc,csvr,carg

		.If eq 1
Called by
		i=crfd(&strpnt,&block);

reads a filename from the 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

<strpnt> is returned pointing to the delimiter.

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

CRFD::
	call	csvr
	mov	@carg(sp),r1	;string address
	mov	carg+2(sp),r2	;<block> address
	call	rfd
	mov	r1,@carg(sp)
	call	lretc		;Return R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rft,lretc,csvr,carg

		.If eq 1
Called by
		i=crft(&strpnt,&block);

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

<strpnt> receives a pointer to the delimiter.

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

CRFT::
	call	csvr
	mov	carg+2(sp),r2	;<block> address
	call	rft
	mov	r1,@carg(sp)	;Terminating character
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	rf,lretc,csvr,carg

		.If eq 1
Called by
		i=crf(&strpnt,&block);

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

CRF::
	call	csvr
	mov	@carg(sp),r1	;string address
	mov	carg+2(sp),r2	;<block> address
	call	rf
	mov	r1,@carg(sp)
	jmp	lretc		;Return R0/-1 if CS, 0 if CC
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	w50ft

		.If eq 1
Called by
		cw50ft(value);

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

CW50FT::
	mov	2(sp),r0
	jmp	w50ft
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	w50f,cw$adj,csvr,carg
		.If eq 1
Called by
		cw50f(&strpnt,value);

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

CW50F::
	call	csvr
	mov	carg+2(sp),r0	;Value
	call	cw$adj
	.word	w50f
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	w50t

		.If eq 1
Called by
		cw50t(value);

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

CW50T::
	mov	2(sp),r0
	jmp	w50t
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	w50,cw$adj,csvr,carg
		.If eq 1
Called by
		cw50(&strpnt,value);

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

CW50::
	call	csvr
	mov	carg+2(sp),r0	;Value
	call	cw$adj
	.word	w50
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50st,r50s,lretc

		.If eq 1
Called by
		cr50st(&strpnt,&int);

returns 3 radix50 characters in <int>, leaving <strpnt> pointing to
the delimiter.

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.
		.Endc

CR50ST::
	call	r50st		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up R0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50s,lretc

		.If eq 1
Called by
		i=cr50s(&strpnt,&int);

returns 3 radix50 characters in <int>, leaving <strpnt> pointing to
the delimiter.

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.

		.Endc

CR50S::
	mov	@2(sp),r1	;Address of <string>
	call	r50s		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up R0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50ft,r50f,lretc

		.If eq 1
Called by
		cr50ft(&strpnt,&int);

returns 3 radix50 characters in <int>, leaving <strpnt> pointing to
the delimiter.

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.
		.Endc

CR50FT::
	call	r50ft		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up R0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50f,lretc

		.If eq 1
Called by
		i=cr50f(&strpnt,&int);

returns 3 radix50 characters in <int>, leaving <strpnt> pointing to the
delimiter.

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.
		.Endc

CR50F::
	mov	@2(sp),r1	;Address of <string>
	call	r50f		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up R0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50t,r50,lretc

		.If eq 1
Called by
		cr50t(&strpnt,&int);

returns 3 radix50 characters in <int>, leaving <strpnt> pointing to
the delimiter.

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.
		.Endc

CR50T::
	call	r50t		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up r0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	r50,lretc

		.If eq 1
Called by
		i=cr50(&strpnt,&int);

returns 3 radix50 characters in the word <int>, leaving strpnt pointing to
the delimiter.

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.
		.Endc

CR50::
	mov	@2(sp),r1	;Address of <string>
	call	r50		;Read up to 3 rad50 characters from terminal
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc		;Set up R0 depending upon carry.
.end

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	ca50

		.If eq 1
Called by
		i=cca50(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 "*", and the "%" character is treated as ".".
		.Endc

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

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

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	c50a

		.If eq 1
Called by
		i=cc50a(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

CC50A::
	movb	2(sp),r0
	call	c50a
	bcc	10$
	mov	#-1,r0
10$:	return
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wm3pt,wm3dpt,csvr,carg

		.If eq 1
Called by
		CWM3PT(&value,nplaces);
	or	CWM3DX(&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.

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

CWM3DX::
	call	csvr
	mov	carg(sp),r0	;Address of <value>
	mov	carg+2(sp),r2	;Number of places
	jmp	wm3dpt
CWM3PT::
	call	csvr
	mov	carg(sp),r0
	mov	carg+2(sp),r2
	jmp	wm3pt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wm3t,wm3dt

		.If eq 1
Called by
		CWM3T (&value);
	or	CWM3DT(&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

CWM3DT - Provides a leading dollar sign
CWM3T - No leading dollar.
		.Endc

CWM3DT::
	mov	2(sp),r0	;Address of <value>
	jmp	wm3dt
CWM3T::
	mov	2(sp),r0
	jmp	wm3t
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,wm3p,wm3dp,csvr,carg

		.If eq 1
Called by
		CWM3P (&strpnt,&value,nplaces)
	or	CWM3DP(&strpnt,&value,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.

CWM3DP - Provides a leading dollar sign
CWM3P - No leading dollar.
		.Endc

CWM3DP::
	call	csvr
	mov	carg+2(sp),r0	;Address of <value>
	mov	carg+4(sp),r2	;Number of places
	call	cw$adj
	.word	wm3dp
CWM3P::
	call	csvr
	mov	carg+2(sp),r0
	mov	carg+4(sp),r2
	call	cw$adj
	.word	wm3p
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,wm3,wm3d,csvr,carg

		.If eq 1
Called by
		CWM3 (&strpnt,&value);
	or	CWM3D(&strpnt,&value);

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

CWM3D - Provides a leading dollar sign
CWM3 - No leading dollar.
		.Endc

CWM3D::
	call	csvr
	mov	carg+2(sp),r0	;Address of <value>
	call	cw$adj
	.word	wm3d
CWM3::
	call	csvr
	mov	carg+2(sp),r0
	call	cw$adj
	.word	wm3
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rm3t,lretc

		.If eq 1
Called by
		i = crm3t(@strpnt,&value);

reads a value in dollars & cents (eg $123.45) from the terminal, returning
a triple-precision integer value in cents in <value>, and a pointer to the
delimiter in <strpnt>.

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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rm3,lretc

		.If eq 1
Called by
		i = crm3(&strpnt,&value);

reads a value in dollars & cents (eg $123.45) from the string, returning
a triple-precision integer value in cents in <value>.
<strpnt> is left pointing to the delimiter.

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

CRM3::
	mov	4(sp),r0	;Address of <value>
	mov	@2(sp),r1	;String address
	call	rm3
	mov	r1,@2(sp)
	jmp	lretc		;Set R0 according to carry
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wd3pt,csvr,carg

		.If eq 1
Called by
		CWD3PT(&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

CWD3PT::
	call	csvr
	mov	carg(sp),r0	;Address of <value>
	mov	carg+2(sp),r2	;Number of places to occupy
	jmp	wd3pt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wd3t

		.If eq 1
Called by
		CWD3T(&value);

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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,wd3p,csvr,carg

		.If eq 1
Called by
		CWD3P(&strpnt,&value,nplaces)

writes 3 words from <value> as a triple-precision signed integer to the
string.  <strpnt> is returned pointing to the delimiter.

<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

CWD3P::
	call	csvr
	mov	carg+2(sp),r0	;Address of <value>
	mov	carg+4(sp),r2	;Number of places to occupy
	call	cw$adj
	.word	wd3p
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,wd3,csvr,carg

		.If eq 1
Called by
		CWD3(&strpnt,&value);

writes 3 words from <value> as a triple-precision signed integer to the
string.  <strpnt> is returned pointing to the delimiter.
		.Endc

CWD3::
	call	csvr
	mov	carg+2(sp),r0	;Address of <value>
	call	cw$adj
	.word	wd3
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rd3t,lretc

		.If eq 1
Called by
		i = crd3t(&strpnt,&value);

reads a triple-precision signed integer from the user's terminal into the
three locations starting at <value>.  <strpnt> is returned pointing to the
delimiter.

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

CRD3T::
	mov	4(sp),r0
	call	rd3t
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rd3,lretc

		.If eq 1
Called by
		i = crd3(&strpnt,&value);

reads a triple-precision signed integer from the string into the
three locations starting at <value>.  <strpnt> is returned pointing to
the delimiter.

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

CRD3::
	mov	@2(sp),r1	;String
	mov	4(sp),r0	;Address of number to be read
	call	rd3
	mov	r1,@2(sp)
	jmp	lretc		;Set R0 according to carry
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	mul31,lretc,csvr,carg

		.If eq 1
Called by
		i=CMUL31(&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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	mul33,lretc,csvr,carg

		.If eq 1
Called by
	   i = CMUL33(&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

CMUL33::
	call	csvr
	mov	carg(sp),r0
	mov	carg+2(sp),r2
	mov	carg+4(sp),r3
	call	mul33
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	div31,lretc,csvr,carg

		.If eq 1
Called by

   i = CDIV31(&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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	div33,lretc,csvr,carg

		.If eq 1
Called by

   i = CDIV33(&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

CDIV33::
	call	csvr
	mov	carg(sp),r0	;Transfer dividend to quotient locs
	mov	carg+4(sp),r2
	mov	(r0)+,(r2)+	; as DIV33 stores in its dividend locs
	mov	(r0)+,(r2)+
	mov	(r0),(r2)
	cmp	-(r2),-(r2)

	mov	carg+2(sp),r1
	mov	carg+6(sp),r0	;Similarly divisor & remainder
	mov	(r1)+,(r0)+
	mov	(r1)+,(r0)+
	mov	(r1),(r0)
	cmp	-(r0),-(r0)

	call	div33
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cmp3,csvr,carg

		.If eq 1
Called by
		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

CCMP3::
	call	csvr
	mov	#-1,r1
	mov	carg(sp),r0
	mov	carg+2(sp),r2
	call	cmp3
	blt	20$
	beq	10$
	inc	r1
10$:	inc	r1
20$:	mov	r1,r0
	return
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	csvr,carg
		.If eq 1
Called by
		i = cadd3(&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

CADD3::
	call	csvr
	clr	r0		;For returning overflow
	mov	carg(sp),r1	;First Argument
	mov	(r1)+,r2	;Highest order word
	mov	(r1)+,r3
	mov	(r1),r4
	mov	carg+2(sp),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	carg+4(sp),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)+
	mov	r4,(r1)

	return	
.END

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	csvr,carg
		.If eq 1
Called by
		i = csub3(&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

CSUB3::
	call	csvr
	clr	r0		;For returning overflow
	mov	carg+2(sp),r1	;Second Argument - Subtrahend
	mov	(r1)+,r2	;Highest order word
	mov	(r1)+,r3
	mov	(r1),r4
	mov	carg(sp),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	carg+4(sp),r1	;Address of third argument
	mov	r2,(r1)+
	mov	r3,(r1)+
	mov	r4,(r1)

	return	
.END

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	neg3

		.If eq 1
Called by
		CNEG3(&triplevalue);

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

CNEG3::
	mov	2(sp),r0
	jmp	neg3
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

		.If eq 1
Called by
		CMOV3(&3value-1,&3value-2);

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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2pt,wmpt,wmdpt,csvr,carg

		.If eq 1
Called by
		CWMPT (long,nplaces);
	or	CWMDPT(long,nplaces);

writes <long> 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.

CWMDPT - Provides a leading dollar sign
CWMPT  - No leading dollar
		.Endc

CWMDPT::
	call	csvr
	call	cw$2pt
	.word	wmdpt
CWMPT::
	call	csvr
	call	cw$2pt
	.word	wmpt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2t,wmt,wmdt,csvr,carg

		.If eq 1
Called by
		CWMT (long);
	or	CWMDT(long);

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

CWMDT - Provides a leading dollar sign
CWMT  - No leading dollar
		.Endc

CWMDT::
	call	csvr
	call	cw$2t
	.word	wmdt
CWMT::
	call	csvr
	call	cw$2t
	.word	wmt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2p,wmp,wmdp,csvr,carg

		.If eq 1
Called by
		CWMP (@strpnt,value,nplaces);
	or	CWMDP(@strpnt,value,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.

<strpnt> is returned pointing to the terminating null.

CWMDP - Provides a leading dollar sign
CWMP  - No leading dollar
		.Endc

CWMDP::
	call	csvr
	call	cw$2p
	.word	wmdp
CWMP::
	call	csvr
	call	cw$2p
	.word	wmp
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2,wm,wmd,csvr,carg

		.If eq 1
Called by
		CWM (&strpnt,value);
	or	CWMD(&strpnt,value);

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

<strpnt> is left pointing to the terminating null.

CWMD - Provides a leading dollar sign
CWM  - No leading dollar
		.Endc

CWMD::
	call	csvr
	call	cw$2
	.word	wmd
CWM::
	call	csvr
	call	cw$2
	.word	wm
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2t,rmt,csvr,carg

		.If eq 1
Called by
		i = CRMT(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.  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

CRMT::
	call	csvr
	call	cr$2t
	.word	rmt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2,rm,csvr,carg

		.If eq 1
Called by
		i = CRM(&strpnt,&value);

returns a double-length integer value in <value>.  <strpnt> is returned
pointing to the delimiting characer.

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

CRM::
	call	csvr
	call	cr$2
	.word	rm
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2pt,wd2pt,csvr,carg

		.If eq 1
Called by
		CWD2PT(long,nplaces);

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

CWD2PT::
	call	csvr
	call	cw$2pt
	.word	wd2pt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2t,wd2t,csvr,carg

		.If eq 1
Called by
		CWD2T(long);

writes <long> to the terminal as a double-precision signed decimal number.
		.Endc

CWD2T::
	call	csvr
	call	cw$2t
	.word	wd2t
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2p,wd2p,csvr,carg

		.If eq 1
Called by
		CWD2P(&strpnt,long,nplaces);

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

<strpnt> is returned pointing to the terminating null.
		.Endc

CWD2P::
	call	csvr
	call	cw$2p
	.word	wd2p
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2,wd2,csvr,carg

		.If eq 1
Called by
		CWD2(&strpnt,long);

where <long> is to be written to the string as a double-precision signed
decimal number.

<strpnt> is returned pointing to the terminating null.
		.Endc

CWD2::
	call	csvr
	call	cw$2
	.word	wd2
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2pt,w82spt,csvr,carg

		.If eq 1
Called by
		CW82SX(long,nplaces);

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

CW82SX::
	call	csvr
	call	cw$2pt
	.word	w82spt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2pt,w82pt,csvr,carg

		.If eq 1
Called by
		CW82PT(long,nplaces);

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

CW82PT::
	call	csvr
	call	cw$2pt
	.word	w82pt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2t,w82st,csvr,carg

		.If eq 1
Called by
		CW82ST(long);

writes <long> to the terminal as a signed double precision octal number.
		.Endc

CW82ST::
	call	csvr
	call	cw$2t
	.word	w82st
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2t,w82t,csvr,carg

		.If eq 1
Called by
		CW82T(long);

writes <long> to the terminal as an unsigned double precision octal number.
		.Endc

CW82T::
	call	csvr
	call	cw$2t
	.word	w82t
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2p,w82sp,csvr,carg

		.If eq 1
Called by
		CW82SP(&strpnt,long,nplaces);

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

<strpnt> is returned pointing to the terminating null.
		.Endc

CW82SP::
	call	csvr
	call	cw$2p
	.word	w82sp
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2p,w82p,csvr,carg

		.If eq 1
Called by
		CW82P(&strpnt,long,nplaces);

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

<strpnt> is returned pointing to the terminating null.
		.Endc

CW82P::
	call	csvr
	call	cw$2p
	.word	w82p
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2,w82s,csvr,carg

		.If eq 1
Called by
		CW82S(&strpnt,long);

where <long> is to be written to the string as a double precision signed
octal number.

<strpnt> is returned pointing to the terminating null.
		.Endc

CW82S::
	call	csvr
	call	cw$2
	.word	w82s
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$2,w82,csvr,carg

		.If eq 1
Called by
		CW82(&strpnt,long);

where <long> is to be written to the string as an unsigned double precision
octal number.

<strpnt> is returned pointing to the terminating null.
		.Endc

CW82::
	call	csvr
	call	cw$2
	.word	w82
.end

CWH2PT.MAC
.Title	CWH2PT - (C) 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	cw$2pt,wh2pt,whl2pt,csvr,carg

		.If eq 1
Called by
		CWH2PT(long,nplaces);
or		CWHL2X(long,nplaces);

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

Two entry points are provided:	CWH2PT which uses upper case letters A-F, and
				CWHL2X which uses lower case.
		.Endc

CWH2PT::
	call	csvr
	call	cw$2pt
	.word	wh2pt

CWHL2X::
	call	csvr
	call	cw$2pt
	.word	whl2pt
.end

CWH2T.MAC
.Title	CWH2T - (C) 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	cw$2t,wh2t,whl2t,csvr,carg

		.If eq 1
Called by
		CWH2T(long);

writes <long> to the terminal as an unsigned double precision hex number.

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

CWH2T::
	call	csvr
	call	cw$2t
	.word	wh2t

CWHL2T::
	call	csvr
	call	cw$2t
	.word	wh2t
.end

CWH2P.MAC
.Title	CWH2P - (C) 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	cw$2p,wh2p,whl2p,csvr,carg

		.If eq 1
Called by
		CWH2P(&strpnt,long,nplaces);

where <long> is to be written to the string as an unsigned double precision
octal number, to a minimum of <nplaces> characters, right-justified, filled
with spaces.
<strpnt> is returned pointing to the terminating null.

Two entry points are provided:	CWH2P which uses upper case A-F, and
				CWHL2P which uses lower case.
		.Endc

CWH2P::
	call	csvr
	call	cw$2p
	.word	wh2p

CWHL2P::
	call	csvr
	call	cw$2p
	.word	whl2p
.end

CWH2.MAC
.Title	CWH2 - (C) 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	cw$2,wh2,whl2,csvr,carg

		.If eq 1
Called by
		CWH2(&strpnt,long);

where <long> is to be written to the string as an unsigned double precision
octal number.
<strpnt> is returned pointing to the terminating null.

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

CWH2::
	call	csvr
	call	cw$2
	.word	wh2

CWHL2::
	call	csvr
	call	cw$2
	.word	whl2
.end

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

.psect	cvllib

.Sbttl	V1	7-May-83	CVLLIB Routine

.globl	csvr,cr$2t,rn2t

		.If eq 1
Called by
		i = CRN2T(&strpnt,&long);

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

<strpnt> receives a pointer to the delimiter.

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

CRN2T::
	call	csvr
	call	cr$2t
	.word	rn2t
.end

CRN2.MAC
.Title	CRN2 - (C) Read 2/precis number (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	csvr,cr$2,rn2

		.If eq 1
Called by
		i = CRN2(&strpnt,&long);

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

The number is read from the string of ascii characters pointed to by strpnt,
which is left pointing to the delimiter.

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

CRN2::
	call	csvr
	call	cr$2
	.word	rn2
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2t,rd2st,csvr,carg

		.If eq 1
Called by
		i = CRD2ST(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.

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

CRD2ST::
	call	csvr
	call	cr$2t
	.word	rd2st
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2t,rd2t,csvr,carg

		.If eq 1
Called by
		i = CRD2T(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.

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

CRD2T::
	call	csvr
	call	cr$2t
	.word	rd2t
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2,rd2s,csvr,carg

		.If eq 1
Called by
		i = CRD2S(&strpnt,&long);

returns a double-length integer value in <long>.
<strpnt> is returned pointing to 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

CRD2S::
	call	csvr
	call	cr$2
	.word	rd2s
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2,rd2,csvr,carg

		.If eq 1
Called by
		i = CRD2(&strpnt,&long);

returns a double-length integer value in <value>.
<strpnt> is returned pointing to 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

CRD2::
	call	csvr
	call	cr$2
	.word	rd2
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2t,r82st,csvr,carg

		.If eq 1
Called by
		i = CR82ST(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.

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

CR82ST::
	call	csvr
	call	cr$2t
	.word	r82st
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2t,r82t,csvr,carg

		.If eq 1
Called by
		i = CR82T(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.

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

CR82T::
	call	csvr
	call	cr$2t
	.word	r82t
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2,r82s,csvr,carg

		.If eq 1
Called by
		i = CR82S(&strpnt,&long);

returns a double-length integer value in <value>.
<strpnt> is returned pointing to the delimiter.

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

CR82S::
	call	csvr
	call	cr$2
	.word	r82s
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$2,r82,csvr,carg

		.If eq 1
Called by
		i = CR82(&strpnt,&long);

returns a double-length integer value in <value>.
<strpnt> is returned pointing to the delimiter.

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

CR82::
	call	csvr
	call	cr$2
	.word	r82
.end

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

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	cr$2t,rh2t,csvr,carg

		.If eq 1
Called by
		i = CRH2T(&strpnt,&long);

returns a double-length integer value in <long> and a pointer to the
delimiting character in <strpnt>.

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

CRH2T::
	call	csvr
	call	cr$2t
	.word	rh2t
.end

CRH2.MAC
.Title	CRH2 - (C) 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	cr$2,rh2,csvr,carg

		.If eq 1
Called by
		i = CRH2(&strpnt,&long);

returns a double-length integer value in <value>.
<strpnt> is returned pointing to the delimiter.

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

CRH2::
	call	csvr
	call	cr$2
	.word	rh2
.end

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

.psect	cvllib

.Sbttl	V1	31-Mar-86	CVLLIB Routine

.globl	wdspt,csvr,carg
		.If eq 1
Called by
		CWDSPT(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

CWDSPT::
	call	csvr
	mov	carg(sp),r0	;<number>
	mov	carg+2(sp),r2	;<nplaces>
	jmp	wdspt
.end

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

.psect	cvllib

.Sbttl	V2	31-Mar-86	CVLLIB Routine
;Change to unsigned output
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wdpt,csvr,carg
		.If eq 1
Called by
		CWDPT(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

CWDPT::
	call	csvr
	mov	carg(sp),r0	;<number>
	mov	carg+2(sp),r2	;<nplaces>
	jmp	wdpt
.end

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

.psect	cvllib

.Sbttl	V1	31-Mar-86	CVLLIB Routine

.globl	wdst
		.If eq 1
Called by
		CWDST(number);

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

CWDST::
	mov	2(sp),r0
	jmp	wdst
.end

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

.psect	cvllib

.Sbttl	V2	31-Mar-86	CVLLIB Routine
;Make unsigned
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	wdt
		.If eq 1
Called by
		CWDT(number);

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

CWDT::
	mov	2(sp),r0
	jmp	wdt
.end

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

.psect	cvllib

.Sbttl	V1	31-Mar-86	CVLLIB Routine

.globl	cw$p,wdsp,csvr,carg
		.If eq 1
Called by
		CWDSP(&strpnt,number,nplace);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null, and <nplace> is the minimum number of
places (left padded with spaces if necessary) to be filled.
		.Endc

CWDSP::
	call	csvr
	call	cw$p
	.word	wdsp
.end

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

.psect	cvllib

.Sbttl	V2	31-Mar-86	CVLLIB Routine
;Make unsigned
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$p,wdp,csvr,carg
		.If eq 1
Called by
		CWDP(&strpnt,number,nplace);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null, and <nplace> is the minimum number of
places (left padded with spaces if necessary) to be filled.
		.Endc

CWDP::
	call	csvr
	call	cw$p
	.word	wdp
.end

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

.psect	cvllib

.Sbttl	V1	31-Mar-86	CVLLIB Routine

.globl	cw$adj,wds,csvr,carg
		.If eq 1
Called by
		CWDS(&strpnt,number);

Where <number> is the number to be converted into a string, and <strpnt>
points to the starting position into which data is to be written, and is
returned pointing to the terminating null.
		.Endc

CWDS::
	call	csvr
	mov	carg+2(sp),r0	;Number
	call	cw$adj
	.word	wds
.end

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

.psect	cvllib

.Sbttl	V2	31-Mar-86	CVLLIB Routine
;Make unsigned
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,wd,csvr,carg
		.If eq 1
Called by
		CWD(&strpnt,number);

Where <number> is the number to be converted into a string, and <strpnt>
points to the starting position into which data is to be written, and is
returned pointing to the terminating null.
		.Endc

CWD::
	call	csvr
	mov	carg+2(sp),r0	;Number
	call	cw$adj
	.word	wd
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	w8spt,csvr,carg
		.If eq 1
Called by
		CW8SPT(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

CW8SPT::
	call	csvr
	mov	carg(sp),r0	;<number>
	mov	carg+2(sp),r2	;<nplaces>
	jmp	w8spt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	w8pt,csvr,carg
		.If eq 1
Called by
		CW8PT(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

CW8PT::
	call	csvr
	mov	carg(sp),r0	;<number>
	mov	carg+2(sp),r2	;Number of places.
	jmp	w8pt
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr=83	CVLLIB Routine

.globl	w8st
		.If eq 1
Called by
		CW8ST(number);

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

CW8ST::
	mov	2(sp),r0
	jmp	w8st
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	w8t
		.If eq 1
Called by
		CW8T(number);

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

CW8T::
	mov	2(sp),r0
	jmp	w8t
.end

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

.psect	cvllib

.Sbttl	V3	3-Apr-83	CVLLIB Routine

.globl	cw$p,w8sp,csvr,carg
		.If eq 1
Called by
		CW8SP(&strpnt,number,nplace);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null, and <nplace> is the minimum number of places
(left padded with spaces if necessary) to be filled.
		.Endc

CW8SP::
	call	csvr
	call	cw$p
	.word	w8sp
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$p,w8p,csvr,carg
		.If eq 1
Called by
		CW8P(&strpnt,number,nplace);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null, and <nplace> is the minimum number of places
(left padded with spaces if necessary) to be filled.
		.Endc

CW8P::
	call	csvr
	call	cw$p
	.word	w8p
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,w8s,csvr,carg
		.If eq 1
Called by
		CW8S(&strpnt,number);

Where <number> is the number to be converted into a string, and <strpnt> is a
pointer to the starting position into which data is to be written, and is
returned pointing to the terminating null.
		.Endc

CW8S::
	call	csvr
	mov	carg(sp),r0	;Number
	call	cw$adj
	.word	w8s
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,w8,csvr,carg
		.If eq 1
Called by
		CW8(&strpnt,number);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null.
		.Endc

CW8::
	call	csvr
	mov	carg(sp),r0	;Number
	call	cw$adj
	.word	w8
.end

CWHPT.MAC
.Title	CWHPT - (C) 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,csvr,carg
		.If eq 1
Called by
		CWHPT(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:	CWHPT uses upper case letters A-F, and
				CWHLPT uses lower case.
		.endc

CWHPT::
	call	csvr
	mov	carg(sp),r0	;<number>
	mov	carg+2(sp),r2	;Number of places.
	jmp	whpt

CWHLPT::
	call	csvr
	mov	carg(sp),r0
	mov	carg+2(sp),r2
	jmp	whlpt

.end

CWHT.MAC
.Title	CWHT - (C) 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,csvr,carg
		.If eq 1
Called by
		CWHT(number);

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

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

CWHT::
	call	csvr
	mov	carg(sp),r0
	jmp	wht

CWHLT::
	call	csvr
	mov	carg(sp),r0
	jmp	whlt
.end

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

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	cw$p,whp,whlp,csvr,carg

		.If eq 1
Called by
		CWHP(&strpnt,number,nplace);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null, and <nplace> is the minimum number of places
(left padded with spaces if necessary) to be filled.

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

CWHP::
	call	csvr
	call	cw$p
	.word	whp

CWHLP::
	call	csvr
	call	cw$p
	.word	whlp
.end

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

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	cw$adj,wh,whl,csvr,carg

		.If eq 1
Called by
		CWH(&strpnt,number);

Where <number> is the number to be converted into a string, <strpnt> points to
the starting position into which data is to be written, and is returned
pointing to the terminating null.

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

CWH::
	call	csvr
	mov	carg(sp),r0	;Number
	call	cw$adj
	.word	wh

CWHL::
	call	csvr
	mov	carg(sp),r0
	call	cw$adj
	.word	wh

.end

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

.psect	cvllib

.Sbttl	V1A	15-Apr-83	CVLLIB Routine
;Include hex
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rnt,lretc
		.If eq 1
Called by
		i = CRNT(&strpnt,&value);

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

<strpnt> receives a pointer to the delimiter.

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

CRNT::
	call	rnt
	mov	r0,@4(sp)	;Value returned.
	mov	r1,@2(sp)	;Pointer to delimiter.
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1A	15-Apr-83	CVLLIB Routine
;Include hex
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$,rn,csvr,carg
		.If eq 1
Called by
		i = CRN(&strpnt,&value);

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 pointed to by strpnt,
which is left pointing to the delimiter.

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

CRN::
	call	csvr
	call	cr$
	.word	rn
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rdst,lretc
		.If eq 1
Called by
		i = CRDST(&strpnt,&number);

Where <number> is the number returned, and <strpnt> points to 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

CRDST::
	call	rdst
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	rdt,lretc
		.If eq 1
Called by
		i = CRDT(&strpnt,&number);

Where <number> is the number returned, and <strpnt> receives a pointer to
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

CRDT::
	call	rdt
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$,rds,csvr,carg
		.If eq 1
Called by
		i = CRDS(&strpnt,&number);

Where <number> receives the number read, and <strpnt> points to the
string to be decoded (and is returned pointing to the delimiter).

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

CRDS::
	call	csvr
	call	cr$
	.word	rds
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$,rd,csvr,carg
		.If eq 1
Called by
		i = CRD(&strpnt,&number);

Where <number> receives the number read, and <strpnt> points to the string
to be decoded (and is returned pointing to the delimiter).

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

CRD::
	call	csvr
	call	cr$
	.word	rd
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	r8st,lretc
		.If eq 1
Called by
		i = CR8ST(&strpnt,&number);

Where <number> is the number returned, and <strpnt> receives a pointer to
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

CR8ST::
	call	r8st
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	r8t,lretc
		.If eq 1
Called by
		i = CR8T(&strpnt,&number);

Where <number> is the number returned, and <strpnt> receives a pointer to
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

CR8T::
	call	r8t
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$,r8s,csvr,carg
		.If eq 1
Called by
		i = CR8S(&strpnt,&number);

Where <number> receives the number read, <strpnt> points to the string to be
decoded and returns containing a pointer to 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

CR8S::
	call	csvr
	call	cr$
	.word	r8s
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cr$,r8,csvr,carg
		.If eq 1
Called by
		i = CR8(&strpnt,&number);

Where <number> receives the number read, <strpnt> points to the string to be
decoded and is returned pointing to 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

CR8::
	call	csvr
	call	cr$
	.word	r8
.end

CRHT.MAC
.Title	CRHT - (C) read unsigned octal 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
		i = CRHT(&strpnt,&number);

Where <number> is the number returned, and <strpnt> receives a pointer to
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

CRHT::
	call	rht
	mov	r0,@4(sp)
	mov	r1,@2(sp)
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	15-Apr-83	CVLLIB Routine

.globl	cr$,rh,csvr,carg
		.If eq 1
Called by
		i = CRH(&strpnt,&number);

Where <number> receives the number read, <strpnt> points to the string to be
decoded and is returned pointing to 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

CRH::
	call	csvr
	call	cr$
	.word	rh
.end

CWAT.MAC
.Title	CWAT - (C) 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

		CWAT(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

CWAT::
	movb	2(sp),r0	;character
	jmp	wat
.end

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

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

.globl	wa,cw$adj,csvr,carg
			.If eq 1
Called by

		CWA(&strpnt,character);

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+x>", "<200+<bel=7>>".

<strpnt> is left pointing to the terminating null.
				.Endc

CWA::
	call	csvr
	movb	carg+2(sp),r0	;character
	call	cw$adj
	.word	wa
.end

CW2T.MAC
.Title	CW$2T - (C) Common pathway for CWx2T or CWx2PT
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1a	28-Jan-86	CVLLIB Routine
;Correct <JMP @(SP)+> to <MOV @(SP)+,PC>
.Sbttl	V1	3-Apr-83	CVLLIB Routine

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

	CWx2T  (long)
or	CWx2PT (long,nplaces)

where <long> 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 register saving routine CSVR should have been called before calling
this routine.

The calling sequence is

	CALL	CWx2T  (or CWx2PT)
	.WORD	<address of routine to use to print number>

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

CW$2PT::
	mov	carg+6(sp),r0	;Number of places to occupy
CW$2T::
	mov	carg+2(sp),r2	;Get double-precision value in R2,R3
	mov	carg+4(sp),r3
	mov	@(sp)+,pc	;Call routine specified.
.end

CW2.MAC
.Title	CW$2 - (C) Common pathway for CWx2 and CWx2P
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,carg

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

	CWx2 (@strpnt,long);
or	CWx2P(@strpnt,long,nplaces);

where <long> is the double-precision integer to be printed,
<strpnt> points to the string into which it is to be assembled, and
<nplaces> is the minimum number of places (right-justified, filled with
spaces) for it to occupy.

The register saving routine CSVR should have been called before calling
this routine.

The calling sequence is

	CALL	CW$2  (or CW$2P)
	.WORD	<address of routine to use to print number>

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

CW$2P::
	mov	carg+10(sp),r0	;Number of places
CW$2::
	mov	carg+4(sp),r2	;Get double-precision value in R2,R3
	mov	carg+6(sp),r3
	jmp	cw$adj		;Routine which calls required sequence and
				; sets up <strpnt>
.end

CWP.MAC
.Title	CW$P - (C) Common pathway for CWxP
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	cw$adj,carg

		.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

	CWxP (@strpnt,value,nplaces);

where <value> is the single-precision integer to be printed,
<strpnt> points to the string into which it is to be assembled, and
<nplaces> is the minimum number of places (right-justified, filled with
spaces) for it to occupy.

The register saving routine CSVR should have been called before this
routine.

The calling sequence is

	CALL	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

CW$P::
	mov	carg+4(sp),r0	;Value to be printed
	mov	carg+6(sp),r2	;Number of places to occupy
	jmp	cw$adj		;Routine which calls required sequence and
				; calculates the value for <last>.
.end

CR.MAC
.Title	CR$ - (C) Common pathway for CRx
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	lretc,carg

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

	i = CRx (&strpnt,&value);

where <value> is the single-precision integer to be read, and
<strpnt> points to the string from which the number is to be 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 register saving routine CSVR should have been called before this
routine.

The calling sequence is

	CALL	CR$
	.WORD	<address of routine to use to read number>

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

CR$::
	mov	@carg+2(sp),r1	;Address of string
	mov	@(sp),(sp)	;Move address of read routine to stack top
	call	@(sp)+
	mov	r0,@carg+2(sp)	;Return value.
	mov	r1,@carg(sp)	; and string pointer.
	jmp	lretc		;Set up R0 according to carry
.end

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

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

		.If eq 1
Called by
		long=CC12(single);

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

CC12::
	clr	r0		;High order word
	mov	@2(sp),r1	;Single word - low order bits
	bpl	10$		;If negative, extend sign.
	dec	r0
10$:	return
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	c13,csvr,carg

		.If eq 1
Called by
		CC13(single,&triple);

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

CC13::
	call	csvr
	mov	carg(sp),r0	;Single
	mov	carg+2(sp),r2	;Address of triple
	jmp	c13
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	c23,csvr,carg

		.If eq 1
Called by
		CC23(double,&triple);

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

CC23::
	call	csvr
	mov	carg(sp),r2	;High order word
	mov	carg+2(sp),r3	;Low order word
	mov	carg+4(sp),r0	;Address of <triple>
	jmp	c23
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	c32,lretc,csvr,carg

		.If eq 1
Called by
		i = CC32(&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

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

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	c31,lretc,csvr,carg

		.If eq 1
Called by
		i = CC31(&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

CC31::
	call	csvr
	mov	carg(sp),r2	;Address of <triple>
	call	c31
	mov	r0,carg+4(sp)	;Single
	jmp	lretc		;Return R0 according to carry bit
.end

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

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

.globl	c21,lretc,csvr,carg

		.If eq 1
Called by
		i = CC21(long,&int);

converts the double-precision integer in <long> (high-order word first)
to a single-precision integer in <int>.  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

CC21::
	call	csvr
	mov	carg(sp),r2	;High order long
	mov	carg+2(sp),r3	;Low order long
	call	c21
	mov	r0,@carg+4(sp)
	jmp	lretc		;Return R0 depending on carry bit
.end

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

.psect	cvllib

.Sbttl	V2	18-Apr-83	CVLLIB Routine

.globl	scg
		.If eq 1
Called by

	i = CSCG(&string1,&string2,&integer);

compares the strings <string1> and <string2>
returning the value

	-1	if the first string < the second string
	0	if the first string = the second string
and	1	if the first string > the second string.

<Integer> receives the last character compared in <string2>, trimmed to
7 bits.  If the strings exactly match, this will be zero.

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


CSCG::
	mov	#-1,-(sp)	;For returned value
	mov	2(sp),r0	;Address of first string
	mov	4(sp),r1	;Address of second string
	call	scg
	blt	20$
	beq	10$
	inc	(sp)		;greater than - return 1
10$:	inc	(sp)		;equal        - return 0
20$:				;less than    - return -1
	movb	(r1),@6(sp)
	bic	#^c177,@6(sp)	;Terminating character.
	mov	(sp)+,r0
	return
.end

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

.psect	cvllib

.Sbttl	V2	18-Apr-83	CVLLIB Routine

.Globl	scx
		.If eq 1
Called by

	i = CSCX(&string1,&string2,&integer);

compares the strings <string1> and <string2>,
returning the value

	-1	if the first string < the second string
	0	if the first string = the second string
and	1	if the first string > the second string.


<Integer> receives the last character compared in <string2>, trimmed to
7 bits.  If the strings exactly match, this will be zero.

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

CSCX::
	mov	#-1,-(sp)	;For returned value
	mov	@2(sp),r0	;Address of first string
	mov	@4(sp),r1	;Address of second string
	call	scx
	blt	20$
	beq	10$
	inc	(sp)		;greater than - return 1
10$:	inc	(sp)		;equal        - return 0
20$:				;less than    - return -1
	movb	(r1),@6(sp)
	bic	#^c177,@6(sp)
	mov	(sp)+,r0
	return
.end

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

.psect	cvllib

.Sbttl	V2	18-Apr-83	CVLLIB Routine

.globl	scgv
		.If eq 1
Called by

	i = CSCGV(&string1,&string2,&integer);

compares the strings <string1> and <string2>,
returning the value

	-1	if the first string < the second string
	0	if the first string = the second string
and	1	if the first string > the second string.


<Integer> receives the last character compared in <string2>, trimmed to
7 bits.  If the strings exactly match, this will be zero.

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

CSCGV::
	mov	#-1,-(sp)	;For returned value
	mov	@2(sp),r0	;Address of first string
	mov	@4(sp),r1	;Address of second string
	call	scgv
	blt	20$
	beq	10$
	inc	(sp)		;greater than - return 1
10$:	inc	(sp)		;equal        - return 0
20$:				;less than    - return -1
	movb	(r1),@6(sp)
	bic	#^c177,@6(sp)
	mov	(sp)+,r0
	return
.end

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

.psect	cvllib

.Sbttl	V2	18-Apr-83	CVLLIB Routine

.Globl	scxv
		.If eq 1
Called by

	i = CSCXV(&string1,&string2,&integer);

compares the strings <string1> and <string2>
returning the value

	-1	if the first string < the second string
	0	if the first string = the second string
and	1	if the first string > the second string.


<Integer> receives the last character compared in <string2>, trimmed to
7 bits.  If the strings exactly match, this will be zero.

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

CSCXV::
	mov	#-1,-(sp)	;For returned value
	mov	@2(sp),r0	;Address of first string
	mov	@4(sp),r1	;Address of second string
	call	scxv
	blt	20$
	beq	10$
	inc	(sp)		;greater than - return 1
10$:	inc	(sp)		;equal        - return 0
20$:				;less than    - return -1
	movb	(r1),@6(sp)
	bic	#^c177,@6(sp)
	mov	(sp)+,r0
	return
.end

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

.psect	cvllib

.Sbttl	V1A	17-Jul-83	CVLLIB Routine

.globl	csvr,carg,mul22,lretc

		.If eq 1
Called by
		i = CMUL22(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

CMUL22::
	call	csvr
	mov	carg(sp),r2	;High order multiplier
	mov	carg+2(sp),r3	;Low order multiplier
	mov	sp,r0
	add	#carg+4,r0		;Multiplicand

	call	mul22

	mov	carg+10(sp),r0
	mov	r2,(r0)+	;High order result
	mov	r3,(r0)		;Low order result
	jmp	lretc		;Set R0 according to carry bit
.end

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

.psect	cvllib

.Sbttl	V1A	17-Jul-83	CVLLIB Routine

.globl	csvr,carg,mul21,lretc

		.If eq 1
Called by
		i = CMUL21(double,single,&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

CMUL21::
	call	csvr
	mov	carg(sp),r2	;High order multiplicand
	mov	carg+2(sp),r3	;Low order multiplicand
	mov	carg+4(sp),r0	;Single-precision multiplier

	call	mul21

	mov	carg+6(sp),r0
	mov	r2,(r0)+	;High order result
	mov	r3,(r0)		;Low order result
	jmp	lretc		;Set R0 according to carry bit
.end

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

.psect	cvllib

.Sbttl	V1A	17-Jul-83	CVLLIB Routine

.globl	csvr,carg,div21,lretc

		.If eq 1
Called by
		i = CDIV21(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

CDIV21::
	call	csvr
	mov	carg(sp),r2	;High order dividend
	mov	carg+2(sp),r3	;Low order dividend
	mov	carg+4(sp),r0	;Divisor

	call	div21

	mov	r0,@carg+10(sp)	;Remainder
	mov	carg+6(sp),r0
	mov	r2,(r0)+	;High-order quotient
	mov	r3,(r0)
	jmp	lretc		;Set R0 according to carry
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	yes,lretc
		.If eq 1
Called by
		i=CYES();

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

CYES::
	call	yes
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	yesno,lretc
		.If eq 1
Called by
		i=CYESNO();

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

CYESNO::
	call	yesno
	jmp	lretc
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.globl	tlin,lretc
		.If eq 1
Called by
		i=CTLIN(&string,&endpointer);

Commences at STRING, providing a null-terminated (not <cr><lf>) line, and
setting <endpointer> to be a pointer to the terminating null or control C.

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

CTLIN::
	mov	2(sp),r1	;string starting address
	call	tlin
	mov	r0,@4(sp)	;end pointer.
	jmp	lretc
.end

CIRAN.MAC
.Title	CIRAN - (C) interface for IRAN
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl 	V1	3-Apr-83	CVLLIB Routine

.globl	iran,ran$nm

		.If eq 1
Called by
		i=CIRAN(n);
Returns
	a random integer from 0 to <n-1>.
AND
		CRNSET(n);

	to initialize the random seed to <n>
	(though this will not be value returned)
		.Endc

CIRAN::
	mov	2(sp),r0
	jmp	iran

CRNSET::
	mov	2(sp),ran$nm
	return
.end

CLTRIM.MAC
.TITLE	CLTRIM - (C) Skip over leading spaces & tabs
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

		.if eq 1
Called by

	CLTRIM(&strpnt);

updates <strpnt> to point past any spaces or tabs.
		.endc

spc=40
tab=11

CLTRIM:
	mov	@2(sp),r0	;Pointer to string
	br	20$
10$:
	inc	r0
20$:
	cmpb	(r0),#spc
	beq	10$
	cmpb	(r0),#tab
	beq	10$

	mov	r0,@2(sp)
	return
.end

CRTRIM.MAC
.TITLE	CRTRIM - (C) Delete trailing spaces & tabs
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

		.if eq 1
Called by

		CRTRIM(&strpnt);

decrements the string pointer <strpnt> such that the character before the one
pointed to is neither a space nor a tab.
		.endc

spc=40
tab=11

CRTRIM::
	mov	@2(sp),r0
	br	20$
10$:
	dec	r0
20$:
	cmpb	-1(r0),#spc
	beq	10$
	cmpb	-1(r0),#tab
	beq	10$

	mov	r0,@2(sp)
	return
.end

CSCOP.MAC
.TITLE	CSCOP - (C) Copy a string.
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	14-Apr-83	CVLLIB Routine

		.if eq 1
Called by

		cscop(&strpnt1,&strpnt2);

Copies the string pointed to in <strpnt1> into the string pointed to in
<strpnt2>.  Parity bits are cleared, and the first string may be null or
<200> terminated.  <strpnt2> is left pointing to the next available (and
also cleared to 0) byte.
		.Endc

CSCOP::
	mov	@2(sp),r0
	mov	@4(sp),r1
10$:
	movb	(r0)+,-(sp)
	bic	#177600,(sp)
	movb	(sp)+,(r1)+
	bne	10$

	dec	r1
	mov	r1,@4(sp)
	return
.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

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

		CSWSET(bits)	to set appropriate bits, and
		CSWCLR(bits)	to clear bits.
		.Endc

jsw=44

CSWSET::
	bis	2(sp),@#jsw
	return
CSWCLR::
	bic	2(sp),@#jsw
	return
.end

CDIG3.MAC
.Title	CDIG3 - (C) Provide 3 digit Rad50 from Number
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	1-Apr-83	CVLLIB Routine

.globl	dig3,lretc

		.If eq 1
Called by
		i = cdig3(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

CDIG3::
	mov	2(sp),r0
	call	dig3
	mov	r0,@4(sp)
	jmp	lretc		;Return R0 value as per carry bit
.end

CGTLIN.MAC
.Title CGTLIN - .GTLIN request from C programme
.Enabl	lc
.Nlist	bex,toc,sym
.dsabl	gbl

.psect	cvllib

.Sbttl	V2	 9-Aug-83
;Add prompt
.Sbttl	V1	13-Apr-82

.Mcall	.gtlin

		.If eq 1
Called by
		char line[82];
		cgtlin(line,"prompt\200");
Returns the line, null terminated, in line.
		.Endc

cgtlin::
	mov	2(sp),r1
	mov	4(sp),r0	
	.gtlin	r1,r0
	return
.end

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

.psect	cvllib

.Sbttl	V1A	17-Jul-83	CVLLIB Routine
; Bug fix
.Sbttl	V1	3-Apr-83	CVLLIB Routine

.mcall	.ttyou

.globl	csvr,carg
		.If eq 1
Called by
		cchr(number,char1[,char-2, ... ,char-n]);

types each <char> as a single character to the terminal.  An indefinite
number of arguments is permitted.
		.Endc

CCHR::
	call	csvr
	mov	sp,r2		;Argument pointer
	add	#carg,r2
	mov	(r2)+,r1	;Number of arguments
	ble	20$
10$:
	mov	(r2)+,r0
	.ttyou
	dec	r1
	bne	10$
20$:
	return
.end

CCHR1.MAC
.Title	CCHR1 - (C) Type a character
.nlist	bex,toc,sym
.enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	17-Jul-83	CVLLIB Routine

.mcall	.ttyou

		.If eq 1
Called by
		cchr1(char1);

types <char> as a single character to the terminal.
		.Endc

CCHR1::
	.ttyou	2(sp)
	return

.end

CTIN.MAC
.Title	CTIN - (C) Read single terminal character
.Nlist	bex,toc,sym
.Enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	17-Jul-83

.mcall	.ttyin

		.If eq 1
Called by
		i=ctin();

Reads a single character from the user's terminal.
		.Endc

CTIN::
	.ttyin
	return

.end

CTINR.MAC
.Title	CTINR - (C) Read character from terminal
.Nlist	bex,toc,sym
.Enabl	lc
.dsabl	gbl

.psect	cvllib

.Sbttl	V1	19-Jul-83	CVLLIB Routine

.mcall	.ttinr

		.If eq 1
Called by
		I = CTINR();

returns a single character, with -1 if no characters are available.
It needs the bit b.tinh (100) set in the job status word to operate
correctly on the FB monitor.
		.Endc

CTINR::
	.ttinr
	bcc	10$
	mov	#-1,r0
10$:	return

.end

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

.psect	cvllib

.Sbttl	V1	3-Apr-83	CVLLIB Routine

.mcall	.print

		.If eq 1
Provides the ability to send a string from C in the format

		CPRINT(&"This is a string");
	or	CPRINT(&"This is a prompt\200");

such that the string may be printed with no carriage-return following.
		.Endc

CPRINT::
	mov	2(sp),r0
	.print
	return
.end

