CVLLIB A General-Purpose Library CVGLIB - General Section Release 4 (Manual Edit Ref 4-0) 31-Mar-86 C G Wilson 71 Galatea St, Charleville 4470 Australia This manual refers to the routines in the GENERAL and REAL NUMBER sections of CVLLIB. The FORTRAN and C sections each have their own manuals. This manual includes details of building the complete library. Aim: To reduce re-invention of numerous wheels to an acceptable level. CVLLIB is a (personal) general-purpose library for the RT-11 Macro, Fortran or C programmer. Routines cover facilities such as reading and writing decimal (up to triple precision) and octal (up to double precision) and hexadecimal (up to double precision) integers, money format (double or triple precision), dates and times, filenames and Radix50 formats. Multiple-precision arithmetic routines are included, none of which requires an EIS or FIS. Real (floating-point) routines are included, but these require either a KEV11 or a floating-point hardware unit (FPU). CVLLIB comprises about 500 source files in Macro-11 for RT-11. It was written on an LSI-11 but is designed to work on all machines. Should errors or incompatibilities be found, please communicate them to the author at the above address. In this release CVLLIB has been split into three functional groups: CVFLIB (Fortran interfaces), CVRLIB (real (2 word) number routines), and CVGLIB (general segment - the routines themselves). CVLLIB may be combined with TTLIB (a library of subroutines by the same author for the VT100 terminal) for added functionality. CVLLIB Manual Page 2 Prelude All non-trivial programmes contain bugs. Non-trivial collections of trivial programmes contain bugs. Bugs are rarely trivial. Which is why we in computing spend so much time playing silly buggers. CVLLIB Manual Page 3 Table of Contents Table_of_Contents _____ __ ________ a) Update History b) Determination of Release Number 1. GENERAL DETAILS Nomenclature General Argument Patterns (Macro Routines) General Argument Patterns (Fortran Routines) General Argument Patterns (C Routines) Writing to a string Reading Generally Flag values 2. DISTRIBUTION KIT, & GENERATION OF THE LIBRARY Distribution Kit Generation of the Library Generation in toto Generation of Individual Sections CVGLIB - General/Macro CVRLIB - Real numbers CVFLIB - Fortran Combination of the Sections Further Details of the Generation 3. OPTIONAL ROUTINES & FILES 4. SPECIAL BLOCK FORMATS DATE block CALEND Common Block TIME Block FILENAME block: Terminal I/O 5. ROUTINES THEMSELVES (Introduction) 6. REAL (FLOATING-POINT) [2-word precision] Initialization I/O (Macro Routines) I/O (Fortran & C Routines) Accessory routines (Macro) Accessory routines (Fortran & C) Real Arithmetic (Macro) Ancillary subroutines Floating point trap routine 7. DATE 8. TIME 9. FILENAME & RADIX50 10. TRIPLE PRECISION MONEY 11. TRIPLE PRECISION INTEGER I/O 12. TRIPLE PRECISION ARITHMETIC 13. DOUBLE PRECISION MONEY CVLLIB Manual Page 4 Table of Contents 14. DOUBLE PRECISION INTEGER I/O 15. DOUBLE PRECISION ARITHMETIC 16. SINGLE PRECISION INTEGER I/O 17. STRING COMPARISON ROUTINES 18. VARIOUS ADDITIONAL ROUTINES Size Conversion Routines Additional Utilities etc 19. ANCILLARY SUBROUTINES Appendix I - Index CVLLIB Manual Page 5 Table of Contents Changes across CVLLIB Releases Changes from Release 1 to Release 2 1. Radix50 filename output changed to conform to CSI standards for "*" and "%" (previously used DECsystem-10 standard). 2. Date reading routines (RDAT et alii) changed to allow British (dd.mm.yy) or American (mm.dd.yy) date formats as desired, or allow restriction to the alphabetic month (dd-mmm-yy) standard. 3. Bug fixes: notably random integer generator, and problems with parameter passing with LADD2, LSUB2, LADD3, and LSUB3. 4. Addition of global CVLLIB (in module CVLVER.MAC) to determine which version of this library is being used. 5. Addition of string comparison subroutines. Release 2B - addition of CMPR routine. CVLLIB Manual Page 6 Table of Contents Changes Across Releases (continued) Changes from Release 2 to Release 3 1. C interfaces added, and library split into four functional units. (Manipulation of 25 directory segments is too unweildy!). 2. Hexadecimal I/O added. 3. Ascii character output added. 4. Double precision general number reading (xRN2) added. 5. Time reading will accept hours & minutes as "1230". 6. Separate user terminal input & output buffers (TLINB and TLOUB). 7. Overflow on reading a number now allows the scan to continue to the end of the number rather than pranging it there and then (with the exception of the money reading routines, which are read in two portions - before and after the decimal point. Overflow before the decimal point will cause reading to stop at the decimal point). 8. Numerous bug fixes, no doubt adding a few more (sigh!). 9. Splitting the Fortran manual from the Macro one, (the C manual is separately written). The real number routines (for Macro, C, and Fortran) are included in this general manual. Edit 3-1: Add TSPM, TNSPM, TNIOW, TIOW. Edit 3-2: Add CSVR. Edit 3-3: Add changes to IO2.MAC. Edit 3-4: Reflect changes to distribution & library building. Edit 3-5: Acknowledge bugs in LSCx; change SYSLIB combination. Edit 3-6: Repair FPU code bug in FP.MAC. CVLLIB Manual Page 7 Table of Contents Changes Across Releases (continued) Changes from Release 3 to Release 4 1. Put all CVLLIB code into PSECT CVLLIB, to allow ordering of PSECTs. 2. Repair bug in RM3 code where R0 was destroyed. 3. Change WD (and its offspring) to producing UNSIGNED decimal output, and add WDS (and corresponding routines) to write decimal signed. CVLLIB Manual Page 8 Table of Contents Determination of Library Release Number In any library built from CVLLIB sources (from release 2 on) it should be possible to determine from which version of these sources it was created. A routine CVLLIB.MAC is included in the sources, and may be utilized as follows: (the /TRANSFER makes up for LINK deficiencies in RT-11!) .LINK/INCLUDE/TRANSFER CVLLIB Transfer Symbol? CVLLIB Library Search? CVLLIB Library Search? .RUN CVLLIB CVLLIB Release 4 . CHAPTER 1 General Details 1.1 Nomenclature: There has been an attempt made to get all the programmes in CVLLIB to have names consistent with their purposes. Due to the restriction to six characters this has not always been possible, but here are the ideas behind it. Routines which write have names starting with "W" (eg WD writes a decimal number), and those which read have names beginning with "R" (eg RDAT reads a date). Conversion routines begin with "C" (eg C50A converts radix50 to ascii). Numeric routines are either decimal (D) or octal (8), and this may be followed by a number indicating the precision (eg RD3 reads a triple precision decimal number, and W8 writes a single precision octal number). Real (floating-point, 2-word precision) routines use the letter "R" - eg RR reads a real, and WRFT writes a real number in F format (a la FORTRAN) to the user's terminal. The suffix "T" indicates I/O involving the user's terminal. Without this, I/O involves a string (in Macro, pointed to in R1; in Fortran, provided as an argument). The suffix "P" indicates that a minimum number of positions may be specified as an argument, thereby writing a number right-justified in a fixed-length field. Thus WD2PT writes a double precision decimal number in a fixed number of places to the user's terminal. In octal I/O, single precision decimal I/O, and double precision decimal reading, an additional suffix "S" indicates that the number may be signed. (Triple precision numbers may always be signed, and any decimal number on being written will have a "-" sign if negative). Thus R82ST will read a double precision signed octal integer from the user's terminal. The money format is $ddd.cc, with the number stored as an integral number of cents. The numbers used may be double or triple precision CVLLIB Manual Page 1-2 General Details integers. Thus RM3 will read a triple precision sum of money from the string pointed to in R1, and WMDT will write a double precision integer in money format with a leading floating dollar sign (the "D") to the user's terminal. The "P" suffix is available in money routines. Money routines are either double or triple precision - THERE ARE NO SINGLE PRECISION MONEY ROUTINES. Fortran-callable interfaces for nearly all the routines are included in this library. To determine the Fortran-callable routine, prefix the name of the desired routine with an "L". WFT writes a filename to the terminal; LWFT is the subroutine called from Fortran to do the same job. Routines already having 6-letter names are a problem (eg W82SPT becomes LW82SX, and CRDATW {converts RT-11 date format to words} becomes LCRDW). Note also that the Macro Radix50 reading routines read up to 3 characters, whereas their Fortran equivalents read up to 6. The exceptions to the above rule are the real (floating-point) functions which return a real value. These have names beginning with "R". Specifically, these functions are RFRAC, RFLT1, and RFLT2. The choosing of the prefix "L" came about after originally the prefix "F" was used. This caused so many hassles remembering to declare routines which returned values as INTEGER, that the change in convention to an implicitly integer series of names was instituted. Routines to be called by C programmes (Conroy C, submitted to DECUS by Bob Denny) have a prefix "C". Quite a few of these are probably unnecessary due to features available in the C library itself, but they are included for convenience and consistency. Additional routines to provide some SYSLIB facilities from C are provided, with more on the way. CVLLIB Manual Page 1-3 General Details 1.2 General Argument Patterns (Macro Routines): Routines generally preserve all registers except those used to return values, and R1. This, as the string pointer, will be altered as appropriate in routines which read from and write to strings, and may contain a pointer to the delimiting character on return from routines which read from the user's terminal. R0 - used for single precision arguments, or as a pointer to triple precision or additional double precision arguments. R1 - points to input or output string R2 - (the most ill-treated register of them all!) used for additional single precision argument (eg number of places for field width in WxP routines) OR as pointer to additional triple precision argument (eg ADD3 - add two triple precision integers) OR as a pointer to a data block in routines involving date, time, or filenames OR R2,R3 - used as high-order word and low-order word respectively for double precision arguments. NOTE that multiple precision integers as used throughout CVLLIB use the first word (lowest address) to contain the highest-order bits, up to the last word (highest address) containing the low order bits. This is the same as RT11 time format double precision integers, but the REVERSE of the INTEGER*4 support functions in SYSLIB. 1.3 General Argument Patterns (Fortran Routines): Throughout this manual, the following names for arguments have these meanings: a single-word integer value <2.value> a double-word integer value, with the high-order bits in the first word (lower address). This is the opposite way round from the SYSLIB INTEGER*4 support functions, but the same way round as the RT11 Timer functions. <3.value> a triple-word integer value with the highest order bits in the first word through to the lowest order bits in the last word. As there is no 3-word declaration in RT11 Fortran, these will have to be programmed either as arrays of single precision integers or as 4 word (eg REAL*8) allocations. CVLLIB Manual Page 1-4 General Details Any number suffixed to any of the above (eg <2.value-2> is used to differentiate between different arguments of the same type in describing their purpose for that particular subroutine or function. the locations into which or from which data will be written or read. (Not used in routines doing direct terminal I/O). The string should be terminated by a null (=0) character rather than any control characters (eg carriage-return or line-feed). will usually be specified as a BYTE or LOGICAL*1 array. is an integer which is increased by the number of bytes read from or written to by any Fortran routine which uses the . Thus after using a routine which writes into , if originally contained 1 and now contains 10, 9 characters (excluding the terminating null provided by routines which write to the ) were added to the . STRING(10) will contain the terminating null, and will be the next byte available for writing into to continue that line of information. For example, if STRING (a byte array) contains "FILE FRED.DAT/RHUBARB" and the routine to read a filename from a string is called as follows: LAST=6 I=LRF(IFILE,STRING(6),LAST) the filename FRED.DAT will be read into the IFILE array (as the start of the string to be decoded was the sixth character in the STRING array), and LAST will return containing a value 14. Eight characters were read from STRING, and STRING(LAST) now points to the delimiting character, the slash. Thus successive reads from the one input line may be handled by initially setting LAST to 1, and using the returned value from each routine for the call to the succeeding routine. refers to a 1-byte location which receives the character which delimited input on a read from the user's terminal. This can be used to check validity of the user's type-in. For example if a user typed "39" as input to CALL LR8T(value,char), would receive the number 3, and would receive the character "9", whereas had he typed "37", would receive 37 and would receive the terminating null (=0). CVLLIB Manual Page 1-5 General Details 1.4 General Argument Patterns (C Routines): In this and the C manual, the following names for arguments have these meanings: a single-precision integer a double-precision integer a single, double, or triple-precision integer depending upon context. A triple precision integer will need to be defined as a structure or a portion of an array. <&strpnt> a pointer to a string into which or from which data is to be written or read. This is modified to point to the next available character, and hence must be passed as an address of a pointer to a string. char string[100],*strpnt; strpnt=string; cwd(&strpnt,1000); writes the number 1000 (decimal) into string[0] through string[3], leaving strpnt pointing to string[4] which will have been cleared to zero. Similarly, after reading anything from the user's terminal, strpnt will be returned pointing to the delimiter of whatever was read. This allows further information to be read from the same line. 1.5 Writing to a string: When information (eg numbers) is written to a string (either a argument from Fortran, a <&strpnt> argument in C, or a pointer in R1 in Macro), the characters are written into that string sequentially with no check as to the available length of that string. Following Macro routines R1 is left pointing to the next free byte but that byte has not as yet been altered. Fortran and C routines clear that (terminating) byte, and Fortran provides a pointer to it in . 1.6 Reading Generally: Routines which read ignore leading spaces and tabs, except for routines which read Radix50 values. CVLLIB Manual Page 1-6 General Details 1.7 Flag values Many routines require minor information to be provided in the form of a word. Some routines provide the ability to include or exclude spaces either preceding or embedded within output fields. Including these spaces allows columns of information to be accurately lined up no matter what the content of the information; excluding the spaces makes for tidier formatting on a one-off basis (for example dates, times, and filenames). The sign bit of the argument is used to control spaces; other bits will be routine dependent. If the sign bit be clear, no leading or embedded spaces will be included. If it is set (ie the value is negative) they will be included if relevant. 1.8 Hexadecimal Conventions: Various systems use various conventions to define a hexadecimal number. Some use merely the digit string, some use a prefix character (for example a "0" or a colon), and some use a suffix (for example an "X" or an "H"). In a vain attempt to provide all things for all men, CVLLIB provides the option for a prefix &/or a suffix character for hexadecimal numbers. The default is a "0" (digit zero) prefix character, and no suffix character. These are defined in the files HEXPRE.MAC and HEXSUF.MAC. To alter either from Macro or C, merely place the desired character in the relevant global (extern char) HEXPRE or HEXSUF, or a value of zero to cause it to be unused. From Fortran, define it in a common block as follows: COMMON/HEXPRE/HEXPRE INTEGER HEXPRE DATA HEXPRE /0/ COMMON/HEXSUF/HEXSUF INTEGER HEXSUF DATA HEXSUF /'H'/ will lead to no hex prefix character (HEXPRE=0), and an "H" hex suffix. On hexadecimal output the hex prefix character (if defined) will prefix any hex number written, and the hex suffix character (if defined) will follow any number. [All hex output is unsigned.] On reading a hex number using the specific hex reading routines (RH2T, RH2, RHT, and RH) any prefix or suffix characters will be ignored. On reading a number using the generic number reading routines (RN2T, RN2, RNT, and RN) any prefix or suffix character will be taken to mean that the particular digit string constitutes a hexadecimal number, and the relevant hex reading routine will be used. CVLLIB Manual Page 1-7 General Details If either prefix or suffix character be alphabetic, either upper or lower case will be accepted on reading a hexadecimal number. CHAPTER 2 Distribution Kit, & Generation of the Library 2.1 Distribution Kit The CVLLIB Distribution Kit contains: CVLLIB.ABS Abstract READ .ME A few basic details CVLLIB.DOC This manual, covering the general & macro portion and the real number portion, of CVLLIB. [Some possibly useful command files] CVLGEN.COM Master command file, by which the complete library generation can take place if you have a large fast disc with at least 23 directory segments! CVLLIB.COM Command file for generating the complete library CVLLIB.OBJ from the section libraries CVGLIB.OBJ, CVRLIB.OBJ, and CVFLIB.OBJ. SYSLIB.COM A SAMPLE command file for combining CVLLIB with a version of SYSLIB (already containing FORLIB). [Additional sort-of-source files] DATBLK.DAT Parametric date block information for inclusion in source programmes. TIMBLK.DAT ibid, time block CMAC .MAC Useful prefix file for general Macro programme use. Contains a handful of definitions which I can never remember where to find when I want them in a programme! BASE .MAC Template programme for Macro programmes requiring one input & one output file. Switch handling, double buffered I/O (using IO2.MAC) all included. Saves wheel re-invention. TT .MAC TT handler correcting a bug in V5 (& previous) TT handlers when using co-routine I/O. [Demonstration Programmes] LMP .MAC For calculation of gestation given last menstrual period dates, with a few bells & whistles. VC .MAC Vital capacity calculation (needs tidying up to accurately include children's capacities). CVLLIB Manual Page 2-2 Distribution Kit, & Generation of the Library CONVRT.MAC General units conversion. DEMO .MAC Wot it sez. [Utility programme] COMPRS.SAV Performs source file compressing and expansion. Required on DK: for generation of any of the sections of the library. (The source for it is compressed with the CVGLIB sources in CVGLIB.SRC) [General Section] CVGGEN.COM Command file to generate CVGLIB - general & Macro portion of CVLLIB. CVGLIB.TEC TECO programme to create command files needed for this generation. CVGLIB.DAT Data file used by CVGLIB.TEC. CVGLIB.SRC Compressed sources for CVGLIB. CVGLIB.OBJ The general/Marco library, ready made. [Real Number Section] CVRGEN.COM Command file to generate CVRLIB - real number portion of CVLLIB. CVRLIB.TEC TECO programme to create command files needed for this generation. CVRLIB.DAT Data file used by CVRLIB.TEC. CVRLIB.SRC Compressed sources for CVRLIB CVRLIB.OBJ The real number library, ready made. [Fortran Section] CVFLIB.DOC Fortran section manual CVFGEN.COM Command file to generate CVFLIB - Fortran portion of CVLLIB. CVFLIB.TEC TECO programme to create command files needed for this generation. CVFLIB.DAT Data file used by CVFLIB.TEC. CVFLIB.SRC Compressed sources for CVFLIB CVFLIB.OBJ Fortran section of library, ready made. CVLLIB.OBJ Full CVLLIB library, ready made. 2.2 Generation of the Library For generation of the library, various device assignments are necessary: CMP: Device upon which compressed source files (".SRC") are to be found. EXP: Device upon which compressed source files are to be expanded. This MUST be the same device as DK:. BIN: Device upon which object files are to be written upon assembly. LST: Listing device, if you really want listings. MAP: Device upon which to write the map files (from LIBR) on putting the libraries together. CVLLIB Manual Page 2-3 Distribution Kit, & Generation of the Library A characteristic set of device assignments would be .ASSIGN CMP .ASSIGN EXP .ASSIGN BIN .ASSIGN NL LST .ASSIGN NL MAP [The availability of different devices is to allow flexibility for users who have several small discs and not one large one - eg on an RX02 system CMP and EXP may need to be separate units.] 2.2.1 Generation of the library in toto: If you have the room (about 2700 blocks of disc space with at least 23 directory segments allocated), copy the complete distribution kit across, make the assignments mentioned above, and type .@CVLGEN Then go out for lunch. The source files will be expanded then assembled, then the separate section libraries combined, then a full CVLLIB. 2.2.2 Generation of Individual Sections of CVLLIB: If you are restricted to less grand facilities, you will need to generate each section of the library separately. The library logically divides into three sections: General/Macro Section: CVGLIB Real Number Section: CVRLIB Fortran Section: CVFLIB It is possible to omit either or both of CVRLIB and CVFLIB if they are unnecessary for your purposes, but each of these requires routines in CVGLIB. 2.2.2.1 CVGLIB: General/Macro Section: - Copy the following files to a device with 15 directory segments and about 1300 blocks: COMPRS.SAV CVGGEN.COM CVGLIB.TEC CVGLIB.DAT CVLLIB Manual Page 2-4 Distribution Kit, & Generation of the Library CVGLIB.SRC Make sure you have TECO.SAV on SY:, and make the device assignments as mentioned above. Then type: .@CVGGEN 2.2.2.2 CVRLIB: Real Number Section: - Copy the following files to a device with 6 directory segments and about 550 blocks: COMPRS.SAV CVRGEN.COM CVRLIB.TEC CVRLIB.DAT CVRLIB.SRC Make sure you have TECO.SAV on SY:, and make the device assignments as mentioned above. Then type: .@CVRGEN 2.2.2.3 CVFLIB: Fortran Section: - Copy the following files to a device with 15 directory segments and about 900 blocks: COMPRS.SAV CVFGEN.COM CVFLIB.TEC CVFLIB.DAT CVFLIB.SRC Make sure you have TECO.SAV on SY:, and make the device assignments as mentioned above. Then type: .@CVFGEN 2.2.3 Combination of the Libraries The three libraries may be combined using the command file CVLLIB.COM into a single CVLLIB.OBJ. CVLLIB may be combined with SYSLIB. A sample command file (SYSLIB.COM) is provided, but may require editing for an individual situation. There may be globals which will require suppression. To determine which ones will be required on your particular system, a dummy run through LIBR CVLLIB Manual Page 2-5 Distribution Kit, & Generation of the Library will provide the answers: .R LIBR *NL:=SY:SYSLIB/A ?Multiple definition of $ERRS ?Multiple definition of $ERRTB ?Multiple definition of .ipeek (for example). Note the "/A" switch. Record all the globals flagged in error, prefix them by the two globals "R$T" and "TLIN" (which have to be suppressed in CVGLIB), and insert in your own version of SYSLIB.OBJ. Here is the sample version of SYSLIB.COM: !SYSLIB.COM - For distribution with CVLLIB ! !Suppressed globals are required because: ! CVLLIB R$G includes duplicate R$T and TLIN ! FORLIB requires suppression of the "$" symbols ! SYSLIB includes multiple asect values ! of the ".xxxxx" symbols. R LIBR SYSLIB[-1]/A/G=SY:SYSLIB,DK:FORLIB,CVRLIB,CVFLIB,CVGLIB R$T TLIN $OVRH $ERRS $ERRTB .ipeek .ircvd .iread .isdat .ispfn .iwrit ^C 2.3 Further Details of the Generation During execution of the CVxGEN.COM file, the instruction .EDIT/EXECUTE/TECO CVxLIB.TEC is performed. This runs a TECO programme which takes entries from the data file CVxLIB.DAT and produces a string of command files. These command files are as follows: CVxEXP.COM For expanding the packed source (.SRC) files. CVxMAC.COM For assembling each of the unpacked source files. CVxLIB.COM For combining the OBJ files into a section library. CVxCMP.COM For compressing the sources into a .SRC file. CHAPTER 3 Extra Routines & Files There are a couple of routines included with this library which are not really part of this library at all, but are included because of their general usefulness. A brief description of them in included, but for full details users are referred to the source code for each of them. N12FIL, IO, and IO2 will be assembled or included in the library unless deliberately omitted by the user. CMAC This is a prefix file used in generating test programmes for this library. It contains a handful of useful definitions and macros, and is used as per ".MACRO CMAC+TEST/OBJECT". DATBLK.DAT Description of format (see next chapter) for inclusion within source files. TIMBLK.DAT ibid, for . N12FIL I=N12FIL(inflag,outflag,defext,'Version') Allows setting up an input and an output file within Fortran with the standard CSI format (*outfile=infile), setting up the input file on Fortran logical unit 1 and the output file on unit 2. The and tell the user whether or not the relevant file was specified in the user's type-in. Before returning, checking is performed for the existence of the input file and the possibility of writing the output file. If reading and writing the specified files is impossible, the user is told and asked for another specification. There is no switch handling by this routine. IO This is a set of routines providing convenient byte I/O from Macro programmes. It provides the ability to use all available memory for buffer space, greatly speeding operations on floppy discs. IO.DAT is a file containing the .GLOBL definitions for programmes which wish to use IO. CVLLIB Manual Page 3-2 Extra Routines & Files IO2, BASE IO2 is a set of double-buffered I/O routines (from RUNOFF, actually) which is designed for use with the skeleton programme BASE.MAC. BASE.MAC is a general template programme designed to reduce rewriting of I/O and switch handling in numerous programmes. The IO section of IO2 has been rewritten due to bugs found in RUNOFF, and the names of the input and output byte routines changed to prevent clashes within the library with IO.OBJ. A bug was found in the RT-11 SJ monitor TT handler, where the stack was incorrectly set causing the system to crash. The file TT.MAC, distributed with this library, is a corrected handler for RT-11 V5. It works for RT11 V4 also, if you ignore the error message from the macro ".MODULE" not being found (or alternatively edit it out!). COMPRS This is the programme which performs source file compression and expansion. The source is COMPRS.C, which is in the compressed file CVGLIB.SRC, along with a couple of other "C" routines CGTLIN.MAC and CSERR.MAC. These are required to be linked with COMPRS. For further information, see these source files. [The sources are not greatly compacted - the compressed file may still be edited with KED. This is useful for multiple edits over the whole library, if someone gets keen on converting CVLLIB to another system.] CHAPTER 4 Special Block Formats 4.1 DATE block DATE routines require a 5-word block (referred to as a "dateblock") in the following format: 1st word DAY eg 31 for 31-Mar-81 2nd word MONTH eg 3 for 31-Mar-81 3rd word YEAR eg 81, or 1981 4th word DYEAR day of year - eg 90 for 31-Mar-81 5th word RTDAT date in RT-11 format - ie sign bit 0 next 5 bits - month next 5 bits - day last 5 bits - year-1972 eg 7751 (octal) for 31-Mar-81. Various routines place relevant values in these locations, use values from them, or convert values between locations within the block. For convenience, a 5-word block is provided in this library. The first location is the global DATBLK, and the locations are sequentially named globally DAY ... RTDAT. They are in a Psect DATBLK (with characteristics RW, D, GBL, REL, OVR) so that if desired they are accessible also via the Fortran COMMON block INTEGER DAY,MONTH,YEAR,DYEAR,RTDAT COMMON /DATBLK/ DAY,MONTH,YEAR,DYEAR,RTDAT 4.1.1 CALEND Common Block A Fortran COMMON block, /CALEND/, containing calendar information, is defined in RDAT and IDAY. It contains 3-letter versions of names of days of the week and months, the number of days in each month, and a series of offsets for calculating day of week dependent upon month. It CVLLIB Manual Page 4-2 Special Block Formats should be noted that the number of days in the month of February is altered on a call to IDAY such that it will be correct for the particular year passed in the argument to IDAY in that call. This common block has the form: REAL DAYNAM,MONNAM BYTE MONTHS,MOFSET COMMON/CALEND/DAYNAM(7),MONNAM(12),MONTHS(12),MOFSET(12) and is initialized as follows: DAYNAM: .ASCII /Sun Mon Tue Wed Thu Fri Sat / MONNAM: .ASCII /Jan Feb Mar Apr May Jun / .ASCII /Jul Aug Sep Oct Nov Dec / MONTHS: .BYTE 31.,28.,31.,30.,31.,30. .BYTE 31.,31.,30.,31.,30.,31. MOFSET: .BYTE 0,3,3,6,1,4,6,2,5,0,3,5 4.2 TIME Block TIME routines require a 7-word block (referred to as a "timeblock") in the following format: 1st word HOURS hours (in 24-hour format) 2nd word MINS minutes 3rd word SECS seconds 4th word TICKS clock ticks 5th word RTIM1 two words containing RT-11 6th word RTIM2 double-precision time, high order word first, in clock ticks since the previous midnight. 7th word TCLOCK number of clock ticks per second (set by the user, or by the RSTIM routine; used for time conversions. Various routines place relevant values in these locations, use values from them, or convert values between locations within the block. For convenience, a 7-word block is provided in this library. The first location is the global TIMBLK, and the locations are sequentially named globally HOURS, MINS, ... , TCLOCK. They are in a Psect TIMBLK (characteristics RW, D, GBL, REL, OVR) so that if desired they may be accessed also as the Fortran COMMON block INTEGER HOURS,MINS,SECS,TICKS,RTIM1,RTIM2,TCLOCK COMMON /TIMBLK/ HOURS,MINS,SECS,TICKS,RTIM1,RTIM2,TCLOCK CVLLIB Manual Page 4-3 Special Block Formats 4.3 FILENAME block: Routines concerning filenames require a 4 or 5 word block (referred to as a "fileblock") in the following format: 1st word DEVICE device name 2nd word FILE1 first 3 chars of filename 3rd word FILE2 last 3 chars of filename 4th word EXT extension (file type) (First 4 words in Radix50 format) 5th word SIZE file size (integer) - optional on routines which write filenames - an integral number of 256-word blocks. No equivalent block is provided in this library - the user is expected to provide his own! 4.4 Terminal I/O Routines which appear to do direct terminal I/O (eg RMT - Read money value from the terminal) actually operate by using a temporary buffer (TLINB for input, and TLOUB for output), and the equivalent string interpreting or writing routine. In this library a routine TLINB is defined as a 90 (decimal) character block, and TLOUB a 140 (decimal) character block - sufficient for a full 132-column printer line. Should these be excessive or insufficient for your purpose, either use your own buffer and don't use the direct terminal I/O routines, or define TLINB and/or TLOUB in your own programme - for example: Macro: TLINB:: .BLKB 82. Fortran: COMMON/TLOUB/LINE BYTE LINE(400) Note that routines which read from the terminal and routines which write to the terminal now use different buffers (change from Release 2 to Release 3). Thus it is now possible to read a complete line with several sections from the terminal, producing output interspersed with computations interpreting this line. Routines which read from the terminal normally do so using the .TTYIN programmed request. This means that they will NOT take input from command files. Should this be desired, either use your own .GTLIN request (or, in Fortran, CALL GTLIN - see system subroutine library), or when loading use the /INCLUDE switch to force loading the global "R$G". With this, all teletype input requests (including TLIN, with Release 3) _________ will use .GTLIN requests and track command files. CHAPTER 5 Routines Themselves The routines are listed as follows: Macro: NAME Brief description of routine [calling requirements] CALL (= JSR PC,) NAME [returned values or conditions] ("CS return" means return with the carry bit in the processor status set) A sharp sign (#) preceding an argument in a calling sequence indicates that that argument is an address rather than a value - eg MOV #,R1 means move the address of the string to R1. FORTRAN: NAME CALL NAME-OF-ROUTINE() (or) I = NAME-OF-ROUTINE() Brief description of routine C: NAME NAME-OF-ROUTINE() (or) I = NAME-OF-ROUTINE() Brief description of routine CHAPTER 6 Real (Floating Point) Numbers Real numbers are dealt with in CVLLIB only in single precision (ie 2 words). Routines are provided to read and write them, and for a few conversions (to and from integer & double precision integer). Floating point exception trapping and Fortran and C interfaces are included. Routines in this chapter require floating point hardware, either a KEV11 chip (on LSI-11 and LSI-11/2 systems) or a floating point unit. As the author has only a KEV11, testing facilities for the FPU sections (though willingly and generously provided 800km away) are necessarily limited. These routines make no claims for efficiency in either speed or size, only that they exist and are available. Please pass any comments and suggestions to the author! Trap routines are provided for floating point exceptions. For FPU machines it is essential that the RT-11 monitor include floating point support (in the SYSGEN procedure for that monitor). [It is recommended that this support be also provided in KEV11 systems using these routines also, but as there is no memory management and it is quite possible to grab the floating point exception vector if the .SFPA request does not work, it is not essential!] No error will be reported if floating point support is not in the monitor, but you pays your money and takes your chances. To allow for setting up of these traps, a call to the FINSET (from Fortran, LINSET) routine should occur in all programmes using these routines. For details of output formats (E, F, G, and S) see the individual routines themselves. On reading real numbers, any of the standard formats can be used - eg: 12345 .12345 0.12345 1e26 123.4E5 -1d-3 (Note: result still single precision) 1e-10 CVLLIB Manual Page 6-2 Real (Floating Point) Numbers 6.1 Initialization Routines FINSET Enables traps (and if desired consequent error messages) from floating point exceptions (eg overflow, underflow, divide by zero). The result of these operations will be zero. To enable or disable messages, see details of the global F$MESG later in this chapter (basically 0 for no messages, 1 for messages relevant to CVLLIB routines, and -1 if wish to provide messages for floating point instructions in Fortran programmes). LINSET CALL LINSET(n) As per FINSET, sets up floating point exception traps. The value of the argument is inserted in the global F$MESG (see later), and should be 0 for no messages on floating point exceptions, 1 for use with CVLLIB routines, and -1 for trapping instructions within the Fortran programme itself. (The difference lies in the address printed with the error message.) 6.2 Real I/O - (Macro Routines): Register conventions in Macro Real I/O routines are: R2,R3 contain the real number; for output routines, R0 contains the field width, and R4 the number of digits after the decimal point. If the field width be zero, no leading spaces will be inserted, and trailing zeroes will be removed up to (but not including) the one immediately following the decimal point. Similarly, trailing spaces (where for example in "G" format the exponent was unnecessary) will be omitted where the field width is zero, as will spaces within an exponent field. If the field width be inadequate, it will be expanded as necessary to fit all of the number. WRET Writes a real number in E format (-.nnne-mm) to the user's terminal. MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRET WRGT Writes a real number in G format to the user's terminal. The number will be output in S (scientific or engineering) format if the number be >=1e6 or <1e-3, and in F format otherwise. In F format, 4 spaces will be left to the right of the number (if the field width be non-zero) to allow columns of numbers to line up. MOV ,R0 CVLLIB Manual Page 6-3 Real (Floating Point) Numbers MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRGT WRST Writes a real number in S (scientific or engineering) format to the user's terminal. This format keeps the exponent as a multiple of 3 to fit in with the allocation of metric prefixes. Should the exponent be zero, 4 spaces will be left to the right of the number (unless the field width be non-zero) to allow columns of numbers to line up. MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRST WRFT Writes a real number in F format to the user's terminal. MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRFT WRE Writes a real number in E format (-.nnnE-mm) to a string pointed to in R1. MOV #,R1 MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRE WRG Writes a real number in G format to a string pointed to in R1. The number will be output in S (scientific or engineering) format if the number be >=1e6 or <1e-3, and in F format otherwise. In F format, 4 spaces will be left to the right of the number (if the field width be non-zero) to allow columns of numbers to line up. MOV #,R1 MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRG CVLLIB Manual Page 6-4 Real (Floating Point) Numbers WRS Writes a real number in S (scientific or engineering) format to a string pointed to in R1. This format keeps the exponent as a multiple of 3 to fit in with the allocation of metric prefixes. Should the exponent be zero, 4 spaces will be left to the right of the number (unless the field width be non-zero) to allow columns of numbers to line up. MOV #,R1 MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRS WRF Writes a real number in F format to a string pointed to in R1. MOV #,R1 MOV ,R0 MOV <# digits after decimal point>,R4 MOV ,R2 MOV ,R3 CALL WRF RRT Reads a real number from the user's terminal into R2,R3, leaving R1 pointing to the delimiting character. Carry is set if overflow or underflow occurred on reading the number. CALL RRT R2/ hi-ord real number R3/ lo-ord real number R1/ points to delimiter CS if overflow or underflow RR Reads a real number from a string pointed to in R1 into R2,R3, leaving R1 pointing to the delimiting character. Carry is set if overflow or underflow occurred on reading the number. MOV #,R1 CALL RR R2/ hi-ord real number R3/ lo-ord real number R1/ points to delimiter CS if overflow or underflow CVLLIB Manual Page 6-5 Real (Floating Point) Numbers 6.3 Real I/O - (Fortran & C Routines): The arguments and in these routines indicate respectively the field width (total number of places in the output field) and the number of digits after the decimal point. If the field width be zero, no leading spaces will be output, and trailing zeroes will be deleted back to but not including the one after the decimal point. The arguments and have the same meaning as in other CVLLIB Fortran routines. is the string into or from which the number is written or read, and is a value which is increased by the number of bytes read or written in the process. The <&strpnt> argument has the same meaning as in other CVLLIB C routines. It provides a pointer to a string into or from which the number is to be written or read, and is left pointing to the next free/available character. LWRET CALL LWRET(f,iwidth,idigits) CWRET cwret(f,iwidth,idigits); Writes the real number to the user's terminal in a format equivalent to the Fortran "E" format - ie -.nnnne-mm where the minus signs may be replaced by a space if the number (or the exponent) be positive. The field width includes room for the sign and the exponent. LWRGT CALL LWRGT(f,iwidth,idigits) CWRGT cwrgt(f,iwidth,idigits); Writes the real number to the user's terminal in either "F" or "S" format depending upon the value of the number. If the number is >=1e6 or <1e-3 the number will be output in "S" format, otherwise in "F" format. ["S" format keeps the exponent a multiple of 3, and is similar to a combination of "F" and "E" formats.] LWRST CALL LWRST(f,iwidth,idigits) CWRST cwrst(f,iwidth,idigits); Writes the real number to the user's terminal in such a manner as to keep the exponent a multiple of 3. If the exponent field would thereby be zero, the exponent is not printed (but 4 spaces are output if the field width be non-zero, to keep columns of numbers aligned). CVLLIB Manual Page 6-6 Real (Floating Point) Numbers LWRFT CALL LWRFT(f,iwidth,idigits) CWRFT cwrft(f,iwidth,idigits); Writes the real number to the user's terminal in a manner similar to the Fortran "F" format. LWRE CALL LWRE(f,string,last,iwidth,idigits) CWRE cwre(&strpnt,f,iwidth,idigits); Writes the real number to in a format equivalent to the Fortran "E" format - ie -.nnnne-mm where the minus signs may be replaced by a space if the number (or the exponent) be positive. The field width includes room for the sign and the exponent. LWRG CALL LWRG(f,string,last,iwidth,idigits) CWRG cwrg(&strpnt,f,iwidth,idigits); Writes the real number to in either "F" or "S" format depending upon the value of the number. If the number is >=1e6 or <1e-3 the number will be output in "S" format, otherwise in "F" format. ["S" format keeps the exponent a multiple of 3, and is similar to a combination of "F" and "E" formats.] LWRS CALL LWRS(f,string,last,iwidth,idigits) CWRS cwrs(&strpnt,f,iwidth,idigits); Writes the real number to in such a manner as to keep the exponent a multiple of 3. If the exponent field would thereby be zero, the exponent is not printed (but 4 spaces are output if the field width be non-zero, to keep columns of numbers aligned). LWRF CALL LWRF(f,string,last,iwidth,idigits) CWRF cwrf(&strpnt,f,iwidth,idigits); Writes the real number to in a manner similar to the Fortran "F" format. LRRT I = LRRT(f,char) CRRT i=crrt(&strpnt,&f); Reads a real number from the user's terminal storing the result in and the delimiting character in . Overflow or underflow on reading is signified by a negative returned value from this function. Successful reading is indicated by a zero returned value. CVLLIB Manual Page 6-7 Real (Floating Point) Numbers LRR I = LRR(f,string,last) CRR i=crr(&strpnt,&f); Reads a real number from storing the result in and increasing by the number of characters read. A returned value of zero indicates successful reading; a negative value indicates overflow or underflow on reading the value. 6.4 Real Number Accessory Routines (Macro) CMPR Compares real numbers. Comparison of floating-point numbers presents a somewhat awkward problem, due to their being in many circumstances approximations. Fortran gets around this problem by performing a subtraction and testing the sign of the result. This unfortunately can produce a floating point exception trap (floating point underflow) should the numbers be sufficiently close, and this can be a nuisance in itself. To try to provide an alternative, the CMPR routine is provided. This compares floating point numbers (in R2,R3 and pointed to in R0) in the sense CMP R2,(R0) setting the condition codes as relevant taking into account the double precision and storage format (sign bit plus magnitude) of these numbers. Equality however will not be returned unless the numbers are exactly equal. [All helpful comments on this subject will be appreciated by the author, whose understanding of mathematics about equals his luck on the horses!] MOV ,R2 MOV ,R3 MOV ,R0 CALL CMPR BGT, BEQ, or BLT wherever needed Registers unchanged FRAC Converts a real number to another real number which is the fractional component of the of the original number. MOV ,R2 MOV ,R3 CALL FRAC R2/ R3/ CVLLIB Manual Page 6-8 Real (Floating Point) Numbers INT1 Converts a real number in R2,R3 to a single precision integer in R0. R2 and R3 are unchanged. Carry is set on return if the number is too large to be represented as a single precision integer, and the contents of R0 are undefined. The integer resulting from an INT1 conversion is rounded rather than truncated. MOV ,R2 MOV ,R3 CALL INT1 bcs R0/ Integer result INT2 Converts a real number in R2,R3 to a double precision integer in R2,R3. Carry is set on return if the number is too large to be represented as a single precision integer, and the contents of R2,R3 are undefined. The integer resulting from an INT2 conversion is rounded rather than truncated. MOV ,R2 MOV ,R3 CALL INT2 bcs R2/ R3/ INTC1 Converts a real number in R2,R3 to a single precision integer in R0. R2 and R3 are unchanged. Carry is set on return if the number is too large to be represented as a single precision integer, and the contents of R0 are undefined. The integer resulting from an INTC1 conversion is chopped (truncated) rather than rounded. MOV ,R2 MOV ,R3 CALL INTC1 bcs R0/ Integer result INTC2 Converts a real number in R2,R3 to a double precision integer in R2,R3. Carry is set on return if the number is too large to be represented as a single precision integer, and the contents of R2,R3 are undefined. The integer resulting from an INTC2 conversion is chopped (truncated) rather than rounded. MOV ,R2 MOV ,R3 CALL INTC2 bcs R2/ R3/ CVLLIB Manual Page 6-9 Real (Floating Point) Numbers FLT1 Converts a single precision integer in R0 into a real number in R2,R3. The contents of R0 are unchanged. MOV ,R0 CALL FLT1 R2/ R3/ FLT2 Converts a double precision integer in R2,R3 into a real number in R2,R3. MOV ,R2 MOV ,R3 CALL FLT2 R2/ R3/ 6.5 Real Number Accessory Routines (Fortran & C) LCMPR I = LCMPR(f1,f2) CCMPR i=ccmpr(f1,f2); Comparison of floating-point numbers presents a somewhat awkward problem, due to their being in many circumstances approximations. Fortran gets around this problem by performing a subtraction and testing the sign of the result. This unfortunately can produce a floating point exception trap (floating point underflow) should the numbers be sufficiently close, and this can be a nuisance in itself. To try to provide an alternative, the LCMPR routine is provided. Equality will not be returned unless the numbers are exactly equal. -1 is returned if f1f2. RFRAC X = RFRAC(f) CFRAC x=cfrac(f); Extracts the fractional component of the real value and returns it as the value of the function. LINT1 I = LINT1(f,n) CINT1 i=cint1(f,&n); Converts the real value to an integer . The function returns the value 0 if conversion were successful, and a negative value if the number were too great to fit in a single precision integer. The returned value is rounded rather than truncated. CVLLIB Manual Page 6-10 Real (Floating Point) Numbers LINT2 I = LINT2(f,2.n) CINT2 i=cint2(f,&2.n); Converts the real value to a double precision integer <2.n>. The function returns the value 0 if conversion were successful, and a negative value if the number were too great to fit in a double precision integer. The returned value is rounded rather than truncated. LINTC1 I = LINTC1(f,n) CINTC1 i=cintc1(f,&n); Converts the real value to an integer . The function returns the value 0 if conversion were successful, and a negative value if the number were too great to fit in a single precision integer. The returned value is chopped (truncated) rather than rounded. LINTC2 I = LINTC2(f,2.n) CINTC2 i=cintc2(f,&2.n); Converts the real value to a double precision integer <2.n>. The function returns the value 0 if conversion were successful, and a negative value if the number were too great to fit in a double precision integer. The returned value is chopped (truncated) rather than rounded. RFLT1 X = RFLT1(n) CFLT1 x=cflt1(n); Converts the single precision integer to a real value and returns that value as the value of the function. RFLT2 X = RFLT2(2.n) CFLT2 x=cflt2(2.n); Converts the double precision integer <2.n> to a real value and returns that value as the value of the function. 6.6 Real Number Arithmetic Four routines are provided in an attempt to allow machine-independent floating point arithmetic at a relatively elementary level - single precision (two words only), multiplication, division, addition, and subtraction. The calling sequence is the same for all of them - F$...F is the particular routine desired: MOV ,R2 MOV ,R3 MOV
,R0 CALL F$...F bvs CVLLIB Manual Page 6-11 Real (Floating Point) Numbers R2/ R3/ The argument in R2,R3 is the dividend, multiplicand, subtrahend etc, and the value pointed to in R0 is the divisor, multiplier, subtractor etc. The routines themselves are: F$MULF - multiplication F$DIVF - division F$ADDF - addition F$SUBF - subtraction 6.7 Real Number Arithmetic (from C programmes): The routines to permit real arithmetic from C when this is not provided within C itself are: cfmul (f1,f2,&f3); f3=f1*f2 cfdiv (f1,f2,&f3); f3=f1/f2 cfadd (f1,f2,&f3); f3=f1+f2 cfsub (f1,f2,&f3); f3=f1-f2 6.8 Real Number Ancillary Routines: Routines contained within the WRSUBS module are the ancillary routines for the real number I/O routines. R$RED Scales a real number provided in R2,R3 to within the range 0.1<=n<1.0, or zero. The power of 10 required to effect this scaling is returned in R0, and the adjusted real number in R2,R3. R$SET Reorganizes a real number provided in R2,R3 (within the range as provided by a call to R$RED [v.s.]) so as to be ready to extract the first digit from that number on conversion for printing. R2,R3 return a value which is no longer any use to anything except the subroutine R$DIG (v.i.). R$DIG Extracts the next digit from the R2,R3 value as processed by R$RED and R$SET (v.s.), returning this digit in R0, and R2,R3 set up so that the next call to R$DIG returns the next digit. CVLLIB Manual Page 6-12 Real (Floating Point) Numbers R$RND Rounds the real value in R2,R3 by addition of an appropriate value (0.5*10**-n, where is provided in R4) to allow for rounding in printing of that number. Should be greater than 8, no rounding will be performed, as it is assumed that the value in R2,R3 is within the range 0.1<=f<1.0. R0 returns any variation in exponent which may occur due to the rounding carrying the value over the value 1.0 thereby requiring rescaling back to the original range. R$TZ Trims trailing zeroes from the string pointed to in R1. Trailing zeroes are trimmed until a character which is not "0" is found. If that character be a decimal point, one zero is left following that decimal point. WRSAV Saves registers for floating point printing routines, prints the leading minus sign if the number in R2,R3 is negative, and scales that number by a call to R$RED (v.s.). 6.9 Floating Point Trap Routines The entry to the CVLLIB floating point trap routine is the global F$TRAP. The code is impure, modifying itself on the initializing FINSET (or LINSET) call to be set up for whichever hardware is available. 6.9.1 Error Message Control - F$MESG The module FP contains the floating point arithmetic and trap routines, as well as the LINSET and FINSET (v.s.) subroutines. Error messages may be typed on floating point exceptions (overflow, underflow etc), with a reference to the location at which the exception occurred. A global F$MESG is provided for control of this message. [It is into this global that the argument from the LINSET(n) subroutine is stored.] 0 A zero value in F$MESG causes no error messages to be typed. The trapping will still occur, and the result of any operation involving overflow or underflow will be zero. -1 A negative value causes the message to be typed specifying the address of the instruction which caused the trap. This is useful where the user is running a Fortran programme but using the CVLLIB routines to do his trapping for him (eg on KEV11 machines with monitors which do not support floating point, or on any machine where he wishes to use these partiular routines rather than the monitor error message). 1 [This is the default value] A positive value causes the message to be typed but using as the address the location which called the floating point arithmetic routine (assuming the use of F$MULF, F$DIVF, F$ADDF, and F$SUBF). This gives the programme location at which the error occurred rather than the address of the actual CVLLIB Manual Page 6-13 Real (Floating Point) Numbers instruction, which at this point is not particularly useful. 6.9.2 User Subroutine - F$SUB [No Fortran access to this global is provided] Should the user desire to add his own subroutine to the sequence following a floating point exception trap, the address of that subroutine should be inserted in the global F$SUB. When that routine is called, the stack situation is the same as if the monitor .SFPA routine had been called to set up the floating point trap for the user on a non-FPU machine. On FPU machines the FEC and FEA have already been removed from the stack, and reside in the globals F$ERRF and F$ADDR respectively. CHAPTER 7 Date Routines On output, Date format is the unambiguous dd-Mmm-yy. If the day value be less than 10 a space may precede the date. A flag may be passed to date writing routines to suppress this space. On input, there are three acceptable formats for the date. The form specifying the month in alphabetic characters (eg 3-Feb-82) will always be recognized, and either the British numeric month pattern (3/2/82, dd/mm/yy) or the American (2/3/82, mm/dd/yy) may be recognized additionally if desired. A flag passed to the date reading routine should be zero if only the alphabetic form of the month is to be recognized (recommended for programmes handed around internationally), positive if the British form is allowed, and negative if the American form is desired. The fields may be delimited by any character with an ascii value less than the character "0" - eg space, tab, comma, or slash. Spaces are permitted on either side of the delimiting character. The month field may be numeric (see above), or may be alpha. If alpha, only the first three letters are checked for validity, the remainder being ignored (thus 14-Dec-76 is exactly the same as 14.decadent.76). Letters may be either upper or lower case. The delimiter for the month may be any of the ones mentioned for the day. The year follows, as an integer. Many of the date routines can cope with the year either as the full four-digit value (eg 1981) or the truncated form (81), but the latter is assumed to be always modulo 1900 (ie 98 is 1998, not 1898). At least one digit must be specified for the year (note difference from general numeric read routines which will return zero on the first non-numeric character even if that were the first character encountered). If the value to Date writing routines be zero, any leading space will be suppressed. If negative, there may be a leading space. CVLLIB Manual Page 7-2 Date Routines 7.1 Date (Macro Routines): TODAYT Type name of today, and today's date, to the user's terminal. The receives system date information. MOV #,R2 CALL TODAYT CS if system date not set TODAY Type name of today, and today's date, to the string pointed to in R1. The receives system date information. MOV #,R2 MOV #,R1 CALL TODAY CS if system date not set WDAYT Type name of day to terminal. The integer provided should be from 1 to 7, giving Sunday through Saturday (full names, not just 3 characters). Illegal values result in the name "Illegal" being substituted. MOV ,R0 CALL WDAYT (no special returns) WDAY Type name of day to string pointed to in R1. The same argument is required as for WDAYT (v.s.). MOV ,R0 MOV #,R1 CALL WDAY (no special returns) WSDATT Type system date (as dd-Mmm-yy) to terminal. Returns relevant values in for user use. MOV #,R2 MOV ,R0 CALL WSDATT CS return if no system date set. WSDAT Type system date (as dd-Mmm-yy) to string pointed to in R1. Returns relevant values in for user use. MOV #,R2 MOV #,R1 MOV ,R0 CALL WSDAT CS return if no system date set. CVLLIB Manual Page 7-3 Date Routines WDATT Type date (from ) as dd-Mmm-yy to terminal. No checking is performed on the information in , illegal month values producing "XXX". MOV #,R2 MOV ,R0 CALL WDATT (no special returns) WDAT Type date (from ) as dd-Mmm-yy to string pointed to in R1. No checking is performed on the information in , illegal month values producing "XXX". MOV #,R2 MOV #,R1 MOV ,R0 CALL WDAT (no special returns) RSDAT Read system date into . This is read in RT11 format into the RTDAT offsett in , and if it is non-zero (ie a date has been entered on the system) conversion is performed into the offsets DAY, MONTH, and YEAR in the . MOV #,R2 CALL RSDAT CS return if no system date set RDATT Read date from the terminal (in any of the formats mentioned at the start of this section) into , checking its validity, and setting up the DYEAR and RTDAT offsets in also. A year value beyond the range of RT-11 will leave the year field in RTDAT null (ie = 1972). R1 points to the delimiting character. For details of see the top of this chapter. (0=alpha month only, 1=British dd.mm.yy allowed, -1=American mm.dd.yy) MOV ,R0 MOV #,R2 CALL RDATT (CS return if illegal date) R1/pointer to delimiter R0/ -1 if illegal date, else 1-7 (Sunday to Saturday) to indicate day of week corresponding to that date. CVLLIB Manual Page 7-4 Date Routines RDAT Read date from the string pointed to in R1 as per RDATT above. MOV ,R0 MOV #,R2 MOV #,R1 CALL RDAT (returns as per RDATT) DATDIF Calculates difference (in days) between two days, passed in style arguments to DATDIF in R2 and R0. Effectively subtracts the date pointed to in R0 from the date pointed to in R2, returning a double precision number of days, positive or negative as relevant depending upon which date occurred first. MOV #,R2 Date from which this MOV #,R0 date is subtracted CALL DATDIF CS if either date illegal or before 1600 R2,R3/2.precis number of days from to DATCAL Calculate date given the year and the day of that year (positive or negative, and may span years in either direction). These arguments are provided in the offsets YEAR and DYEAR, and the offsets DAY, MONTH, YEAR, and DYEAR are altered to be set to the calculated date. (The RTDAT offset is unaltered). MOV #,R2 CALL DATCAL CS return if year <1600 Values returned in AGE Determine age, given date of birth and date on which age is to be calculated. The age is returned in years and months, with the carry set return taken if the person is not born on the date specified. MOV #,R0 {date of birth} MOV #,R2 {"present" date} CALL AGE CS if not born yet R0/age in years R2/and months IDAY Check validity of date, returning day of week corresponding to that date. This only works on dates from 1600 on. MOV #,R2 CALL IDAY (returns as per RDATT above) CVLLIB Manual Page 7-5 Date Routines CRDATW Converts RT-11 date in offset RTDAT into day, month, and year values in their relevant offsets. No error indication is given. MOV #,R2 CALL CRDATW CWDATR Converts day, month, and year values from their relevant offsets into RT-11 date format in the RTDAT offset. No error indication is given. Years outside the valid RT-11 range are left with a null year field (= 1972). MOV #,R2 CALL CWDATR CHAPTER 8 Time Routines The RT-11 format for time is a two-word integer using the same format as the other two-word routines in this library - having the highest order bits in the first (lowest address) word, and the low order bits in the second word. (This is the opposite to the INTEGER*4 support offered in SYSLIB.) The format is described in an earlier chapter of this manual. Routines which write time values require a argument (in R0 for Macro routines, or as an argument for Fortran routines). If the low-order byte of be zero, the hours and minutes only are typed (hh:mm). If non-zero, the seconds are also typed (hh:mm:ss). [There are no routines for typing fractions of a second in this library.] If the sign bit of is not set, no leading space will precede the HOURS value, even if that value is less than 10. If the sign bit is set, a space will precede the HOURS value if its value is less than 10. (Minute and second fields always have 2 digits, even if the first be a leading zero.) Routines which read time expect a series of decimal numbers, taken in sequence as hours, minutes, seconds, and clock ticks. Unused fields will be taken to be zero. Any non-alphanumeric character may be used as the delimiter. AM or PM may be suffixed to the last field, but the hours returned will always be in 24-hour format. (The "M" in AM or PM is optional. Upper or lower case may be used.) 8.1 Time (Macro Routines): WSTIMT Writes system time to the terminal. Returns present time information in . MOV #,R2 MOV ,R0 CALL WSTIMT CVLLIB Manual Page 8-2 Time Routines WSTIM Writes system time to a string pointed to in R1. Returns present time information in . MOV #,R2 MOV #,R1 MOV ,R0 CALL WSTIM WTIMT Writes time from to the user's terminal. MOV #,R2 MOV ,R0 CALL WTIMT WTIM Writes time from to a string pointed to in R1. MOV #,R2 MOV ,R0 CALL WTIM RSTIM Reads system time information into the RTIM1 and RTIM2 offsets in , also setting up the TCLOCK offset to 50 or 60 depending upon the frequency of the system clock. The time is converted to hours, minutes etc in the relevant offsets. MOV #,R2 CALL RSTIM RTIMT Reads a time value from the user's terminal in the formats as described at the head of this chapter. The offsets HOURS, MINS, and SECS are set up from the user's type-in, and the RTIM1 and RTIM2 values set up using the conversion factor supplied by the user in the TCLOCK offset in the same . R1 points to the delimiting character. MOV #,R2 CALL RTIMT R1/pointer to delimiter CS return if illegal time specified RTIM Reads a time value from a string pointed to in R1, as per RTIMT. MOV #,R2 MOV #,R1 CALL RTIM CS return if illegal time specified CVLLIB Manual Page 8-3 Time Routines CRTIMW Convert RT11 time in RTIM1 and RTIM2 offsets in into individual words in offsets HOURS, MINS, SECS, and TICKS in the same . The conversion factor used must be supplied by the user in the TCLOCK offset of the (50. for a 50Hz line clock, and 60. for a 60Hz clock). MOV #,R2 CALL CRTIMW CWTIMR Convert time in offsets HOURS, MINS, SECS, and TICKS within into RT11 time format in RTIM1 and RTIM2 offsets within the same . The conversion factor used must be supplied by the user in the TCLOCK offset of the (50. for a 50Hz line clock, and 60. for a 60Hz clock). MOV #,R2 CALL CWTIMR CHAPTER 9 Filename & Radix50 Formats Routines which handle filenames require a "fileblock" of 4 or 5 words as described in the chapter on Special Block Formats earlier in this manual. This block contains or receives details of a file - the device, filename, and extension (file type) in Radix50 format, and (optionally for writing) the file size as an integral number of blocks, each block being 512 characters long. Routines which write filenames require a to determine output format. If the sign bit of be set, spaces in the device, filename, and extension subfields will be left in the final result. If not set, trailing spaces will be suppressed from each subfield. [Thus =neg "DK: FRED .C " vs =pos "DK:FRED.C"] If the low order byte in be non-zero, the file size will be output. If zero, no size will be appended to the filename. In Radix50 output, the unassigned Radix50 code is encoded as "*", and on input the "*" sign is converted into that unassigned code. In filename format output, the "." character will be converted to the wildcard "%" character, as per CSI filename conversions. Macro routines which read Radix50 codes read up to three characters. Their Fortran equivalents read up to six characters into a double precision argument. 9.1 Filename & Radix50 (Macro Routines): WFT Writes a filename from to the user's terminal. MOV #,R2 MOV ,R0 CALL WFT CVLLIB Manual Page 9-2 Filename & Radix50 Formats WF Writes a filename from to the string pointed to in R1. MOV #,R2 MOV #,R1 MOV ,R0 CALL WF W50FT Writes a Radix50 value (3 characters) using the filename set (ie "." converted to "%") to the terminal MOV ,R0 CALL W50T W50T Writes a Radix50 value (3 characters) to the terminal. MOV ,R0 CALL W50T W50F Writes a Radix50 value (3 characters) to a string pointed to in R1, using the filename convention (ie "." converted to wildcard "%"). MOV #,R1 MOV ,R0 CALL W50F W50 Writes a Radix50 value (3 characters) to a string pointed to in R1. MOV #,R1 MOV ,R0 CALL W50 RFT Reads a filename from the terminal into , returning unspecified fields null. R1 points to the delimiting character on return, and the carry bit will be set if an error were found in the specification. MOV #,R2 CALL RFT R1/pointer to delimiter CS return if illegal filename syntax RF Reads a filename from the string pointed to in R1 into , returning unspecified fields null. MOV #,R2 MOV #,R1 CALL RF CS return if illegal filename syntax CVLLIB Manual Page 9-3 Filename & Radix50 Formats RFDT Reads a filename from the terminal into , allowing default device and extension fields to be specified by the user. If specified as null, these fields will be returned null (eg ":X.") but otherwise will be unchanged from their value at calling. R1 points to the delimiting character. MOV #,R2 (set up defaults within ) CALL RFDT R1/pointer to delimiter CS return if illegal filename syntax RFD Reads a filename from the string pointed to in R1 into , allowing defaults as per RFDT. MOV #,R2 MOV #,R1 CALL RFDT CS return if illegal filename syntax R50ST Reads up to 3 Radix50 characters from the terminal, allowing the "symbol set" of Radix50 characters (ie full stop is a character, but space is a delimiter). The value is returned in R0, and R1 points to the delimiting character. CALL R50ST R0/value of rad50 chars R1/pointer to delimiter R50FT Reads up to 3 Radix50 characters from the terminal, allowing the "filename set" of Radix50 characters (ie full stop and space are both delimiters). The value is returned in R0, and R1 points to the delimiting character. CALL R50FT R0/value of rad50 chars R1/pointer to delimiter R50T Reads up to 3 Radix50 characters from the terminal, allowing the full Radix50 character set (including full stop and space). The value is returned in R0, and R1 points to the delimiting character. CALL R50T R0/value of rad50 chars R1/pointer to delimiter CVLLIB Manual Page 9-4 Filename & Radix50 Formats R50S Reads up to 3 Radix50 characters from the string pointed to in R1, allowing the "symbol set" - see R50ST above. MOV #,R1 CALL R50S R0/value of rad50 chars R50F Reads up to 3 Radix50 characters from the string pointed to in R1, allowing the "filename set" - see R50FT above. MOV #,R1 CALL R50F R0/value of rad50 chars R50 Reads up to 3 Radix50 characters from the string pointed to in R1, allowing the full Radix50 character set. MOV #,R1 CALL R50 R0/value of rad50 chars CA50 Converts an Ascii character in R0 to its Radix50 equivalent, returned in R0. The "*" character is converted to the unassigned Radix50 code, and the "%" character has the same value as the ".". A character with no equivalent causes return with the Carry bit set, and the characters space and full stop cause return with the Zero bit set, for subsequent testing as desired with BEQ or BNE. MOV ,R0 CALL CA50 R0/rad50 equivalent C50A Converts a Radix50 character in R0 to its Ascii equivalent, returned in R0. The unassigned Radix50 code is converted to the "*" character, and illegal characters return the character "?" with Carry set. MOV ,R0 CALL C50A R0/ascii equivalent DIG3 Converts a number into a 3-digit radix50 representation of that number with leading zeroes. This is useful for producing a series of files with names such as DAT001.TMP, DAT002.TMP etc. MOV ,R0 CALL DIG3 CS if number >1000. R0/radix50 rep. of number CHAPTER 10 Triple-Precision Money Routines The triple precision format comprises three consecutive words. The highest order bits are in the first word (word with the lowest address), then the intermediate order bits, then the lowest order bits in the third word. The numbers are taken as a 48-bit twos-complement signed integer, expressing the number of cents in the value concerned. This leads to an upper limit of approximately $14 x 10**11 (1.4 {British} billion). On output, values may be preceded by a dollar sign (routines with a "D" in the name). If the value be negative, the minus sign will precede the dollar. On input, values may be preceded by a dollar sign and/or a minus sign which may be before or after the dollar sign. Overflow on input is indicated by the Carry bit being set (Macro routines) or a value of -1 being returned as the value of the function (Fortran and C routines). A single digit after the decimal point is taken to be a decimal of a dollar (eg "$12.34" returns the value 1234, but "$12.5" returns 1250). WM3DPT Write triple precision integer in money format, preceded by a floating dollar sign, with a specified field width, to the user's terminal. MOV #<3.value>,R0 MOV ,R2 CALL WM3DPT WM3PT Write triple precision integer in money format (no dollar sign) with a specified field width, to the user's terminal MOV #<3.value>,R0 MOV ,R2 CALL WM3PT CVLLIB Manual Page 10-2 Triple-Precision Money Routines WM3DT Write triple precision integer in money format, preceded by a floating dollar sign, to the user's terminal. MOV #<3.value>,R0 CALL WM3DT WM3T Write triple precision integer in money format (no dollar sign) to the user's terminal MOV #<3.value>,R0 CALL WM3T WM3DP Write triple precision integer in money format, preceded by a floating dollar sign, with a specified field width, to a string pointed to in R1. MOV #<3.value>,R0 MOV #,R1 MOV ,R0 CALL WM3DP WM3P Write triple precision integer in money format (no dollar sign) with a specified field width, to a string pointed to in R1. MOV #<3.value>,R0 MOV #,R1 MOV ,R0 CALL WM3P WM3D Write triple precision integer in money format, preceded by a floating dollar sign, to a string pointed to in R1. MOV #<3.value>,R0 MOV #,R1 CALL WM3D WM3 Write triple precision integer in money format (no dollar sign) to a string pointed to in R1. MOV #<3.value>,R0 MOV #,R1 CALL WM3 RM3T Reads a triple precision integer from the terminal, in money format converting it into an integral number of cents in <3.value>. MOV #<3.value>,R0 CALL RM3T R1/pointer to delimiter CS return if overflow occurred CVLLIB Manual Page 10-3 Triple-Precision Money Routines RM3 Reads a triple precision integer from a string pointed to in R1, in money format converting it into an integral number of cents in <3.value>. MOV #<3.value>,R0 MOV #,R1 CALL RM3 CS return if overflow occurred CHAPTER 11 Triple-Precision Integers - I/O Triple-precision integers are stored in three consecutive words with the highest-order bits occupying the first word (with the lowest address). They are treated as 48-bit two's-complement signed numbers. Routines are provided to read, write, and arithmetically manipulate (see next chapter) these numbers. Decimal radix only is provided for triple precision numbers in this library (octal & hexadecimal are provided only in single & double precision). The maximum value for a triple-precision number is slightly over 14 x 10**13 or 140 {British} billion. 11.1 Triple-Precision I/O (Macro Routines): WD3PT Writes a triple precision integer (pointed to in R0) to the user's terminal, allowing a field width to be specified. MOV #<3.value>,R0 MOV ,R2 CALL WD3PT WD3T Writes a triple precision integer (pointed to in R0) to the user's terminal. MOV #<3.value>,R0 CALL WD3T WD3P Writes a triple precision integer (pointed to in R0) to the string pointed to in R1, allowing a field width to be specified. MOV #<3.value>,R0 MOV #,R1 MOV ,R2 CALL WD3P CVLLIB Manual Page 11-2 Triple-Precision Integers - I/O WD3 Writes a triple precision integer (pointed to in R0) to the string pointed to in R1. MOV #<3.value>,R0 MOV #,R1 CALL WD3 RD3T Reads a triple precision integer from the user's terminal, returning CS if overflow occurred. MOV #<3.value>,R0 CALL RD3T R1/pointer to delimiter CS return if overflow occurred RD3 Reads a triple precision integer from the string pointed to in R1, returning CS if overflow occurred. MOV #<3.value>,R0 MOV #,R1 CALL RD3 CS return if overflow occurred CHAPTER 12 Triple-Precision Arithmetic 12.1 Triple-Precision Arithmetic (Macro Routines): MUL31 Multiplies a triple precision integer by a single precision integer, producing a triple precision result. Carry is set on return if overflow occurred. The result replaces the triple precision value pointed to in R2. R0 and R2 are unchanged. MOV #<3.value>,R2 MOV <1.value>,R0 CALL MUL31 CS return if overflow MUL33 Multiplier two triple precision integers, producing a 6-word long integer result. On return, Carry is set if the result were too long to fit in a triple precision integer. R0, R2 and R3 are unchanged. MOV #<3.value>,R0 MOV #<3.value>,R2 MOV #<6.value>,R3 CALL MUL33 CS if >48 bit result DIV31 Divides a triple precision integer by a single precision integer. Carry and Overflow are set on return if divide-by-zero be attempted. The quotient replaces the dividend, and the remainder replaces the divisor. R2 is unchanged. MOV #<3.value>,R2 MOV <1.value>,R0 CALL DIV31 CS, VS if divide-by-0 R2/pointer to quotient R0/remainder CVLLIB Manual Page 12-2 Triple-Precision Arithmetic DIV33 Divides a triple precision number (pointed to in R2) by another triple precision number (pointed to in R0). Returns the quotient replacing the number pointed to in R2, and the remainder in the number pointed to in R0. If divide-by-zero is attempted, the Carry bit is set on return. R0 and R2 are unchanged. MOV #<3.value>,R2 {dividend} MOV #<3.value>,R0 {divisor} CALL DIV33 CS if divide-by-zero R2/pointer to quotient R0/pointer to remainder NEG3 Negates a triple precision integer in situ, pointed to in R0. R0 is unchanged. MOV #<3.value>,R0 CALL NEG3 R0/pointer to negated value NEG32 Negates a triple precision integer in situ, pointed to in R2. R2 is unchanged. MOV #<3.value>,R2 CALL NEG32 R2/pointer to negated value CMP3 Compares two triple precision values pointed to in R0 and R2 in a manner equivalent to CMP (R0),(R2) taking into account the triple precision nature of the arguments. R0 and R2 are unchanged. MOV #<3.value>,R0 MOV #<3.value>,R2 CALL CMP3 flags set as per CMP instruction ADD3 Adds two triple precision values, pointed to in R0 and R2, replacing the value originally pointed to in R2 with the sum of the two. R0 and R2 are unchanged. MOV #<3.value>,R0 MOV #<3.value>,R2 CALL ADD3 R2/pointer to sum CVLLIB Manual Page 12-3 Triple-Precision Arithmetic SUB3 Subtracts two triple precision values, pointed to in R0 and R2, in a manner equivalent to SUB (R0),(R2) taking into account the triple precision nature of the values. The result replaces the number pointed to in R2. R0 and R2 are unchanged. MOV #<3.value>,R0 MOV #<3.value>,R2 CALL SUB3 R2/pointer to difference CHAPTER 13 Double-Precision Money Format Money values are internally stored as an integral number of cents. They are output as $ddd.cc (eg 3680 becomes $36.80), optionally with the floating dollar sign (routines with "D" in the name). On output negative numbers will have the minus sign before the leading dollar. On input numbers may be preceded by a dollar sign and/or a minus sign for negative numbers. This may come before or after the dollar sign. Spaces may precede the dollar sign, or come between the dollar sign and the number itself. On input, a number with no decimal point will be taken as dollars only. (Thus $4 produces 400). A number with only one digit after the decimal point will be taken in the arithmetic sense of that decimal fraction of a dollar - ie $3.5 becomes 350. Scanning of the input line stops either at an invalid character or after two digits have been read after the decimal point. 13.1 Double-Precision Money (Macro Routines): WMDPT Write double precision money value to the user's terminal, with a floating dollar sign, specifying the field width. MOV ,R2 MOV ,R3 MOV ,R0 CALL WMDPT WMPT Write double precision money value to the user's terminal, without a dollar sign, specifying the field width. MOV ,R2 MOV ,R3 MOV ,R0 CALL WMPT CVLLIB Manual Page 13-2 Double-Precision Money Format WMDT Write double precision money value to the user's terminal, with a floating dollar sign. MOV ,R2 MOV ,R3 CALL WMDT WMT Write double precision money value to the user's terminal, without a dollar sign. MOV ,R2 MOV ,R3 CALL WMT WMDP Write double precision money value to a string pointed to in R1, with a floating dollar sign, specifying the field width. MOV ,R2 MOV ,R3 MOV #,R1 MOV ,R0 CALL WMDP WMP Write double precision money value to a string pointed to in R1, without a dollar sign, specifying the field width. MOV ,R2 MOV ,R3 MOV #,R1 MOV ,R0 CALL WMP WMD Write double precision money value to a string pointed to in R1, with a floating dollar sign. MOV ,R2 MOV ,R3 MOV #,R1 CALL WMD WM Write double precision money value to a string pointed to in R1, without a dollar sign. MOV ,R2 MOV ,R3 MOV #,R1 CALL WM CVLLIB Manual Page 13-3 Double-Precision Money Format RMT Reads a double precision money value from the user's terminal. This value may be in any of the forms mentioned at the top of this chapter, and is converted into an integral number of cents. On return, if overflow occurred reading the number, the Carry bit will be set. CALL RMT R1/points to delimiter R2/hi-ord value R3/lo-ord value CS if overflow occurred RM Reads a double precision money value from the string pointed to in R1. This value may be in any of the forms mentioned at the top of this chapter, and is converted into an integral number of cents. On return, if overflow occurred reading the number, the Carry bit will be set. MOV #,R1 CALL RM R1/points to delimiter R2/hi-ord value R3/lo-ord value CS if overflow occurred CHAPTER 14 Double-Precision Integer I/O Double precision integers as handled by this library are stored with their high order word first (ie lowest address) and their low order word in the second word (higher address). This is the same as the RT-11 time format, but the reverse of the format offered in SYSLIB INTEGER*4 support. On input, either decimal or octal numbers may be read as signed (31 bits plus sign) two's complement values, or as unsigned (32 bit) values. On output decimal numbers are always signed, and octal output may be signed or unsigned. 14.1 Writing Double-Precision Integers (Macro Routines): WD2PT Write double precision integer in decimal format to the user's terminal, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV ,R0 CALL WD2PT WD2T Write double precision integer in decimal format to the user's terminal. MOV ,R2 MOV ,R3 CALL WD2T WD2P Write double precision integer in decimal format to string pointed to in R1, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV #,R1 MOV ,R0 CALL WD2P CVLLIB Manual Page 14-2 Double-Precision Integer I/O WD2 Write double precision integer in decimal format to string pointed to in R1. MOV ,R2 MOV ,R3 MOV #,R1 CALL WD2 W82SPT Write double precision integer in signed octal format to the user's terminal, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV ,R0 CALL W82SPT W82PT Write double precision integer in unsigned octal format to the user's terminal, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV ,R0 CALL W82PT W82ST Write double precision integer in signed octal format to the user's terminal. MOV ,R2 MOV ,R3 CALL W82ST W82T Write double precision integer in unsigned octal format to the user's terminal. MOV ,R2 MOV ,R3 CALL W82T W82SP Write double precision integer in signed octal format to the string pointed to in R1, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV #,R1 MOV ,R0 CALL W82SP CVLLIB Manual Page 14-3 Double-Precision Integer I/O W82P Write double precision integer in unsigned octal format to the string pointed to in R1, specifying the minimum field width for the number to be right justified within. MOV ,R2 MOV ,R3 MOV #,R1 MOV ,R0 CALL W82P W82S Write double precision integer in signed octal format to the string pointed to in R1. MOV ,R2 MOV ,R3 MOV #,R1 CALL W82S W82 Write double precision integer in unsigned octal format to the string pointed to in R1. MOV ,R2 MOV ,R3 MOV #,R1 CALL W82 WH2T Write double precision integer in unsigned hexadecimal format to the user's terminal, using any defined hex prefix or suffix characters (see chapter 1). MOV ,R2 MOV ,R3 CALL WH2T WH2 Write double precision integer in unsigned hexadecimal format to the string pointed to in R1, using any defined hex prefix or suffix characters (see chapter 1). MOV ,R2 MOV ,R3 MOV #,R1 CALL W82 14.2 Reading Double-Precision (Macro Routines): RN2T Reads a double precision integer from the user's terminal into R2,R3. The number is taken to be hexadecimal should it contain A-F (or a-f), or if it should be prefixed by a hex prefix character (see chapter 1) or followed by a hex suffix character (ibid). Otherwise it will be taken to be decimal if it contain 8 or 9, or be followed by a decimal point (the decimal point will be read, and the character following it CVLLIB Manual Page 14-4 Double-Precision Integer I/O will be the delimiting character). Otherwise it will be taken as octal. CALL RN2T R2/ R3/ R1/pointer to delimiter CS if overflow occurred RN2 Reads a double-precision integer from a string in a manner analogous to RN2T. RD2ST Reads a signed double precision decimal number from the user's terminal. On return Carry is set if overflow (31 bit + sign) occurred on reading the number. CALL RD2ST R2/ R3/ R1/pointer to delimiter CS if overflow occurred RD2T Reads an unsigned double precision decimal number from the user's terminal. On return Carry is set if overflow (32 bit) occurred on reading the number. CALL RD2T R2/ R3/ R1/pointer to delimiter CS if overflow occurred RD2S Reads a signed double precision decimal number from a string pointed to in R1. On return Carry is set if overflow (31 bit + sign) occurred on reading the number. MOV #,R1 CALL RD2S R2/ R3/ CS if overflow occurred RD2 Reads an unsigned double precision decimal number from a string pointed to in R1. On return Carry is set if overflow (32 bit) occurred on reading the number. MOV #,R1 CALL RD2 R2/ R3/ CS if overflow occurred CVLLIB Manual Page 14-5 Double-Precision Integer I/O R82ST Reads a signed double precision octal number from the user's terminal. On return Carry is set if overflow (31 bit + sign) occurred on reading the number. CALL R82ST R2/ R3/ R1/pointer to delimiter CS if overflow occurred R82T Reads an unsigned double precision octal number from the user's terminal. On return Carry is set if overflow (32 bit) occurred on reading the number. CALL R82T R2/ R3/ R1/pointer to delimiter CS if overflow occurred R82S Reads a signed double precision octal number from a string pointed to in R1. On return Carry is set if overflow (31 bit + sign) occurred on reading the number. MOV #,R1 CALL R82S R2/ R3/ CS if overflow occurred R82 Reads an unsigned double precision octal number from a string pointed to in R1. On return Carry is set if overflow (32 bit) occurred on reading that number. RH2T Reads an unsigned double precision hexadecimal number from the user's terminal. On return Carry is set if overflow (32 bit) occurred on reading the number. Hex prefix and suffix characters (see chapter 1) will be discarded. CALL RH2T R2/ R3/ R1/pointer to delimiter CS if overflow occurred RH2 Reads an unsigned double precision hexadecimal number from a string pointed to in R1. On return Carry is set if overflow (32 bit) occurred on reading that number. Hex prefix and suffix characters (see chapter 1) will be discarded. CHAPTER 15 Double-Precision Arithmetic 15.1 Double-Precision Arithmetic (Macro Routines): Note that there is no Macro routine for the negation of double-precision quantities, this being sufficiently performed by the sequence: NEG NEG SBC MUL21 Multiply a double precision integer (in R2,R3) by a single precision integer (in R0) to produce a double precision result in R2,R3. On return, Carry is set if overflow (signed) occurred. The arguments and the result are signed. MOV ,R2 {multiplicand} MOV ,R3 MOV ,R0 {multiplier} CALL MUL21 R2/ R3/ CS if overflow occurred MUL22 Multiply two double precision signed integers to produce a double precision signed integer, with Carry set on return if overflow occurred. (If greater than double precision is required for the result, use the triple precision routine MUL33). MOV ,R2 {multiplicand} MOV ,R3 { " } MOV #,R0 {multiplier} CALL MUL22 R2/ R3/ CS if overflow occurred CVLLIB Manual Page 15-2 Double-Precision Arithmetic DIV21 Divide a signed double precision integer by a signed single precision integer, returning a double precision quotient and a single precision remainder. Carry is set on return should divide-by-zero be attempted. MOV ,R2 {dividend} MOV ,R3 MOV ,R0 {divisor} CALL DIV21 R2/ R3/ R0/remainder CS if divisor=0 ADD2 Adds two double precision signed integers, returning with Carry set if overflow occurred. The sum replaces the number originally pointed to in R0. MOV ,R2 MOV ,R3 MOV #,R0 CALL ADD2 R0/pointer to sum CS if overflow occurred SUB2 Subtracts a double precision integer in R2,R3 from a double precision integer pointed to in R0. The difference replaces the number originally pointed to in R0. Carry is set on return should overflow occur. MOV ,R2 MOV ,R3 MOV #,R0 CALL SUB2 R0/pointer to difference CS if overflow occurred CMP2 Compares two double precision integers, one in R2,R3 and one pointed to in R0, in manner similar to CMP R2,(R0) but taking into account the double precision nature of the quantities concerned. MOV ,R2 MOV ,R3 MOV #,R0 CALL CMP2 Flags set as per CMP R2,(R0) but using both words of each. CHAPTER 16 Single-Precision Integer I/O 16.1 Writing Single-Precision Integers (Macro Routines): Note the change with Release 4 of CVLLIB: WD now writes UNSIGNED decimal numbers, with WDS writing signed decimal numbers. WDSPT Writes a signed decimal number to the user's terminal, right justified in a field minimally wide. MOV ,R0 MOV ,R2 CALL WDSPT WDPT Writes an unsigned decimal number to the user's terminal, right justified in a field minimally wide. MOV ,R0 MOV ,R2 CALL WDPT WDST Writes a signed decimal number to the user's terminal. MOV ,R0 CALL WDST WDT Writes an unsigned decimal number to the user's terminal. MOV ,R0 CALL WDT WDSP Writes a signed decimal number to a string pointed to in R1, right justified in a field minimally wide. MOV ,R0 MOV #,R1 MOV ,R2 CALL WDSP CVLLIB Manual Page 16-2 Single-Precision Integer I/O WDP Writes an unsigned decimal number to a string pointed to in R1, right justified in a field minimally wide. MOV ,R0 MOV #,R1 MOV ,R2 CALL WDP WDS Writes a signed decimal number to a string pointed to in R1. MOV ,R0 MOV #,R1 CALL WDS WD Writes an unsigned decimal number to a string pointed to in R1. MOV ,R0 MOV #,R1 CALL WD W8SPT Writes a signed octal number to the user's terminal, right justified in a field minimally wide. MOV ,R0 MOV ,R2 CALL W8SPT W8PT Writes an unsigned octal number to the user's terminal, right justified in a field minimally wide. MOV ,R0 MOV ,R2 CALL W8PT W8ST Writes a signed octal number to the user's terminal. MOV ,R0 CALL W8ST W8T Writes an unsigned octal number to the user's terminal. MOV ,R0 CALL W8T W8SP Writes a signed octal number to a string pointed to in R1, right justified in a field minimally wide. MOV ,R0 MOV #,R1 MOV ,R2 CALL W8SP CVLLIB Manual Page 16-3 Single-Precision Integer I/O W8P Writes an unsigned octal number to a string pointed to in R1, right justified in a field minimally wide. MOV ,R0 MOV #,R1 MOV ,R2 CALL W8P W8S Writes a signed octal number to a string pointed to in R1. MOV ,R0 MOV #,R1 CALL W8S W8 Writes an unsigned octal number to a string pointed to in R1. MOV ,R0 MOV #,R1 CALL W8 WHT Writes an unsigned hexadecimal number to the user's terminal, using any defined hex prefix or suffix characters (see chapter 1). MOV ,R0 CALL WHT WH Writes an unsigned hexadecimal number to a string pointed to in R1, using any defined hex prefix or suffix characters (see chapter 1). MOV ,R0 MOV #,R1 CALL WH 16.2 Reading Single-Precision Integers (Macro Routines): RNT Read a signed number (octal, decimal or hexadecimal) from the user's terminal. A number is taken to be hexadecimal should it contain A-F (or a-f), or if it should be prefixed by a hex prefix character (see chapter 1) or followed by a hex suffix character (ibid). Otherwise it will be taken to be decimal if it contain 8 or 9, or be followed by a decimal point (the decimal point will be read, and the character following it will be the delimiting character). Otherwise it will be taken as octal. Carry is set on return if overflow occurred on reading the number. CALL RNT R0/value R1/pointer to delimiter CS if overflow occurred CVLLIB Manual Page 16-4 Single-Precision Integer I/O RN Read a signed number (octal, decimal or hexadecimal) from a string pointed to in R1. Analogous to RNT (v.s.). MOV #,R1 CALL RN R0/value CS if overflow occurred RDST Read a signed decimal number from the user's terminal. Returns with Carry set if overflow (31 bit + sign) occurred on reading the number. CALL RDST R0/value R1/pointer to delimiter CS if overflow occurred RDT Read an unsigned decimal number from the user's terminal. Returns with Carry set if overflow (32 bit) occurred on reading the number. CALL RDT R0/value R1/pointer to delimiter CS if overflow occurred RDS Read a signed decimal number from a string pointed to in R1. Returns with Carry set if overflow (31 bit + sign) occurred on reading the number. MOV #,R1 CALL RDS R0/value CS if overflow occurred RD Read an unsigned decimal number from a string pointed to in R1. Returns with Carry set if overflow (32 bit) occurred on reading the number. MOV #,R1 CALL RD R0/value CS if overflow occurred R8ST Read a signed octal number from the user's terminal. Returns with Carry set if overflow (31 bit + sign) occurred on reading the number. CALL R8ST R0/value R1/pointer to delimiter CS if overflow occurred CVLLIB Manual Page 16-5 Single-Precision Integer I/O R8T Read an unsigned octal number from the user's terminal. Returns with Carry set if overflow (32 bit) occurred on reading the number. CALL R8T R0/value R1/pointer to delimiter CS if overflow occurred R8S Read a signed octal number from a string pointed to in R1. Returns with Carry set if overflow (31 bit + sign) occurred on reading the number. MOV #,R1 CALL R8S R0/value CS if overflow occurred R8 Read an unsigned octal number from a string pointed to in R1. Returns with Carry set if overflow (32 bit) occurred on reading the number. MOV #,R1 CALL R8 R0/value CS if overflow occurred RHT Read a signed hexadecimal number from the user's terminal. Returns with Carry set if overflow (32 bit) occurred on reading the number. CALL RHT R0/value R1/pointer to delimiter CS if overflow occurred RH Read a signed hexadecimal number from a string pointed to in R1. Returns with Carry set if overflow (32 bit) occurred on reading the number. MOV #,R1 CALL RH R0/value CS if overflow occurred CHAPTER 17 String Comparison Routines String comparisons are provided in CVLLIB in a rather elementary form. No wildcard comparisons are provided for. Facilities include: COMPARISON: Performed on ASCII values, byte by byte, with handling of case and parity as mentioned below. TERMINATION: Strings are regarted as being terminated by either a zero or a <200> byte. PARITY BIT: Ignored on all searches. GENERAL COMPARISON: Upper case alphabetic characters are regarded as the same as their lower case equivalents (ie "a" = "A") EXACT COMPARISON: Upper case alphabetic characters are regarded as different from their lower case equivalents (ie "z" <> "Z") FIXED LENGTH: Strings must be the same length to match. Inequality of length in strings equal to the length of the lesser leads to the longer string being counted as the greater. VARIABLE LENGTH: The first string specified as an argument to the variable length comparisons may be shorter than the second, and provided the strings are equal up to the length of this first string, equality will be returned. 17.1 String Comparisons (Macro Routines) The calling sequence for Macro String Comparison Routines is: Mov #,R0 ;Address of first string Mov #,R1 ;Address of second string Call ROUTINE R0/ pointer to byte after one last compared R1/ ibid, R1 string Condition codes set as relevant SCG String compare, general SCX String compare, exact CVLLIB Manual Page 17-2 String Comparison Routines SCGV String compare, general, variation in length still allows equality SCXV String compare, exact, variation in length still allows equality CHAPTER 18 Various Additional Routines 18.1 Case Conversion Routine: The routine CASE$ is used by the string comparison routines and the hexadecimal number reading routines to strip characters of their parity bits and their case. Upper case characters are returned unchanged, and lower case characters are converted to upper case. Mov ,-(SP) Call CASE$ Mov (SP)+, 18.2 Size Conversion Routines: Routines which convert between single, double, and triple precision integers are provided for both Macro and Fortran use. On reduction in precision, error indication is given should it not be possible to contain the number in the reduced space. 18.2.1 Size Conversion (Macro Routines): C12 Converts single precision integer to double precision. MOV ,R0 CALL C12 R2/ R3/ CVLLIB Manual Page 18-2 Various Additional Routines C13 Converts single precision integer to triple precision. MOV ,R0 MOV #<3.value>,R2 {for result} CALL C13 R2/pointer to 3.result C23 Converts double precision integer to triple precision. MOV ,R2 MOV ,R3 MOV #<3.value>,R0 {for result} CALL C23 R0/pointer to 3.result C21 Converts double to single precision integer. Carry is set on return if the number cannot be expressed in 15 bits + sign. MOV ,R2 MOV ,R3 CALL C21 R0/ CS if didn't fit C32 Converts triple to double precision integer. Carry is set on return if the number cannot be expressed in 31 bits + sign. MOV #<3.value>,R0 CALL C32 R2/ R3/ CS if didn't fit C31 Converts triple to single precision integer. Carry is set on return if the number cannot be expressed in 15 bits + sign. MOV #<3.value>,R2 CALL C31 R0/ CS if didn't fit 18.3 Additional Utilities etc 18.3.1 Additional Utilities (Macro): MUL11 Signed single-precision integer multiplication. Multiplies integers in R0 and R2, providing a double-precision result in R2,R3. Carry is set on return if the result cannot be expressed as a single precision integer. CVLLIB Manual Page 18-3 Various Additional Routines MOV ,R2 MOV ,R0 CALL MUL11 R2/ R3/ CS if result > 15 bits + sign MULX Unsigned single precision integer multiplication with no checks for anything. This routine is not used by any of the library routines, and is provided for convenience should speed be essential. MOV ,R0 MOV ,R2 CALL MULX R2/ single-precision product R0/ unchanged DIV11 Signed single precision integer division. Divides integer in R2 by integer in R0, providing a quotient in R2 and a remainder in R0. Returns with Carry set if division by zero is attempted. MOV ,R2 MOV ,R0 CALL DIV11 R2/ quotient R0/ remainder CS if divide-by-zero DIVX Unsigned integer division with no checks for anything. This routine is not used by any other routines in the library, but is provided for convenience should speed be a paramount consideration. MOV ,R2 MOV ,R0 CALL DIVX R0/ remainder R2/ quotient WAT Writes an ascii character in R0 to the user's terminal. If the character be a printing character it is sent as that character. Otherwise it will be sent in a visible format, for example "", 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>", or "<200+>". CVLLIB Manual Page 18-4 Various Additional Routines WA Writes an ascii character in R0 to a string pointed to in R1 in a manner analogous to WAT above. YES Reads a line from the user's terminal (into TLINB buffer). Returns with carry clear if the first character of the user's line were "Y" or "y", and with carry set otherwise. CALL YES CC if affirmative response YESNO Reads a line from the user's terminal (into TLINB buffer). Returns with carry clear if the first character of the user's line were "Y" or "y", with carry set if the first character were "N" or "n". If anything else were typed, YESNO prompts the user to try again. CALL YESNO CC if affirmative response TLIN Reads a line from the user's terminal, into a buffer pointed to in R1. Returns the line null-terminated (no ) as per .GTLIN, but uses .TTYIN's to get the line, thereby not taking input from command files. [From Release 3 on: should the user force loading of the module R$G, input using TLIN will come from command files also.] In case .SCCA was set, this function returns with Carry set should the line be terminated by a control-C character. The control-C character is put in the buffer, available for use by the user. R0 returns a pointer to the null byte terminating the input line. R1 is unchanged. MOV #,R1 CALL TLIN R1/unchanged R0/pointer to termin null CS if control-C in line TLINB (NOT a callable routine). TLINB provides a buffer of 90 (decimal) bytes for use by routines which perform input direct from the user's terminal. Should this buffer be excessive or inadequate, feel free to provide your own, as then this one will not be loaded from the library. TLOUB (NOT a callable routine). TLOUB provides a buffer of 140 (decimal) bytes for use by routines which perform output direct to the user's terminal. Should this buffer be excessive or inadequate, feel free to provide your own, as then this one will not be loaded from the library. CVLLIB Manual Page 18-5 Various Additional Routines TCRLF Types a carriage-return and a line-feed to the user's terminal. (As with many CVLLIB routines, no registers are altered.) This routine may be called from Macro, Fortran, or C CALL TCRLF TUC Clears bit in Job Status Word which allows lower case from the user's terminal, thereby forcing upper case input. This routine may be called from Macro, Fortran or C. CALL TUC TLC Sets bit in Job Status Word which allows lower case from the user's terminal, thereby allowing lower case input. This routine may be called from Macro, Fortran or C. CALL TLC TSPM Sets bit in Job Status Word which allows for special mode input from the user's terminal - ie single character input without echo. This routine may be called from Macro, Fortran or C. CALL TSPM TNSPM Clears bit in Job Status Word (converse of TSPM) resetting the user's terminal back to echoing and reading line by line. This routine may be called from Macro, Fortran, or C. CALL TNSPM TNIOW Sets bit in Job Status Word allowing immediate return for .TTINR (read a single character from the terminal) routines when using the Foreground Background RT-11 monitor. This allows the user to test for availability of terminal input. This routine may be called from Macro, Fortran, or C. CALL TNIOW TIOW This is the converse of TNIOW, allowing RT11 to place the job in a wait state until terminal input is available. This routine may be called from Macro, Fortran, or C. CALL TIOW DATBLK (NOT a callable routine). DATBLK provides a with the offsets DAY, MONTH, YEAR, DYEAR and RTDAT globally defined (see chapter at beginning of manual on Special Block Formats). It is provided for user convenience, and is not used by any of the programmes within the library. CVLLIB Manual Page 18-6 Various Additional Routines TIMBLK (NOT a callable routine). TIMBLK provides a with the offsets HOURS, MINS, SECS, TICKS, RTIM1, RTIM2 and TCLOCK globally defined (see chapter at beginning of manual on Special Block Formats). It is provided for user convenience, and is not used by any of the programmes within the library. LTRIM Trims leading spaces and tabs from a string pointed to in R1. R1 is incremented until it points to a character which is neither a space nor a tab. MOV #,R1 CALL LTRIM R1/pointer to next non-space RTRIM Trims trailing spaces and tabs from a string pointed to in R1. R1 is decremented until it points to the character following the last character which is neither a space nor a tab. MOV #,R1 CALL RTRIM R1/pointer past last non-space SCOP Copies a string pointed to in R0 to the string pointed to in R1. The transfer is terminated by either a <0> or a <200> byte, and this terminating byte is not transferred. Any parity bits (bit 7) which were set in the source string will be clear in the destination string. MOV #,R0 MOV #,R1 CALL SCOP IRAN A single precision elementary random number generator for games and other non-serious applications. Supplied with an upper limit (n) in R0, returns an integer in the range 0 to . The global RAN$NM contains the "seed" for the random number generator, thereby allowing it to be initialized externally. MOV ,R0 CALL IRAN R0/random number from 0 to R2D Reads a pair of digits from the string pointed to in R1, returning the value of the two-digit integer in R0. Should only 1 digit be found before a non-numeric character, the value returned will be ten times the value represented by that digit. MOV #,R1 CALL R2D R1/pointer to delimiter CVLLIB Manual Page 18-7 Various Additional Routines R0/value of number R1D Reads a single character from the string pointed to in R1. If the character be numeric, R1D returns with carry clear and the numeric value of that digit in R, and R1 is advenced to point to the next character. Should the character not be numeric, a return with Carry set is made, and R1 is unaltered. MOV #,R1 CALL R1D R0/numeric value of digit CC if digit, CS if not. HEXPRE (NOT a callable routine) Defines the hex prefix character (see chapter 1). HEXSUF (NOT a callable routine) Defines the hex suffix character (see chapter 1). CHAPTER 19 Ancillary Subroutines Subroutines with names containing a dollar sign are to be found in source files named with the same string of letters (and numerals) but without the dollar sign. For example, W$CT is found in WCT.MAC, and LW$2PT is found in LW2PT.MAC. 19.1 Ancillary Subroutines (Macro): These are subroutines which are used by various library routines. They may be of use to users trying to write their own routines in a manner consistent with the structure of routines in this library. W$T Provides the ability for routines which handle string encoding to be used easily for the same job doing output to the user's terminal. As an example, consider WDT (write a decimal number to the terminal). This routine uses the mechanism for writing a decimal number to a string, embodied in WD, in the following manner: WDT:: CALL W$T .WORD WD returns to caller, not here W$CT Similar to W$T, but whereas W$T destroys any record of carry being set on the called routine (in the above example WD), W$CT returns to the user with the carry bit as it was on return from the string writing routine. This is used in the system date routines (eg WSDAT) to determine whether the date was in fact set up. WSDATT:: CALL W$CT .WORD WSDAT returns to caller, not here CVLLIB Manual Page 19-2 Ancillary Subroutines W$2P Called from double-precision routines requiring right justification within a field. W$2P calls the relevant routine, then sets up parameters to call SRJUST (v.i.) to perform right justification. It expects the field width to be specified in R0. W82P:: CALL W$2P .WORD W82 returns to caller, not here W$P Called from single precision routines requiring right justification within a field. W$P calls the relevant routine, then sets up parameters to call SRJUST (v.i.) to perform right justification. It expects the field width to be specified in R2. WDP:: CALL W$P .WORD WD returns to caller, not here R$T Called from routines requiring terminal input from R1 string reading routines (eg RDST requires input via RDS, RM3T requires input via RM3). The line is obtained from the terminal via TLIN (v.s.) and passed to the relevant interpreting routine. RDT:: CALL R$T .WORD RD returns to caller, not here R$G Analogous to R$T, and has the global R$T defined within it (but suppressed in the library as normally constructed). Input from the terminal is obtained via a .GTLIN request, thereby allowing tracking of command files. In release 3, a version of TLIN was added so that if this module is loaded all TLIN input will also be done with GTLIN's. To force loading this module, use the sequence: .LOAD TEST,CVLLIB/INCLUDE Global? R$G Global? SRJUST Provides ability to right justify within a field. Should the field be insufficiently long, no truncation will be performed. Padding is done with spaces. Two pointers and a value are required: a pointer to the start of the field, the length of the field, and the current pointer to the byte past the end of the (presently left justified) field. A pointer is returned to the byte past the new end of the string. MOV #,R3 CVLLIB Manual Page 19-3 Ancillary Subroutines MOV ,R2 MOV #,R1 CALL SRJUST R1/new end pointer W2D Designed to write a two-digit decimal number with 1 leading zero if necessary (if the number be less than 10). Should the number however exceed 99, it will still be printed. This is used in time and money printing. MOV ,R0 CALL W2D WBD Designed to write a two-digit decimal number with 1 leading space if necessary (if the number be less than 10). Should the number however exceed 99, it will still be printed. This is used in date and time printing. MOV ,R0 CALL W2D WSGN Inserts a minus sign into the string pointed to in R1, and negates R0 if the number supplied in R0 be negative. (100000 becomes 0). RSGN Ignores any leading spaces, tabs, or plus signs (+) in the string pointed to in R1, and returns 0 in R0 if the number of minus signs (-) is even, -1 if odd. Any other character causes the scan to terminate. HEXX Converts a character passed in R0 into its hex value. "0" to "9" become 0 to 9, "A" to "F" become 10 to 15, and any other characters are returned unchanged. Characters illegal in hex cause return with carry set. HEXCMP [Contained within HEXX] - Compares the character in R0 with the character pointed to by R1 ignoring case. This is used for checking the hex prefix and suffix characters (see chapter 1). LRETC Returns -1 in R0 if the Carry bit is set, and 0 in R0 if not. It is used terminally in numerous routines. Routines which use in the calling sequence can call LRETC to set up R0 before using LR$ADJ to set up , as this latter routine does not alter R0. [LRETC is provided in the general section of the library, as it is common to both Fortran and C interfaces.] CVLLIB Manual Page 19-4 Ancillary Subroutines LR$2T Common pathway for fortran routines reading double precision integers from the user's terminal. These have a calling sequence in the form I = LRx2T(2.value,char) where <2.value> receives the double precision integer read, and receives the byte which delimited the number. The value returned (I) is zero unless Carry has been set by the number-reading routine, in which case -1 is returned. LR$2T has been placed in the general section of CVLLIB (CVGLIB) as it is used by the Fortran floating point routines. LRD2T:: CALL RD2T JMP LR$2T returns to caller, not to here LR$2 Common pathway for fortran routines reading double precision integers from strings. These have a calling sequence in the form I = LRx2(2.value,string,last) where <2.value> receives the double precision value read from , and receives an index to the character which delimited the number. The returned value (I) is -1 if carry is set by the number reading routine, 0 otherwise. LR$2 has been placed in the general section of CVLLIB (CVGLIB) as it it used by the Fortran floating point routines. LR82T:: CALL LR$2 .WORD R82T returns to caller, not here LW$ADJ LR$ADJ This pair of routines comes in the file LWADJ.MAC. They provide a mechanism for Fortran routines with calling sequences in the form CALL ROUTINE(value,string,last, ... ) which after reading from or writing into need to calculate the number of bytes read or written and add this to . LW$ADJ - (for routines which WRITE only) - should be entered with a pointer to the routine to be used on the stack, and registers other than R1 (string pointer) already set up. LW$ADJ sets up the string pointer, calls the routine, clears the next byte in , then adjusts . LR$ADJ - purely adjusts the value in . R1 is altered, but R0 CVLLIB Manual Page 19-5 Ancillary Subroutines may be used to return a value to the calling programme. LR$ADJ and LW$ADJ have been placed in the general section of CVLLIB (CVGLIB) as they are used by the Fortran floating point routines. [CALL LWD(value,string,last] LWD:: MOV @2(R5),R0 {value} CALL LW$ADJ .WORD WD returns to caller, not here CR$2T CR$2 These are the common pathway for CRx2 & CRx2T. The register saving routine CSVR should have been called before calling this routine. CR$2 and CR$2T have been placed in CVGLIB as they are called by the C floating point routines. The calling sequence is CALL CR$2 (or CR$2T) .WORD
Return is made not to this call but to the original calling sequence. CW$ADJ This is the common pathway for C string output. The register saving routine CSVR should have been called before the call to this routine. CW$ADJ has been placed in CVGLIB as it is used by the C floating point routines. CW$ADJ should be entered with a pointer to the routine to be used on the stack, and registers other than R1 (string pointer) already set up. It sets up the string pointer, calls the routine, clears the next byte, then adjusts strpnt. CSVR saves registers R2-R4, then calls where it was called from as a subroutine and upon return from there restores the registers. CSVR is included with the general section of CVLLIB, as it is required by the C routines in the REAL portion of the library as well as by programmes in CVCLIB. The C library CSV$ is unsuitable for use with CVLLIB as it requires a JMP CRET$ return rather than an RTS PC. A global CARG is defined within CSVR, defining the offset required for the routine to use arguments from the stack. APPENDIX I Index 1- 3 <2.value> 15- 1 2/precis negation 1- 3 <3.value> 15- 2 ADD2 - Addition 2.precis integers 12- 2 ADD3 - 3.precis addition 6- 11 Addition (Real) - F$ADDF 15- 2 Addition 2.precis integers - ADD2 18- 1 Additional Routines 18- 2 Additional Utilities 19- 4 Adjustment routine, writing - LW$ADJ 7- 4 Age - determine from DOB and date - AGE 19- 4 Ancillary for LRx2 - LR$2 19- 4 Ancillary for LRx2T - LR$2T 19- 2 Ancillary for TTY input (via .GTLIN) - R$G 19- 2 Ancillary for TTY input (via TLIN) - R$T 19- 1 Ancillary for TTY output - W$T 19- 1 Ancillary for TTY output with carry - W$CT 19- 2 Ancillary for Wx2P routines - W$2P 19- 2 Ancillary for WxP routines - W$2P 6- 11 Ancillary Routines - Real Numbers 19- 1 Ancillary Subroutines 1- 5 Argument Patterns (C Routines) 1- 3 Argument Patterns (Fortran) 1- 3 Argument Patterns (Macro) 15- 1 Arithmetic Routines - 2.precis-Precision 12- 1 Arithmetic Routines - 3.precision 6- 10 Arithmetic Routines - Real Numbers 18- 4 Ascii - write to string - WA 18- 3 Ascii - write to TTY - WAT 9- 4 Ascii from radix50 conversion - C50A 9- 4 Ascii from radix50 conversion - CA50 3- 2 BASE - General purpose Macro Programme template 4- 1 Block Format - DATE 4- 2 Block Format - TIME 4- 3 Block Formats - FILENAME 4- 3 Buffer, TTY I/O CVLLIB Manual Page I-2 Index 3- 2 Bug in SJ TT Handler 6- 11 C - real arithmetic 1- 5 C Argument Patterns 18- 1 C12 - Convert 1.precis integer to 2.precis 18- 2 C13 - Convert 1.precis integer to 3.precis 18- 2 C21 - Convert 2.precis integer to 1.precis 18- 2 C23 - Convert 2.precis integer to 3.precis 18- 2 C31 - Convert 3.precis integer to 1.precis 18- 2 C32 - Convert 3.precis integer to 2.precis 9- 4 C50A - Convert radix50 to ascii 9- 4 CA50 - Convert ascii to radix50 7- 4 Calculate date given year and day of year - DATCAL 7- 4 Calculate difference between two dates - DATDIF 4- 1 CALEND Common Block 4- 1 Calendar Information 18- 1 Case Conversion Routine 6- 9 CCMPR - Compare Reals 6- 10 CFLT1 - Convert 1/precis Integer to Real 6- 10 CFLT2 - Convert 2/precis Integer to Real 6- 9 CFRAC - Convert Real to Fraction 5 Changes, Release 1 to Release 2 1- 4 1- 5 Check (none!) on string length 7- 4 Check validity of date - IDAY 6- 9 CINT1 - Convert Real to 1/precis Integer 6- 10 CINT2 - Convert Real to 2/precis Integer 6- 10 CINTC1 - Convert Real to 1/precis Integer 6- 10 CINTC2 - Convert Real to 2/precis Integer 3- 1 CMAC - General purpose prefix file 15- 2 CMP2 - Comparison of 2.precision integers 12- 2 CMP3 - Compare 3.precis with 3.precis 6- 7 CMPR - Compare Real Numbers 4- 3 Command Files and TTY I/O 4- 1 Common Block - CALEND 4- 1 Common Block - DATBLK 4- 2 Common Block - TIMBLK 6- 7 Compare Real Numbers - CMPR 15- 2 Comparison of 2.precision integers - CMP2 17- 1 Comparison of Strings 3- 2 COMPRS - File compression/expansion programme. 18- 1 Conversion between diff precis integers 18- 1 Convert 1.precis integer to 2.precis - C12 18- 2 Convert 1.precis integer to 3.precis - C13 6- 9 Convert 1/precis Integer to Real - FLT1 6- 10 Convert 1/precis Integer to Real - RFLT1, CFLT1 18- 2 Convert 2.precis integer to 1.precis - C21 18- 2 Convert 2.precis integer to 3.precis - C23 6- 9 Convert 2/precis Integer to Real - FLT2 6- 10 Convert 2/precis Integer to Real - RFLT2, CFLT2 18- 2 Convert 3.precis integer to 1.precis - C31 18- 2 Convert 3.precis integer to 2.precis - C32 9- 4 Convert ascii to radix50 - CA50 9- 4 Convert number to 3 rad50 digits - DIG3 9- 4 Convert radix50 to ascii - C50A CVLLIB Manual Page I-3 Index 6- 8 Convert Real to 1/precis Integer - INT1 6- 8 Convert Real to 1/precis Integer - INTC1 6- 9 Convert Real to 1/precis Integer - LINT1, CINT1 6- 10 Convert Real to 1/precis Integer - LINTC1, CINTC1 6- 8 Convert Real to 2/precis Integer - INT2 6- 8 Convert Real to 2/precis Integer - INTC2 6- 10 Convert Real to 2/precis Integer - LINT2, CINT2 6- 10 Convert Real to 2/precis Integer - LINTC2, CINTC2 6- 7 Convert Real to Fraction - FRAC 6- 9 Convert Real to Fraction - RFRAC, CFRAC 7- 5 Convert RT11 date to words - CRDATW 8- 3 Convert RT11 time to words - CRTIMW 7- 5 Convert word date to RT11 8- 3 Convert word time to RT11 - CWTIMR 18- 6 Copy string - SCOP 7- 5 CRDATW - convert RT11 date to words 6- 7 CRR - Read Real from string 6- 6 CRRT - Read Real from terminal 8- 3 CRTIMW - Convert RT11 time to words 7- 5 CWDATR - convert word date to RT11 6- 6 CWRE - Write Real E format to string 6- 5 CWRET - Write Real E format to terminal 6- 6 CWRF - Write Real F format to string 6- 6 CWRFT - Write Real F format to terminal 6- 6 CWRG - Write Real G format to string 6- 5 CWRGT - Write Real G format to terminal 6- 6 CWRS - Write Real S format to string 6- 5 CWRST - Write Real S format to terminal 8- 3 CWTIMR - Convert word time to RT11 18- 5 DATBLK - Library DATE block 4- 1 DATBLK block 3- 1 DATBLK.DAT - dateblock description file 7- 4 DATCAL - Calculate given year and day of year 7- 4 DATDIF - Calculate difference between two dates 7- 2 Date (system) to string - WSDAT 7- 2 Date (system) to TTY - WSDATT 7- 4 Date - Calculate diff between two dates - DATDIF 7- 4 Date - check validity - IDAY 7- 5 Date - convert RT11 to words - CRDATW 7- 5 Date - convert words to RT11 date 7- 4 Date - day of week from - IDAY 7- 4 Date - determine age from DOB and date - AGE 7- 4 Date - Given year and day of year - DATCAL 7- 4 Date - Read from string - RDAT 7- 3 Date - Read from system - RSDAT 7- 3 Date - Read from TTY - RDATT 7- 3 Date - Write to string - WDAT 7- 3 Date - Write to TTY - WDATT 7- 2 Date and day to string - TODAY 7- 2 Date and day to TTY - TODAYT 4- 1 DATE Block Format 7- 1 DATE Routines 4- 1 7- 2 Day name to string - WDAY CVLLIB Manual Page I-4 Index 7- 2 Day name to TTY - WDAYT 7- 4 Day of week from date - IDAY 4- 1 DAY offset 8 Determination of Library Release 4- 3 DEVICE offset (fileblock) 9- 4 DIG3 - Convert number to 3 rad50 digits 2- 1 Distribution Kit 18- 3 DIV11 - Division of 1.precis integers 15- 2 DIV21 - Division 2.precis integer by 1.precis 12- 1 DIV31 - 3.precis / 1.precis division 12- 2 DIV33 - 3.precis / 3.precis division 6- 11 Division (Real) - F$DIVF 18- 3 Division (unsigned) - DIVX 15- 2 Division 2.precis integer by 1.precis - DIV21 18- 3 Division of 1.precis integers - DIV11 18- 3 DIVX - Unsigned division 13- 1 Double-precis Money Routines 15- 1 Double-Precision Arithmetic 14- 1 Double-Precision Integer Format 14- 1 Double-Precision Integer I/O 4- 1 DYEAR offset (dateblock) 4- 3 EXT offset (fileblock) 3- 1 Extra Routines and Files 6- 11 F$ADDF - Real addition 6- 11 F$DIVF - Real division 6- 12 F$MESG - Floating Point Error Messages 6- 11 F$MULF - Real multiplication 6- 13 F$SUB - User Subroutine for FP Trap 6- 11 F$SUBF - Real subtraction 4- 3 FILE1 offset (fileblock) 4- 3 FILE2 offset (fileblock) 4- 3 9- 2 Filename - read from string - RF 9- 3 Filename - Read from string - RFD 9- 3 Filename - Read from TTY - RFDT 9- 2 Filename - Read from TTY - RFT 9- 2 Filename - Write to string - WF 9- 1 Filename - Write to TTY - WFT 4- 3 FILENAME Block 9- 1 Filename Formats 9- 1 Filename routines - 6- 2 FINSET - Set up floating point traps 7- 1 Flag for Date Reading Routines 7- 1 Flag for Date Writing Routines 9- 1 Flag for filename routines 1- 6 - general information 7- 1 for Date Reading Routines 7- 1 for Date Writing Routines 9- 1 for filename routines 8- 1 for Time routines 1- 6 Flags (generally) 6- 3 Floating point - E format to string - WRE 6- 2 Floating point - E format to terminal - WRET 6- 4 Floating point - F format to string - WRF CVLLIB Manual Page I-5 Index 6- 3 Floating point - F format to terminal - WRFT 6- 3 Floating point - G format to string - WRG 6- 2 Floating point - G format to terminal - WRGT 6- 4 Floating point - read from string - RR 6- 4 Floating point - read from terminal - RRT 6- 4 Floating point - S format to string - WRS 6- 3 Floating point - S format to terminal - WRST 6- 1 FLOATING POINT also see REAL NUMBER ROUTINES 6- 10 Floating Point Arithmetic Routines 6- 12 Floating Point Error Messages - F$MESG 6- 5 Floating Point I/O - Fortran _C Routines 6- 2 Floating Point I/O - Macro Routines 6- 2 Floating Point Initialization 6- 1 Floating Point Number Routines 6- 12 Floating Point Trap Routines 6- 2 Floating point trap setting - FINSET 6- 2 Floating point trap setting - LINSET 6- 13 Floating Point Trap User Subroutine - F$SUB 6- 9 FLT1 - Convert 1/precis Integer to Real 6- 9 FLT2 - Convert 2/precis Integer to Real 4- 3 Forced linking of R$G 14- 1 Format - 2.precis-Precision Integer 7- 1 Formats for DATES 1- 2 Fortran Interfaces for Programmes 6- 7 FRAC - Convert Real to Fraction 1- 1 General Details 2- 1 Generation of the Library 4- 3 GTLIN vs TTYIN TTY Input 1- 6 Hex prefix - HEXPRE 1- 6 Hex suffix - HEXSUF 1- 6 Hexadecimal Conventions 1- 6 HEXPRE - Hex prefix 18- 7 HEXPRE - Hex suffix character 1- 6 HEXSUF - Hex suffix 18- 7 HEXSUF - Hex suffix character 19- 3 HEXX - Hex ancillary 4- 2 HOURS offset (timeblock) 5- 1 How Routines are listed in this Manual 6- 5 I/O - Floating Point - Fortran _C Routines 6- 2 I/O - Floating Point - Macro Routines 6- 5 I/O - Real - Fortran _C Routines 6- 2 I/O - Real - Macro Routines 18- 5 I/O Wait on TTY - TNIOW _TIOW 7- 4 IDAY - check validity of date 1- 1 Ideas behind Names of Routines 6- 2 Initialization Routines, Real Arithmetic 6- 8 INT1 - Convert Real to 1/precis Integer 6- 8 INT2 - Convert Real to 2/precis Integer 6- 8 INTC1 - Convert Real to 1/precis Integer 6- 8 INTC2 - Convert Real to 2/precis Integer 14- 4 Integer - Read 2.precis dec from string - RD2 14- 4 Integer - Read 2.precis dec from TTY - RD2T 14- 5 Integer - Read 2.precis hex from string - RH2 14- 5 Integer - Read 2.precis hex from TTY - RH2T CVLLIB Manual Page I-6 Index 14- 5 Integer - Read 2.precis oct from string - R82 14- 5 Integer - Read 2.precis oct from TTY - R82T 14- 4 Integer - Read 2.precis oct, dec or hex from string - RN2 14- 3 Integer - Read 2.precis oct, dec or hex from TTY - RN2T 14- 4 Integer - Read 2.precis signed dec fr string - RD2S 14- 5 Integer - Read 2.precis signed oct fr string - R82S 14- 5 Integer - Read 2.precis signed oct from TTY - R82ST 16- 4 Integer - Read dec from string - RD 16- 4 Integer - Read dec from TTY - RDT 16- 4 Integer - Read dec signed from string - RDS 16- 4 Integer - Read dec signed from TTY - RDST 16- 5 Integer - Read hex from string - RH 16- 5 Integer - Read hex from TTY - RHT 16- 4 Integer - Read integer (oct, dec or hex) from string - RN 16- 3 Integer - Read integer (oct, dec or hex) from TTY - RNT 16- 5 Integer - Read oct from string - R8 16- 5 Integer - Read oct from TTY - R8T 16- 5 Integer - Read oct signed from string - R8S 16- 4 Integer - Read oct signed from TTY - R8ST 14- 4 Integer - Read signed 2.precis dec from TTY - RD2ST 14- 2 Integer - Write 2.precis dec to string - WD2 14- 1 Integer - Write 2.precis dec to string - WD2P 14- 1 Integer - Write 2.precis dec to TTY - WD2PT 14- 1 Integer - Write 2.precis dec to TTY - WD2T 14- 3 Integer - Write 2.precis hex to string - WH2 14- 3 Integer - Write 2.precis hex to TTY - WH2T 14- 3 Integer - Write 2.precis oct to string - W82 14- 3 Integer - Write 2.precis oct to string - W82P 14- 3 Integer - Write 2.precis oct to string - W82S 14- 2 Integer - Write 2.precis oct to string - W82SP 14- 2 Integer - Write 2.precis oct to TTY - W82PT 14- 2 Integer - Write 2.precis oct to TTY - W82SPT 14- 2 Integer - Write 2.precis oct to TTY - W82ST 14- 2 Integer - Write 2.precis oct to TTY - W82T 16- 2 Integer - Write dec signed to string - WDS 16- 1 Integer - Write dec signed to string - WDSP 16- 1 Integer - Write dec signed to TTY - WDSPT 16- 1 Integer - Write dec signed to TTY - WDST 16- 1 Integer - Write dec to TTY - WDT 16- 2 Integer - Write dec unsigned to string - WD 16- 2 Integer - Write dec unsigned to string - WDP 16- 1 Integer - Write dec unsigned to TTY - WDPT 16- 3 Integer - Write hex to string - WH 16- 3 Integer - Write hex to TTY - WHT 16- 3 Integer - Write oct signed to string - W8S 16- 2 Integer - Write oct signed to string - W8SP 16- 2 Integer - Write oct signed to TTY - W8SPT 16- 2 Integer - Write oct signed to TTY - W8ST 16- 3 Integer - Write oct to string - W8P 16- 2 Integer - Write oct to TTY - W8PT 16- 2 Integer - Write oct to TTY - W8T 16- 3 Integer - Write oct unsigned to string - W8 16- 1 Integer I/O - 1.precis-Precision 14- 1 Integer I/O - 2.precis-Precision CVLLIB Manual Page I-7 Index 11- 1 Integer I/O - 3.precision 11- 1 Integers - 3.precision 3- 1 IO - General purpose Macro I/O 3- 2 IO2 - General purpose Macro I/O 18- 6 IRAN - Random number generator 1- 4 6- 9 LCMPR - Compare Reals 1- 5 Leading Spaces and Tabs 18- 6 Leading spaces trimming - LTRIM 2- 1 Library Copying 2- 1 Library Generation 8 Library Release - Determination of 11- 1 Limit - 3.precision Values 10- 1 Limits - 3.precision 18- 4 Line buffer (TTY input) - TLINB 18- 4 Line buffer (TTY output) - TLOUB 4- 3 Linking for GTLIN TTY Input 6- 2 LINSET - Set up floating point traps 6- 9 LINT1 - Convert Real to 1/precis Integer 6- 10 LINT2 - Convert Real to 2/precis Integer 6- 10 LINTC1 - Convert Real to 1/precis Integer 6- 10 LINTC2 - Convert Real to 2/precis Integer 18- 5 Lower case from TTY - TLC 19- 4 LR$2 - Ancillary for LRx2 19- 4 LR$2T - Ancillary for LRx2T 19- 3 LRETC - Return R0/-1 if CS 6- 7 LRR - Read Real from string 6- 6 LRRT - Read Real from terminal 18- 6 LTRIM - Trim leading spaces 19- 4 LW$ADJ - Adjustment routine, writing 6- 6 LWRE - Write Real E format to string 6- 5 LWRET - Write Real E format to terminal 6- 6 LWRF - Write Real F format to string 6- 6 LWRFT - Write Real F format to terminal 6- 6 LWRG - Write Real G format to string 6- 5 LWRGT - Write Real G format to terminal 6- 6 LWRS - Write Real S format to string 6- 5 LWRST - Write Real S format to terminal 4- 2 MINS offset (timeblock) 13- 1 Money (2.precis-precis) Routines 10- 3 Money (3.precis) read from string - RM3 10- 2 Money (3.precis) read from TTY - RM3T 10- 2 Money (3.precis) write to string - WM3 10- 2 Money (3.precis) write to string - WM3D 10- 2 Money (3.precis) write to string - WM3DP 10- 2 Money (3.precis) write to string - WM3P 10- 1 Money (3.precis) write to TTY - WM3DPT 10- 2 Money (3.precis) write to TTY - WM3DT 10- 1 Money (3.precis) write to TTY - WM3PT 10- 2 Money (3.precis) write to TTY - WM3T 13- 3 Money - Read 2.precis from string - RM 13- 3 Money - Read 2.precis from TTY - RMT 13- 2 Money - Write 2.precis to string - WM 13- 2 Money - Write 2.precis to string - WMD CVLLIB Manual Page I-8 Index 13- 2 Money - Write 2.precis to string - WMDP 13- 2 Money - Write 2.precis to string - WMP 13- 1 Money - Write 2.precis to TTY - WMDPT 13- 2 Money - Write 2.precis to TTY - WMPT 13- 1 Money - Write 2.precis to TTY - WMPT 13- 2 Money - Write 2.precis to TTY - WMT 1- 1 Money Format Description 10- 1 Money Routines - 3.precision 4- 1 MONTH offset (dateblock) 18- 2 MUL11 - Multiply 1.precis integers 15- 1 MUL21 - Multiply 2.precis * 1.precis 15- 1 MUL22 - Multiply 2.precis integer * 2.precis 12- 1 MUL31 - 3.precis * 1.precis multiply 12- 1 MUL33 - 3.precis * 3.precis multiply 1- 3 Multiple Precision Integer Format 6- 11 Multiplication (Real) - F$MULF 18- 3 Multiplication (unsigned) - MULX 18- 2 Multiply 1.precis integers - MUL11 15- 1 Multiply 2.precis integer * 1.precis - MUL21 15- 1 Multiply 2.precis integer * 2.precis - MUL22 18- 3 MULX - Unsigned multiplication 3- 1 N12FIL - Fortran input and output 7- 2 Name of day and date to string - TODAY 7- 2 Name of day and date to TTY - TODAYT 7- 2 Name of day to string - WDAY 7- 2 Name of day to TTY - WDAYT 12- 2 NEG3 - 3.precis negation 12- 2 NEG32 - 3.precis negation 15- 1 Negation of 2/precis values 1- 1 Nomenclature 9- 4 Number to 3 rad50 digits - DIG3 1- 6 Prefix character - hexadecimal 7 psect CVLLIB 6- 11 R$DIG - Real Digit Extraction Ancillary 19- 2 R$G - Ancillary for TTY input (via .GTLIN) 6- 11 R$RED - Real Reduction Ancillary 6- 12 R$RND - Real Rounding Ancillary 6- 11 R$SET - Real Adjustment Ancillary 19- 2 R$T - Ancillary for TTY input (via TLIN) 6- 12 R$TZ - Trim trailing zeroes 18- 7 R1D - Read 1.precis digit 18- 6 R2D - Read pair of digits 9- 4 R50 - Read radix50 (full set) from string 9- 4 R50F - Read radix50 (filename set) from string 9- 3 R50FT - Read radix50 (filename set) from TTY 9- 4 R50S - Read radix50 (symbol set) from string 9- 3 R50ST - Read radix50 (symbol set) from TTY 9- 3 R50T - Read radix50 (full set) from TTY 16- 5 R8 - Read oct from string 14- 5 R82 - Read 2.precis oct from string 14- 5 R82S - Read 2.precis signed oct from string 14- 5 R82ST - Read 2.precis signed oct from TTY 14- 5 R82T - Read 2.precis oct from TTY 16- 5 R8S - Read oct signed from string CVLLIB Manual Page I-9 Index 16- 4 R8ST - Read oct signed from TTY 16- 5 R8T - Read oct from TTY 9- 4 Rad50 - 3 digits from number - DIG3 9- 4 Radix50 (filename set) read from string - R50F 9- 3 Radix50 (filename set) read from TTY - R50FT 9- 4 Radix50 (full set) read from string - R50 9- 3 Radix50 (full set) read from TTY - R50T 9- 4 Radix50 (symbol set) read from string - R50S 9- 3 Radix50 (symbol set) read from TTY - R50ST 9- 2 Radix50 - Write (file set) to string - W50F 9- 2 Radix50 - Write (file set) to TTY - W50T 9- 2 Radix50 - Write to string - W50 9- 2 Radix50 - Write to TTY - W50T 9- 1 Radix50 code interpretation 9- 1 Radix50 Formats 9- 4 Radix50 to ascii conversion - C50A 9- 4 Radix50 to ascii conversion - CA50 18- 6 RAN$NM - Random number seed 18- 6 Random number ganerator 16- 4 RD - Read dec from string 14- 4 RD2 - Read 2.precis dec from string 14- 4 RD2S - Read 2.precis signed dec from string 14- 4 RD2ST - Read signed 2.precis dec from TTY 14- 4 RD2T - Read 2.precis dec from TTY 11- 2 RD3 - Read 3.precis from string 11- 2 RD3T - Read 3.precis from TTY 7- 4 RDAT - Read date from string 7- 3 RDATT - Read date from TTY 16- 4 RDS - Read dec signed from string 16- 4 RDST - Read dec signed from TTY 16- 4 RDT - Read dec from TTY 18- 7 Read 1.precis digit - R1D 14- 4 Read 2.precis dec from string - RD2 14- 4 Read 2.precis dec from TTY - RD2T 14- 5 Read 2.precis hex from string - RH2 14- 5 Read 2.precis hex from TTY - RH2T 13- 3 Read 2.precis money from string - RM 13- 3 Read 2.precis money from TTY - RMT 14- 5 Read 2.precis oct from string - R82 14- 5 Read 2.precis oct from TTY - R82T 14- 4 Read 2.precis oct, dec or hex from string - RN2 14- 3 Read 2.precis oct, dec or hex from TTY - RN2T 14- 4 Read 2.precis signed dec from string - RD2S 14- 5 Read 2.precis signed oct from string - R82S 14- 5 Read 2.precis signed oct from TTY - R82ST 11- 2 Read 3.precis from string - RD3 11- 2 Read 3.precis from TTY - RD3T 10- 3 Read 3.precis money from string - RM3 10- 2 Read 3.precis money from TTY - RM3T 8- 2 Read a time from the TTY - RTIMT 18- 4 Read answer from TTY - YES 7- 4 Read date from string - RDAT 7- 3 Read date from system - RSDAT 7- 3 Read date from TTY - RDATT CVLLIB Manual Page I-10 Index 16- 4 Read dec from string - RD 16- 4 Read dec from TTY - RDT 16- 4 Read dec signed from string - RDS 16- 4 Read dec signed from TTY - RDST 9- 2 Read filename from string - RF 9- 3 Read filename from string - RFD 9- 3 Read filename from TTY - RFDT 9- 2 Read filename from TTY - RFT 16- 5 Read hex from string - RH 16- 5 Read hex from TTY - RHT 16- 4 Read integer (oct, dec or hex) from string - RN 16- 3 Read integer (oct, dec or hex) from TTY - RNT 18- 4 Read line from TTY - TLIN 16- 5 Read oct from string - R8 16- 5 Read oct from TTY - R8T 16- 5 Read oct signed from string - R8S 16- 4 Read oct signed from TTY - R8ST 18- 6 Read pair of digits - R2D 9- 4 Read radix50 (filename set) from string - R50F 9- 3 Read radix50 (filename set) from TTY - R50FT 9- 4 Read radix50 (full set) from string - R50 9- 3 Read radix50 (full set) from TTY - R50T 9- 4 Read radix50 (symbol set) from string - R50S 9- 3 Read radix50 (symbol set) from TTY - R50ST 6- 7 Read Real from string - LRR, CRR 6- 4 Read real from string - RR 6- 6 Read Real from terminal - LRRT, CRRT 6- 4 Read real from terminal - RRT 19- 3 Read sign of number - RSGN 14- 4 Read signed 2.precis dec from TTY - RD2ST 8- 2 Read time from string - RTIM 8- 2 Read time from system - RSTIM 18- 4 Read Yes/No answer from TTY - YESNO 1- 5 Reading (generally) 7- 1 Reading DATES 6- 9 Real - Convert from 1/precis Integer - FLT1 6- 10 Real - Convert from 1/precis Integer - RFLT1, CFLT1 6- 9 Real - Convert from 2/precis Integer - FLT2 6- 10 Real - Convert from 2/precis Integer - RFLT2, CFLT2 6- 8 Real - Convert to 1/precis Integer - INT1 6- 8 Real - Convert to 1/precis Integer - INT2 6- 8 Real - Convert to 1/precis Integer - INTC1 6- 8 Real - Convert to 1/precis Integer - INTC2 6- 9 Real - Convert to 1/precis Integer - LINT1, CINT1 6- 10 Real - Convert to 1/precis Integer - LINTC1, CINTC1 6- 10 Real - Convert to 2/precis Integer - LINT2, CINT2 6- 10 Real - Convert to 2/precis Integer - LINTC2, CINTC2 6- 7 Real - Convert to Fraction - FRAC 6- 9 Real - Convert to Fraction - RFRAC, CFRAC 6- 7 Real - Read from string - LRR, CRR 6- 4 Real - read from string - RR 6- 6 Real - Read from terminal - LRRT, CRRT 6- 4 Real - read from terminal - RRT 6- 6 Real - Write E format to string - LWRE, CWRE CVLLIB Manual Page I-11 Index 6- 3 Real - write E format to string - WRE 6- 5 Real - Write E format to terminal - LWRET, CWRET 6- 2 Real - write E format to terminal - WRET 6- 6 Real - Write F format to string - LWRF, CWRF 6- 4 Real - write F format to string - WRF 6- 6 Real - Write F format to terminal - LWRFT, CWRFT 6- 3 Real - write F format to terminal - WRFT 6- 6 Real - Write G format to string - LWRG, CWRG 6- 3 Real - write G format to string - WRG 6- 5 Real - Write G format to terminal - LWRGT, CWRGT 6- 2 Real - write G format to terminal - WRGT 6- 6 Real - Write S format to string - LWRS, CWRS 6- 4 Real - write S format to string - WRS 6- 5 Real - Write S format to terminal - LWRST, CWRST 6- 3 Real - write S format to terminal - WRST 6- 11 Real addition - F$ADDF 6- 11 Real Adjustment Ancillary - R$SET 6- 12 Real Arithmetic Error Messages - F$MESG 6- 11 Real arithmetic from C programmes 6- 2 Real Arithmetic Initialization Routines 6- 12 Real Arithmetic Trap Routines 6- 9 Real Comparison - LCMPR, CCMPR 6- 11 Real Digit Extraction Ancillary - R$DIG 6- 11 Real division - F$DIVF 6- 5 Real I/O - Fortran _C Routines 6- 2 Real I/O - Macro Routines 6- 11 Real multiplication - F$MULF 6- 11 Real Number Ancillary Routines 6- 10 Real Number Arithmetic Routines 6- 7 Real Number Comparison - CMPR 6- 1 Real Number Routines 6- 11 Real Reduction Ancillary - R$RED 6- 12 Real Rounding Ancillary - R$RND 6- 11 Real subtraction - F$SUBF 1- 3 Register Usage (Macro Routines) 8 Release - Determination of 19- 3 Return R0/-1 if CS - LRETC 9- 2 RF - Read filename from string 9- 3 RFD - Read filename from string 9- 3 RFDT - Read filename from TTY 6- 10 RFLT1 - Convert 1/precis Integer to Real 6- 10 RFLT2 - Convert 2/precis Integer to Real 6- 9 RFRAC - Convert Real to Fraction 9- 2 RFT - Read filename from TTY 16- 5 RH - Read hex from string 14- 5 RH2 - Read 2.precis hex from string 14- 5 RH2T - Read 2.precis hex from TTY 16- 5 RHT - Read hex from TTY 19- 2 Right justification subroutine - SRJUST 13- 3 RM - Read 2.precis money from string 10- 3 RM3 - Read 3.precis money from string 10- 2 RM3T - Read 3.precis money from TTY 13- 3 RMT - Read 2.precis money from TTY 16- 4 RN - Read integer (oct, dec or hex) from string CVLLIB Manual Page I-12 Index 14- 4 RN2 - Read 2.precis oct, dec or hex from string 14- 3 RN2T - Read 2.precis oct, dec or hex from TTY 16- 3 RNT - Read integer (oct, dec or hex) from TTY 7- 1 Routines for DATE conversion 6- 4 RR - Read real from string 6- 4 RRT - Read real from terminal 7- 3 RSDAT - Read date from system 19- 3 RSGN - Read sign of number 8- 2 RSTIM - Read time from system 8- 1 RT11 Time 4- 1 RTDAT offset (dateblock) 8- 2 RTIM - Read time from a string 4- 2 RTIM1 offset (timeblock) 4- 2 RTIM2 offset (timeblock) 8- 2 RTIMT - Read a time from the TTY 18- 6 RTRIM - Trim trailing spaces 18- 6 SCOP - Copy string 4- 2 SECS offset (timeblock) 6- 2 Set up floating point traps - FINSET 6- 2 Set up floating point traps - LINSET 16- 1 Single-Precision Integer I/O 4- 3 SIZE offset (fileblock) 18- 1 Size Conversion Routines 1- 5 Spaces and Tabs preceding fields 4- 1 Special Block Format - DATE 4- 2 Special Block Format - TIME 4- 1 Special Block Formats 4- 3 Special Block Formats - FILENAME 18- 5 Special Mode for TTY - TSPM 19- 2 SRJUST - Right justification subroutine 17- 1 String Comparison Routines 1- 4 15- 2 SUB2 - Subtraction of 2.precision integers 12- 3 SUB3 - 3.precision subtraction 19- 1 Subroutines, Ancillary 6- 11 Subtraction (Real) - F$SUBF 15- 2 Subtraction of 2.precision integers - SUB2 1- 6 Suffix character - hexadecimal 14- 1 SYSLIB INTEGER*4 Comparison 7- 2 System date to string - WSDAT 7- 2 System date to TTY - WSDATT 8- 2 System time - Reading - RSTIM 8- 2 System time to string - WSTIM 8- 1 System time to TTY - WSTIMT 4- 2 TCLOCK offset (timeblock) 18- 5 TCRLF - Type 4- 3 Terminal Buffer 4- 3 Terminal I/O 4- 3 Terminal I/O and Command Files 18- 4 Terminal line input - TLIN 18- 4 Terminal line input buffer - TLINB 18- 4 Terminal line output buffer - TLOUB 18- 5 Terminal lower case - TLC 18- 5 Terminal Special Mode - TSPM CVLLIB Manual Page I-13 Index 18- 5 Terminal upper case - TUC 4- 2 TICKS offset (timeblock) 18- 6 TIMBLK - Library TIME block 4- 2 TIMBLK Block 3- 1 TIMBLK.DAT - timeblock description file 8- 3 Time - Convert RT11 to words - CRTIMW 8- 3 Time - convert words to RT11 - CWTIMR 8- 2 Time - Read from string - RTIM 8- 2 Time - Read from system - RSTIM 8- 2 Time - Read from TTY - RTIMT 8- 2 Time - Write system time to string - WSTIM 8- 1 Time - Write system time to TTY - WSTIMT 8- 2 Time - Write to string - WTIM 8- 2 Time - Write to TTY - WTIMT 4- 2 TIME Block Format 8- 1 Time Formats 4- 2 18- 5 TIOW - TTY I/O wait 18- 5 TLC - TTY lower case 18- 4 TLIN - TTY line input 18- 4 TLINB - TTY line input buffer 4- 3 TLINB - User alteration 18- 4 TLOUB - TTY line output buffer 4- 3 TLOUB - User alteration 18- 5 TNIOW - TTY No I/O Wait 18- 5 TNSPM - Reset TTY Special Mode 7- 2 TODAY - Write today and date to string 7- 2 TODAYT - Write today and date to TTY 18- 6 Trailing spaces trimming - RTRIM 6- 12 Trap Routines, Floating Point 18- 6 Trim leading spaces - LTRIM 18- 6 Trim trailing spaces - RTRIM 6- 12 Trim trailing zeroes - R$TZ 12- 1 Triple-precis * 1.precis multiply - MUL31 12- 1 Triple-Precis * 3.precis multiply - MUL33 12- 1 Triple-precis / 1.precis division - DIV31 12- 2 Triple-precis / 3.precis division - DIV33 12- 2 Triple-precis addition - ADD3 12- 2 Triple-precis comparison - CMP3 10- 3 Triple-precis money read from string - RM3 10- 2 Triple-precis money read from TTY - RM3T 10- 2 Triple-precis money write to string - WM3 10- 2 Triple-precis money write to string - WM3D 10- 2 Triple-precis money write to string - WM3DP 10- 2 Triple-precis money write to string - WM3P 10- 1 Triple-precis money write to TTY - WM3DPT 10- 2 Triple-precis money write to TTY - WM3DT 10- 1 Triple-precis money write to TTY - WM3PT 10- 2 Triple-precis money write to TTY - WM3T 12- 2 Triple-precis negation - NEG3 12- 2 Triple-precis negation - NEG32 11- 2 Triple-precis read from TTY - RD3T 11- 2 Triple-precis write to string 11- 1 Triple-precis write to string - WD3P CVLLIB Manual Page I-14 Index 11- 1 Triple-precis write to TTY - WD3PT 11- 1 Triple-precis write to TTY - WD3T 12- 1 Triple-Precision Arithmetic 11- 1 Triple-Precision Integer I/O 11- 1 Triple-precision Integers 10- 1 Triple-Precision limits 10- 1 Triple-Precision Money Routines 11- 2 Triple-precision read from string - RD3 12- 3 Triple-precision subtraction - SUB3 11- 1 Triple-Precision Value Limit 18- 5 TSPM - TTY Special Mode 3- 2 TT Handler Bug - re TT.MAC 18- 5 TTY No I/O Wait - TNIOW 4- 3 TTYIN vs GTLIN TTY Input 18- 5 TUC - TTY upper case 18- 5 Type - TCRLF 7- 2 Type system date to TTY - WSDATT 18- 3 Unsigned division - DIVX 18- 3 Unsigned multiplication - MULX 5 Update History 18- 5 Upper case from TTY - TUC 6- 13 User Subroutine for FP Trap - F$SUB 18- 1 Various Additional Routines 19- 2 W$2P - Ancillary for Wx2P routines 19- 1 W$CT - Ancillary for TTY output with carry 19- 2 W$P - Ancillary for WxP routines 19- 1 W$T - Ancillary for TTY output 19- 3 W2D - Write dec with 1 LZ 9- 2 W50 - Write radix50 to string 9- 2 W50F - Write radix50 (file set) to string 9- 2 W50FT - Write radix50 (filename) to TTY 9- 2 W50T - Write radix50 to TTY 16- 3 W8 - Write oct unsigned to string 14- 3 W82 - Write 2.precis oct to string 14- 3 W82P - Write 2.precis oct to string 14- 2 W82PT - Write 2.precis oct to TTY 14- 3 W82S - Write 2.precis oct to string 14- 2 W82SP - Write 2.precis oct to string 14- 2 W82SPT - Write 2.precis oct to TTY 14- 2 W82ST - Write 2.precis oct to TTY 14- 2 W82T - Write 2.precis oct to TTY 16- 3 W8P - Write oct to string 16- 2 W8PT - Write oct to TTY 16- 3 W8S - Write oct signed to string 16- 2 W8SP - Write oct signed to string 16- 2 W8SPT - Write oct signed to TTY 16- 2 W8ST - Write oct signed to TTY 16- 2 W8T - Write oct to TTY 18- 4 WA - Write ascii to string 18- 3 WAT - Write ascii to TTY 19- 3 WBD - Write dec with leading blank 16- 2 WD - Write dec unsigned to string 14- 2 WD2 - Write 2.precis dec to string 14- 1 WD2P - Write 2.precis dec to string CVLLIB Manual Page I-15 Index 14- 1 WD2PT - Write 2.precis dec to TTY 14- 1 WD2T - Write 2.precis dec to TTY 11- 2 WD3 - Write 3.precis to string 11- 1 WD3P - Write 3.precis to string 11- 1 WD3PT - Write 3.precis to TTY 11- 1 WD3T - Write 3.precis to TTY 7- 3 WDAT - Write date to string 7- 3 WDATT - Write date to TTY 7- 2 WDAY - Write name of day to string 7- 2 WDAYT - Write name of day to TTY 16- 2 WDP - Write dec unsigned to string 16- 1 WDPT - Write dec unsigned to TTY 16- 2 WDS - Write dec signed to string 16- 1 WDSP - Write dec signed to string 16- 1 WDSPT - Write dec signed to TTY 16- 1 WDST - Write dec signed to TTY 16- 1 WDT - Write dec to TTY 9- 2 WF - Write filename to string 9- 1 WFT - Write filename to TTY 16- 3 WH - Write hex to string 14- 3 WH2 - Write 2.precis hex to string 14- 3 WH2T - Write 2.precis hex to TTY 16- 3 WHT - Write hex to TTY 13- 2 WM - Write 2.precis money to string 10- 2 WM3 - Write 3.precis money to string 10- 2 WM3D - Write 3.precis money to string 10- 2 WM3DP - Write 3.precis money to string 10- 1 WM3DPT - Write 3.precis money to TTY 10- 2 WM3DT - Write 3.precis money to TTY 10- 2 WM3P - Write 3.precis money to string 10- 1 WM3PT - Write 3.precis money to TTY 10- 2 WM3T - Write 3.precis money to TTY 13- 2 WMD - Write 2.precis money to string 13- 2 WMDP - Write 2.precis money to string 13- 1 WMDPT - Write 2.precis money to TTY 13- 2 WMDT - Write 2.precis money to TTY 13- 2 WMP - Write 2.precis money to string 13- 1 WMPT - Write 2.precis money to TTY 13- 2 WMT - Write 2.precis money to TTY 6- 3 WRE - Write real E format to string 6- 2 WRET - Write real E format to terminal 6- 4 WRF - Write real F format to string 6- 3 WRFT - Write real F format to terminal 6- 3 WRG - Write real G format to string 6- 2 WRGT - Write real G format to terminal 14- 2 Write 2.precis dec to string - WD2 14- 1 Write 2.precis dec to string - WD2P 14- 1 Write 2.precis dec to TTY - WD2PT 14- 1 Write 2.precis dec to TTY - WD2T 14- 3 Write 2.precis hex to string - WH2 14- 3 Write 2.precis hex to TTY - WH2T 13- 2 Write 2.precis money to string - WM 13- 2 Write 2.precis money to string - WMD 13- 2 Write 2.precis money to string - WMDP CVLLIB Manual Page I-16 Index 13- 2 Write 2.precis money to string - WMP 13- 1 Write 2.precis money to TTY - WMDPT 13- 2 Write 2.precis money to TTY - WMPT 13- 1 Write 2.precis money to TTY - WMPT 13- 2 Write 2.precis money to TTY - WMT 14- 3 Write 2.precis oct to string - W82 14- 3 Write 2.precis oct to string - W82P 14- 3 Write 2.precis oct to string - W82S 14- 2 Write 2.precis oct to string - W82SP 14- 2 Write 2.precis oct to TTY - W82PT 14- 2 Write 2.precis oct to TTY - W82PT 14- 2 Write 2.precis oct to TTY - W82SPT 14- 2 Write 2.precis oct to TTY - W82T 10- 2 Write 3.precis money to string - WM3 10- 2 Write 3.precis money to string - WM3D 10- 2 Write 3.precis money to string - WM3DP 10- 2 Write 3.precis money to string - WM3P 10- 1 Write 3.precis money to TTY - WM3DPT 10- 2 Write 3.precis money to TTY - WM3DT 10- 1 Write 3.precis money to TTY - WM3PT 10- 2 Write 3.precis money to TTY - WM3T 11- 2 Write 3.precis to string - WD3 11- 1 Write 3.precis to string - WD3P 11- 1 Write 3.precis to TTY - WD3PT 11- 1 Write 3.precis to TTY - WD3T 18- 4 Write ascii to string - WA 18- 3 Write ascii to TTY - WAT 7- 3 Write date to string - WDAT 7- 3 Write date to TTY - WDATT 16- 2 Write dec signed to string - WDS 16- 1 Write dec signed to string - WDSP 16- 1 Write dec signed to TTY - WDSPT 16- 1 Write dec signed to TTY - WDST 16- 1 Write dec to TTY - WDT 16- 2 Write dec unsigned to string - WD 16- 2 Write dec unsigned to string - WDP 16- 1 Write dec unsigned to TTY - WDPT 19- 3 Write dec with 1 LZ - W2D 19- 3 Write dec with leading blank - WBD 9- 2 Write filename to string - WF 9- 1 Write filename to TTY - WFT 16- 3 Write hex to string - WH 16- 3 Write hex to TTY - WHT 7- 2 Write name of day to string - WDAY 7- 2 Write name of day to TTY - WDAYT 16- 3 Write oct signed to string - W8S 16- 2 Write oct signed to string - W8SP 16- 2 Write oct signed to TTY - W8SPT 16- 2 Write oct signed to TTY - W8ST 16- 3 Write oct to string - W8P 16- 2 Write oct to TTY - W8PT 16- 2 Write oct to TTY - W8T 16- 3 Write oct unsigned to string - W8 9- 2 Write radix50 (file set) to string - W50F CVLLIB Manual Page I-17 Index 9- 2 Write radix50 (file set) to TTY - W50FT 9- 2 Write radix50 to string - W50 9- 2 Write radix50 to TTY - W50T 6- 6 Write Real E format to string - LWRE, CWRE 6- 3 Write real E format to string - WRE 6- 5 Write Real E format to terminal - LWRET, CWRET 6- 2 Write real E format to terminal - WRET 6- 6 Write Real F format to string - LWRF, CWRF 6- 4 Write real F format to string - WRF 6- 6 Write Real F format to terminal - LWRFT, CWRFT 6- 3 Write real F format to terminal - WRFT 6- 6 Write Real G format to string - LWRG, CWRG 6- 3 Write real G format to string - WRG 6- 5 Write Real G format to terminal - LWRGT, CWRGT 6- 2 Write real G format to terminal - WRGT 6- 6 Write Real S format to string - LWRS, CWRS 6- 4 Write real S format to string - WRS 6- 5 Write Real S format to terminal - LWRST, CWRST 6- 3 Write real S format to terminal - WRST 19- 3 Write sign of number - WSGN 7- 2 Write system date to string - WSDAT 8- 2 Write system time to string - WSTIM 8- 1 Write system time to TTY - WSTIMT 8- 2 Write time to string - WTIM 8- 2 Write time to TTY - WTIMT 7- 2 Write today and date to string - TODAY 7- 2 Write today and date to TTY - TODAYT 7- 1 Writing DATES 1- 5 Writing to a string 6- 4 WRS - Write real S format to string 6- 3 WRST - Write real S format to terminal 7- 2 WSDAT - Write system date to string 7- 2 WSDATT - Type system date to TTY 19- 3 WSGN - Write sign of number 8- 2 WSTIM - Write system time to string 8- 1 WSTIMT - Write system time to TTY 8- 2 WTIM - Write time to string 8- 2 WTIMT - Write time to TTY 4- 1 YEAR offset (dateblock) 18- 4 YES - Read answer from TTY 18- 4 YESNO - Read Yes/No answer from TTY