; ------------------------------------------------------------------ ; ; Name: set BIT CouNTer ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38C ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Writen: 2/17/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This routine counts the number of set bits in a word. The algorithm ; used in based on the fact that the logical .and. of a number n and n-1 ; clears the lowest set bit in a word. The F77 call is: ; CALL BITCNT (iword,icount) where iword is the word to test and ; icount is the returned set bit count. ; ------------------------------------------------------------------ ; ; SUBROUTINE NAME: BYTe bit test ; ; Computer: LSI-11/23 & LSI-11/73 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 11/3/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This subroutine determines if a bit is set or clear within a byte. ; The F77 call is: ; CALL BYTTST (ibyte,ibit,istatus) ; ; The Macro-11 call is: ; a: 0,3 ; b: ibyte ; c: ibit ; d: istatus ; mov a,r5 ; call byttst (jsr pc,byttst) ; where ibyte is the byte to be ; tested, ibit a word holding the bit location to be tested (0 - 7.) ; and istatus is a word to hold the result of the test. ; ; The returned status is identical to the bit, 0 if clear and 1 if ; set, unless the bit position was greater then 7., which causes and ; error return code of -1. Registers r0, r1, r2 and r5 are destroyed. ; ; ------------------------------------------------------------------ ; ; Name: CHaRacter LENgth ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38C ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Implemented: 2/4/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This routine returns the actual number of characters in an ASCII ; string. The asumption is made that the null character is the last ; character in the string. The Fortran call is: ; CALL CHRLEN (string, ilen) where string is the string ; to check and ilen is a integer*2 variable to hold the length. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Name: DAY of week ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 2-Oct-86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This module consists of two subroutines which share 90% common ; code. The first is MACDAY, which returns the day of the week to ; calling MACRO-11 routines. The second is F77DAY, which does the same ; for Fortran. When MACDAY is called local event flag 24 is set, so user ; programs must take care not to use this flag. Later in the common code ; this flag is used to determine if the return should be through R0 or ; the F77 OTS. Registers R1-R5 are saved, but must be restored by the ; user if so desired. The calling sequence is: ; ; MACRO-11 jsr pc,macday The result is returned in R0. ; ; Fortran-77 CALL F77DAY(cstring) Where cstring is a 9 byte ; variable. .nlist bin ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Name: PCA RSX file open routines ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Implemented: 10/8/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; R. Neitzel 10/27/86 Added conversion of file ; name and type to ASCII from ; RAD50 and device number and ; version to ASCII octal. ; ; Description: ; This set of subroutines allows the caller to do the following: ; 1> Open a file with a wildcard filespec. The following are legal ; types - x.x;* x.*;* *.x;* *.*;* ; 2> Retrieve the name and version number of the currently open file. ; 3> Move through a list of files by using the wildcard filespecs. ; 4> Return to the first file of a wildcard set. ; ; To use these routines the subroutine pcaini must be used first. ; This subroutine creates the data set block used to open the file by name. ; The F77 call is: ; CALL PCAINI([d],[ds],[u],[us],[f],[fs]) where d is the ; device name, ds the number of characters in the device name, u the UIC ; (form:[xxx,xxx]), us the number of characters in u, f the file name and ; fs the number of characters in f. ; ; To open a file use the routine pcaopn. This routine is accessed via ; the USEROPEN option within the F77 OPEN statement. pcaopn must be ; declared as an EXTERNAL function. This will open the next file type that ; matches the one used in pcaini. If this is the first use of pcaopn the ; file with the lowest version number of the first file in the directory ; that matches will be used. When coding the open statement you must give ; some file name, however, this need not be that of an existing file (and ; certainly not your true file if you are using wildcards). Further, the ; status of the file must be 'OLD'. ; The F77 call is: ; ........ ; EXTERNAL PCAOPN ; ........ ; ........ ; OPEN(UNIT=LUN,file='DUMMY',...,STATUS='OLD',USEROPEN=PCAOPN) ; ; You may open a series of files simply by repeating the calling to pcaopn. ; To determine when the end of the list is reached use the system routine ; ERRSET to allow transfer of control to a specified ERR line when the ; code IE.NSF is returned. ; ; To return to the first file of a list call pcarst. The call is: ; CALL PCARST ; ; To get the name and version number of the currently open file use ; pcanam. This will give you the device name and number as well. This ; routine must not be called until AFTER opening a file using pcaopn or you ; will get garbage. The F77 call is: ; ; CALL PCANAM ([ds],[dn],[fn],[ft],[v]) where ds is a ; 2 byte buffer for the ASCII device name, dn a 3 byte buffer for the ; ASCII device number (octal notation), fn an 9 byte buffer for the file ; name, ft a 3 byte buffer for the file type and v a 3 byte buffer for ; the ASCII version number (octal notation). Note that the old familar '.' ; and ';' are not returned. ; ; If you want the device and/or version numbers as numbers use pcanm2. ; This will return the actual values. Follow the warning for pcanam. The ; F77 call is: ; CALL PCANM2 ([dn],[vn]) where dn is a word variable for ; the device number and vn is a word variable for the version number. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Name: FILe SIZe routine ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 12/3/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This file contains two routines that allow determination of ; various file characteristics. These are: record type (fixed, variable or ; segmented), record size, number of bytes used and the number of records ; in the file. The first is for use with all files while the second is ; for files using NOSPANBLOCKS. ; ; The first routine is called FILSIZ. No knowledge about the file's ; structure is required to obtain the following: record type, record ; size, number of bytes in file and number of records in file. ; The F77 call is: ; ; CALL FILSIZ (lun, itype, isize, ibytes, irec) where ; lun is the file's LUN number, itype is the returned value of the ; record type (1 for fixed, 2 for variable and 3 for segmented, however ; see note below), isize is the size of the record in bytes, ibytes is ; the size of the data area in bytes and irec is the number of records ; in the file. All are integer*2 variables except for ibytes and irec, ; which are integer*4 variables. ; ; This routine has been tested on direct access and sequential ; files, with the latter using fixed and variable record lengths. It ; must be noted that isize for a variable length file returns the size ; of the largest record in the file, while the ibytes and irec values ; are meaningless. ; ; Another interesting quirk is the fact that the number of bytes ; returned for a fixed length file with an odd record size will not ; match the predicted number. Instead the returned value will be greater ; by the number of records in the file. This is due to padding to ; preserve even byte starting addresses. This is why odd sizes ; are rounded up. ; ; The second routine is called NOSPAN. The F77 call is: ; CALL NOSPAN (lun, itype, isize, iblocks, ilast) where lun is ; the LUN of the file, itype the record type (as described above), isize ; the record size in bytes, iblocks the number of blocks in the file ; minus one (since the last block may not be fully used) and ilast is ; the last byte used in the last block. All are integer*2 variables ; but iblocks which is integer*4. ; ; In using the results remember that files with odd record sizes ; actually allocate one more byte per record then indicated. Again both ; direct and sequential files have been tested, and the block count and ; last byte for variable length files, while correct, are meaningless. ; ; NOTE: The FILSIZ routine may also be used for files that use NOSPANBLOCKS. ; This is especially useful for opening a file when the attributes are ; unknown. In this case the itype variable will be 9, 10 or 11, the ; addition of 8 being the mark of the nospan attribute. In this case ; ibytes will be the same as iblocks and irec as ilast in NOSPAN. ; However, if the value of irec is greater then the the integer*2 ; maximum prior to the call you will get garbage, so if you are uncertain ; about span/nospan clear irec first. ; ; ------------------------------------------------------------------ ; ; Name: MAKE a i*4 variable ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38C ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Writen: 2/17/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This routine takes two i*2 variables and converts them into an i*4 ; variable. The F77 call is: ; CALL MAKE4 (i4,ilow,ihigh) where i4 the resultant integer*4 ; variable, ilow is the low order word and ihigh is the high order word. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Name: output MeSsage to TI: ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 11/26/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This subroutine prints a message to the TI: unit (lun 5) of a task. ; The task's name is also printed. Message length is limited to one line ; and the maximum number of characters printed is limited to @70. The F77 ; call is: ; CALL MSG5 (string) whre string is any legal form of ; character data. ; ; Due to the use of $errlg, this routine cannot be called by other MACRO ; routines unless they are also part of a Fortran program. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Name: ODD to even ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 12/4/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This routine takes an integer and if it is odd makes it even. The ; new value is either 1 greater or less then the origional. The F77 call ; is: ; CALL ODD(iselect, ivalue) where iselect is the value that ; determines if addition or subtraction is performed (1 means add, 2 ; subtract, any other value is an error) and ivalue is the variable to be ; worked on. ; ; ------------------------------------------------------------------ ; ; Name: PUSH/POP routines ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38C ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 3/17/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This set of routines allows the user to push and pop variables ; onto a user defined stack. Two versions are supplied, one for 2 byte ; variables (PUSH/POP2) and one for four byte variables (PUSH/POP4). The ; F77 call is: ; CALL PUSHn (num, x, y, ...) ; CALL POPn (num, x, y, ...) where n is the correct ; number indicating the number of bytes in the variables used, num is ; the number of variables to be used and x and y are the variables ; themselves. IT IS EXTREMELY IMPORTANT THAT YOU NOTE THAT POPPED ; VARIABLES ARE RETURNED IN THE INVERSE ORDER IN WHICH THEY WERE PUSHED - ; CALL PUSH2(2,A1,A2) CALL POP2(2,A2,A1) ; ; Calls to the routines must be symetric, that is, a call to PUSH2 ; cannot be followed by a call to POP4, and the number of variables used ; must be the same in the matching calls. The limit on the number of ; variables that can be pushed is set by the size of the stack area. The ; current limit is 100 word size variables or 50 long words. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; SUBROUTINE NAME: WoRD bit TeST ; ; Computer: LSI-11/23 & LSI-11/73 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 11/3/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This subroutine determines if a bit is set or clear within a word. ; The F77 call is: ; CALL WRDTST (iword,ibit,istatus) ; ; The Macro-11 call is: ; a: 0,3 ; b: iword ; c: ibit ; d: istatus ; mov a,r5 ; call wrdtst (jsr pc,wrdtst) ; where iword is the word to be ; tested, ibit a word holding the bit location to be tested (0 - 15.) ; and istatus is a word to hold the result of the test. ; ; The returned status is identical to the bit, 0 if clear and 1 if ; set and -1 if the bit selection was illegal. Registers r0, r1, r2 ; and r5 are destroyed. ; ; ---Executable statements begin here--- ; ; ------------------------------------------------------------------ ; ; SUBROUTINE NAME: WoRD bit SET ; ; Computer: LSI-11/23 & LSI-11/73 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 11/3/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This subroutine determines sets a bit within a word. ; The F77 call is: ; CALL WRDSET (iword,ibit,istatus) ; ; The Macro-11 call is: ; a: 0,3 ; b: iword ; c: ibit ; d: istatus ; mov a,r5 ; call wrdset (jsr pc,wrdset) ; where iword is the word to be ; used, ibit a word holding the bit location to be set (0 - 15.) ; and istatus is a word to hold the result status. ; ; The returned status is 1 if the operation is successful and -1 if ; the bit selection was illegal. Registers r0, r1, r2 ; and r5 are destroyed. ; ; ---Executable statements begin here--- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; SUBROUTINE NAME: WoRD bit CLeaR ; ; Computer: LSI-11/23 & LSI-11/73 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 11/3/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; ; Description: ; This subroutine determines clears a bit within a word. ; The F77 call is: ; CALL WRDCLR (iword,ibit,istatus) ; ; The Macro-11 call is: ; a: 0,3 ; b: iword ; c: ibit ; d: istatus ; mov a,r5 ; call wrdclr (jsr pc,wrdclr) ; where iword is the word to be ; used, ibit a word holding the bit location to be cleared (0 - 15.) ; and istatus is a word to hold the result status. ; ; The returned status is 1 if the operation is successful and -1 if ; the bit selection was illegal. Registers r0, r1, r2 ; and r5 are destroyed. ; ; ------------------------------------------------------------------ ; ; Name: HIGH and LOW byte replacement ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 12/11/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; These two routines put a byte into either the upper or lower half of ; a word. The savings in code are 9 lines in lowb and 7 for highb over ; doing this via Fortran. The call is: ; CALL {LOWB/HIGHB} (iword,byte) where iword is the word to be ; manipulated and byte is the byte value to use. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; Name: BIT REVersal routines ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 12/18/86 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This set of two routines allows the user to reverse the bit order ; of either an Integer*2 or Integer*4 variable. The number of bits to be ; reversed may also be specified. The integer*4 form is a subroutine ; call with the form being: ; CALL BITR4 (irev, ibits) where irev is an integer*4 variable ; to be reversed and ibits is the integer*2 number of bits to operated ; on. ; ; The integer*2 form is a function call of the form: ; iresult = IBITR2 (irev, ibits) where iresult is an integer*2 ; variable to recieve the function result, irev is the integer*2 ; variable to reverse and ibits is the integer*2 number of bits to ; operate on. ; ; Note that if ibits is less then the maximum allowed value any ; bits over that number are lost in the reversal. The maximum value for ; BITR4 is 32. and 16. for IBITR2. ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; ; ; ; ; ----------------------- ; ; this is file EVEN.MAC ; ; ----------------------- ; ; ; ; ; ; Compilation command line: ; ; ; ; MCR>MAC EVEN=EVEN ! normal command line ; ; ; ; ; ; ------------------------------------------------------------------ ; ; Name: EVEN to odd ; ; Computer: LSI-11/23 ; Operating System: RSX-11M V4.2 BL38C ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 1/7/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; This routine takes an integer and if it is even makes it odd. The ; new value is either 1 greater or less then the original. The F77 call ; is: ; CALL even(iselect, ivalue) where iselect is the value that ; determines if addition or subtraction is performed (1 means add, 2 ; subtract, any other value is an error) and ivalue is the variable to be ; worked on. ; ; ------------------------------------------------------------------ ; ; Name: GET the high or low BYTe from a word ; ; Computer: LSI-11/23 -11/73 ; Operating System: RSX-11M V4.2 BL38c ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 1/16/11/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; These two routines get a byte from either the upper or lower half of ; a word. The savings in code are 9 lines in lowb and 7 for highb over ; doing this via Fortran. The call is: ; CALL {GETLOW/GETHI} (iword,byte) where iword is the word to be ; manipulated and byte is the byte value retruned. ; ; ------------------------------------------------------------------ ; ; Name: upper/lower case routines ; ; Computer: LSI-11/23 -11/73 ; Operating System: RSX-11M V4.2 BL38B ; Language: MACRO-11 ; Original Programmer: R. E. K. Neitzel ; Rockwell International ; Rocky Flats Plant ; Process Control Applications ; Golden, CO 80401 ; (303) 966-7171 ; ; Date Written: 1/12/87 ; ; ; Revisions: Programmer Date Description ; ---------- -------- --------------------- ; ; ; Description: ; These subroutines allow the Macro and Fortran programmer to ; convert letters in character strings from one case to the other. ; Non-letter characters and those already in the desired case are not ; effected. The routines uplow and lowup are Fortran routines to convert ; upper to lower case and vice versa. The Fortran calls are: ; CALL UPLOW (string,length) ; CALL LOWUP (string,length) where string is the string to ; process and length is the number of characters in the string to ; process. ; ; The routine $cvtlc is called by Macro programs and by the uplow ; routine to covert upper to lower case. The Macro call is: ; put starting address of input string in r0 ; put starting address of output string in r1 ; put number of characters in r2 ; call $cvtlc ; ; Note that this is the same calling method used for the system library ; routine $cvtuc. Also note that the Fortran routines always equate the ; input to the output string. ;