.TITLE VRTARY.MAC 85f05a 02-Jan-85/05-Jun-85. .SBTTL Virtual Array Access Routines ; Author: N. A. Bourgeois, Jr. ; of ; NAB Software Services, Inc. ; PO BOX 20009 ; Albuquerque, NM 87154 ; and ; Sandia National Laboratories ; Systems Engineering Division 5238 ; PO Box 5800 ; Albuquerque, NM 87185 ; THIS SOFTWARE IS ISSUED BY SANDIA NATIONAL LABORATORIES, ; OPERATED FOR THE UNITED STATES DEPARTMENT OF ENERGY BY ; SANDIA CORPORATION. ; ; NOTICE ; ; THIS SOFTWARE WAS SPONSORED BY THE UNITED STATES ; GOVERNMENT. NEITHER THE UNITED STATES GOVERNMENT NOR ; THE UNITED STATES DEPARTMENT OF ENERGY, NOR ANY OF THEIR ; EMPLOYEES, NOR ANY OF THEIR CONTRACTORS, SUBCONTRACTORS, ; OR THEIR EMPLOYEES MAKES ANY WARRANTY, EXPRESS OR ; IMPLIED, OR ASSUMES ANY LEGAL LIABILITY OR ; RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS OR ; USEFULNESS OF ANY INFORMATION, APPARATUS, PRODUCT OR ; PROCESS DISCLOSED, OR REPRESENTS THAT ITS USE WOULD NOT ; INFRINGE PRIVATELY OWNED RIGHTS. ; ; THIS WORK WAS SPONSORED AND FUNDED BY: ; ; HEADQUARTERS, ESD / OCB / STOP 36 ; HANSCOM AIR FORCE BASE, MA 01731 .SBTTL Edit Record 02-Jan-85/05-Jun-85. ;02-Jan-85: Original creation started. ;08-Mar-85: Original creation completed. ;14-Mar-85: Cleaned up many typing errors in comments. ;05-Jun-85: Fixed 2Mb boundary bug in INIRGN and REMAP routines. ; Updated TSX references. Added TSTCOL to requirements ; for SETUP routine. .PAGE .SBTTL ******************** .SBTTL * User Information * .SBTTL ******************** .SBTTL Description 02-Jan-85/14-Mar-85. ;These routines, written in MACRO-11 [1], declare and access extended ;memory for a very large virtual image array. They are IVINIT, ;IPTROW, IGTROW, IPTCOL, IGTCOL, and IVELIM. The routines are ;callable from both FORTRAN-IV [2,3] and FORTRAN-77 [4,5] under both ;RT11XM [6,7] and TSX-Plus [8,9]. ; ;IVINIT initializes the virtual array in memory and must be called ;first. IPTROW, IGTROW, IPTCOL, and IGTCOL move single rows and ;columns between a FORTRAN buffer and the virtual array. IVELIM ;eliminates the virtual array and must be called last. ; ;Cell or element size is declarable as 1, 2, 4, or 8 bytes in ;length. Rows and columns are not required to be of equal length. ;Elements of a row are adjacent in memory ala ARRAY(IROW,ICOL) of ;FORTRAN. The maximun size of the array is limited only by the amount ;of memory available. ; ;Declaration of row and column length, element size, and FORTRAN ;buffer are made in a call to IVINIT. Only row and column index ;numbers are required in calls to IPTROW, IGTROW, IPTCOL, and IGTCOL. ;No arguments are needed in the call to IVELIM. ; ;Calling sequences: ; ;Initialize the array. ; ; IERR = IVINIT (NROW,NCOL,NSIZ,BUFF) ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; -2 NROW or NCOL zero or negative. ; ; -3 NSIZ not 1, 2, 4, or 8. ; ; -4 not enough memory is available for the ; virtual array size requested. ; ; NROW is the number of rows in the array. ; ; NCOL is the number of columns in the array. ; ; NSIZ is the length of each array element in bytes ; and must be either one of the following: ; ; 1 for byte value array elements. ; ; 2 for integer value array elements. ; ; 4 for real value array elements. ; ; 8 for complex value array elements. ; ; BUFF is the name of the FORTRAN buffer that must be ; able to contain a single row or column of the ; array. It must be dimensioned to the larger ; of NROW or NCOL. No error value is returned ; if BUFF is dimensioned too small. ; ;Put a row into the array. ; ; IERR = IPTROW (IROW) ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; -5 IROW greater than NROW. ; ; IROW is the index number of the row to be moved ; from BUFF to the virtual array in the range of ; 1 to NROW. ; ;Get a row from the array. ; ; IERR = IGTROW (IROW) ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; -5 IROW greater than NROW. ; ; IROW is the index number of the row to be moved ; from the virtual array to BUFF in the range of ; 1 to NROW. ; ;Put a column into the array. ; ; IERR = IPTCOL (ICOL) ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; -6 ICOL greater than NCOL. ; ; ICOL is the index number of the column to be moved ; from BUFF to the virtual array in the range of ; 1 to NCOL. ; ;Get a column from the array. ; ; IERR = IGTCOL (ICOL) ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; -6 ICOL greater than NCOL. ; ; ICOL is the index number of the column to be moved ; from the virtual array to BUFF in the range of ; 1 to NCOL. ; ;Eliminate the array. ; ; IERR = IVELIM () ; ; where: IERR is the error value returned by the called ; routine as follows: ; ; 0 no error, normal return. ; ; -1 wrong number of arguments in call. ; ; ;Note that all error conditions described are negative values. Should ;an error condition with a positive value be returned, see either ;Chapter 2 of the "RT-11 Programmer's Reference Manual" [10] or Table ;4-14 of the "RT-11 Software Support Manual" [11] for an explanation ;of the error condition. .SBTTL Calling Program Requirements 11-Jan-85/05-Feb-85. ;The memory requirements for the virtual array supported by this set of ;routines can approach 4 megabytes. This requirement must be met with ;a contiguous area of memory. On TSX-Plus systems this may require the ;forcing of a job to occupy the lowest possible position in memory. ;There are routines in TSXLIB [12] that will be found useful for this ;purpose. It may also be useful to write the application program such ;that it will be capable of running under either RT-11 or TSX-Plus. ;The example below illustrates these points. ; ; . ; . ; . ; INTEGER TSXFLG ; C ; TSXFLG = ITSLIN () ! test for TSX-Plus ; IF (TSXFLG .EQ. 0) GO TO 100 ! if under TSX, ; IERR = LKLOMY () ! move and lock job ; IF (IERR .EQ. 0) STOP ! to lowest position ; 100 CONTINUE ; C ; IERR = IVINIT (NROW,NCOL,NSIZ,BUFFER) ; . ; . ; . ; IERR = IVELIM () ; C ; IF (TSXFLG .EQ. 0) GO TO 200 ! if under tsx, ; IERR = IUNLKM () ! unlock the job ; IF (IERR .EQ. 0) STOP ; 200 CONTINUE ; . ; . ; . ; ;The ITSLIN routine returns the TSX-Plus line number on which the job ;is running or a zero if RT-11 is running. The error returned by the ;LKLOMY and IUNLKM routines is zero if realtime support is not included ;in TSX-Plus or if the job does not have operator privilege, otherwise ;the value returned is negative. .SBTTL Building Procedures 08-Jan-85/17-Jan-85. ;General instructions for building an application program using ;FORTRAN-IV, FORTRAN-77, and RATFOR [13] are summarized below. See ;the Linker chapter of RT-11 "System Utilities Manual" [14] for ;details on using the overlay capability if required. The assembler, ;compilers, linker, and libraries are assumed to be on the system ;device. The application program and this set of routines are assumed ;to be on the default device. ; ;Assemble this set of routines. ; ; .RUN SY:MACRO DK:VRTARY,VRTARY/C=DK:VRTARY ; ;Compile the application program. ; ; .RUN SY:FORTRAN DK:PRGNAM,PRGNAM=DK:PRGNAM/W ; ; .RUN SY:F77 DK:PRGNAM,PRGNAM=DK:PRGNAM ; ; .RUN SY:RATFOR DK:PRGNAM,PRGNAM=DK:PRGNAM ; .RUN SY:FORTRAN DK:PRGNAM=DK:PRGNAM ; ;Link the several modules. ; ; .RUN SY:LINK DK:PRGNAM,PRGNAM/W=DK:PRGNAM,VRTARY,SY:TSXLIB,FPULIB ; ; .RUN SY:LINK DK:PRGNAM,PRGNAM/W=DK:PRGNAM,VRTARY,SY:TSXLIB,F77OTS .PAGE .SBTTL ********************* .SBTTL * Other Information * .SBTTL ********************* .SBTTL Memory Layout 15-Jan-85/30-Jan-85. ;A region of contiguous memory is allocated to the job for the virtual ;array. Then a window located where the I/O page normally resides in ;the job area is mapped to the region for access to the array. The ;mapped area is moved as required for access to the particular cell(s) ;of the array. ; ; . . ; . high address . ; |---------------| varray(nrow,ncol) ; | | ^ ; | | | ; . . | | | ; . . | | | ; 64kb |---------------| | | | ; | 8kb window |\ | | | ; | (I/O page) | \ | | | ; 56kb |---------------| \ | | | ; . .\ \ | | | ; . . \ \ | | | ; . unused . \ \ | | | ; . . \ \| | | ; . . \ |---------------| virtual array ; |---------------| \ | 8kb mapped | region ; | | \| to window | | ; | | |---------------| | ; | | | | | ; | job | | | | ; | space | | | | ; | | | | | ; | | | | | ; | | | | | ; 0kb |---------------| | | | ; | | v ; |---------------| varray(1,1) ; . low address . ; . . ; ; Virtual Memory Physical Memory .SBTTL Addressing Algorithms 15-Jan-85/14-Mar-85. ;Organization of the virtual array is as for the normal FORTRAN ;array of two dimensions, ARRAY(IROW,ICOL), in which the first ;index points to elements that occupy adjacent or consectuive ;locations in memory. The address in bytes of any given element ;or cell of the virtual array (offset from the start of the region ;that contains the virtual array) is calculated as a double integer ;value as follows: ; ; SACELL = ((IROW-1)*NCOL + (ICOL-1)) * NSIZ ; ;The window number is then: ; ; WDNUM = INT (SACELL / (WDSIZ*64)) ; ; 1 <= WDNUM <= 320 ; ;The offset in bytes into the window is the remainder from the above ;or: ; ; WDOFF = MOD (SACELL / (WDSIZ*64)) ; ; 0 <= WDOFF <= 8191 .SBTTL Hiearchical Diagrams 08-Jan-85/05-Feb-85. ;In the diagrams below, the routine names in capital letters are a ;part of this set of virtual array access routines. Those routine ;names that are in lower case letters are calls for system services. ;The routines listed in the leftmost column are the entry point or ;interface routines. The others (in capital letters) are supporting ;subroutines. ; ;Get a column. ; ; IGTCOL ; TSTCOL ; SETUP ; CRAWND ; .craw ; CALCSA ; CAWNOF ; MAPWND ; .map ; GETCOL ; GCBYTS ; STPTRS ; REMAP ; MAPWND ; .map ; GCINTS ; STPTRS ; REMAP ; MAPWND ; .map ; GCRELS ; STPTRS ; REMAP ; MAPWND ; .map ; GCCMPS ; STPTRS ; REMAP ; MAPWND ; .map ; CLNUP ; UNMAPW ; .unmap ; ELAWND ; .elaw ; ;Get a row. ; ; IGTROW ; TSTROW ; SETUP ; CRAWND ; .craw ; CALCSA ; CAWNOF ; MAPWND ; .map ; GETROW ; GRBYTS ; STPTRS ; REMAP ; MAPWND ; .map ; GRINTS ; STPTRS ; REMAP ; MAPWND ; .map ; GRRELS ; STPTRS ; REMAP ; MAPWND ; .map ; GRCMPS ; STPTRS ; REMAP ; MAPWND ; .map ; CLNUP ; UNMAPW ; .unmap ; ELAWND ; .elaw ; ;Put a column. ; ; IPTCOL ; TSTCOL ; SETUP ; CRAWND ; .craw ; CALCSA ; CAWNOF ; MAPWND ; .map ; PUTCOL ; PCBYTS ; STPTRS ; REMAP ; MAPWND ; .map ; PCINTS ; STPTRS ; REMAP ; MAPWND ; .map ; PCRELS ; STPTRS ; REMAP ; MAPWND ; .map ; PCCMPS ; STPTRS ; REMAP ; MAPWND ; .map ; CLNUP ; UNMAPW ; .unmap ; ELAWND ; .elaw ; ;Put a row. ; ; IPTROW ; TSTROW ; SETUP ; CRAWND ; .craw ; CALCSA ; CAWNOF ; MAPWND ; .map ; PUTROW ; PRBYTS ; STPTRS ; REMAP ; MAPWND ; .map ; PRINTS ; STPTRS ; REMAP ; MAPWND ; .map ; PRRELS ; STPTRS ; REMAP ; MAPWND ; .map ; PRCMPS ; STPTRS ; REMAP ; MAPWND ; .map ; CLNUP ; UNMAPW ; .unmap ; ELAWND ; .elaw ; ;Eliminate the array. ; ; IVELIM ; .elrg ; ;Initialize the array. ; ; IVINIT ; TSARGS ; CRRGN ; .crrg ; INIRGN ; CRAWND ; .craw ; MAPWND (2) ; .map ; UNMAPW ; .unmap ; ELAWND ; .elaw .SBTTL References 17-Jan-85/21-Jan-85. ;1. "PDP-11 MACRO-11 Language Reference Manual", AA-V027A-TC, ; Digital Equipment Corporation, Maynard, MA, March 1983. ; ;2. "PDP-11 FORTRAN IV language Reference Manual", AA-R953A-TK, ; Digital Equipment Corporation, Maynard, MA, March 1983. ; ;3. "RT-11, RSTS/E FORTRAN IV User's Guide", AA-5749B-TC and ; Update Notice AD-5749B-T1, Digital Equipment Corporation, ; Maynard, MA, March 1983. ; ;4. "PDP-11 FORTRAN-77 Language Reference Manual", AA-V193A-TK, ; Digital Equipment Corporation, Maynard, MA, July 1983. ; ;5. "PDP-11 FORTRAN-77/RT-11 User's Guide", Digital Equipment ; Corporation, Maynard, MA, March 1984. ; ;6. "RT-11 System User's Guide", AA-5279C-TC, Digital Equipment ; Corporation, Maynard, MA, March 1983. ; ;7. "RT-11 System Release Notes",AA-5286E-TC, Digital Equipment ; Corporation, Maynard, MA, March 1983. ; ;8. "TSX-Plus Reference Manual", S & H Computer Systems, Inc., ; Nashville, TN, February 1984. ; ;9. "TSX-Plus Version 5.0 Release Notes", S & H Computer Systems, ; Inc., Nashville, TN, February 1984. ; ;10. "RT-11 Programmer's Reference Manual", AA-H378B-TC, Digital ; Equipment Corporation, Maynard, MA, March 1983. ; ;11. "RT-11 Software Support Manual", AA-H379B-TC, Digital Equipment ; Corporation, Maynard, MA, March 1983. ; ;12. "TSXLIB: A Library Implementation of the TSX-Plus EMTs", ; 11-490, DECUS, Marlboro, MA, October 1984. ; ;13. RATFOR from the "Symposium Tape from the RT-11 SIG, Fall 1980, ; San Diego", 11-SP-17, DECUS, Marlboro, MA, Fall 1980. ; ;14. "RT-11 System Utilities Manual", AA-M239A-TC, Digital Equipment ; Corporation, Maynard, MA, March 1983. .PAGE .SBTTL **************** .SBTTL * Data Section * .SBTTL **************** .SBTTL Directives 02-Jan-85/05-Jun-85. .IDENT \85f05a\ ;version .PSECT VRTARY ;for code .PSECT VADATA ;for memory allocations .SBTTL Assignments 02-Jan-85/22-Feb-85. EIGHT = 8. ;constant ERRBYT = 52 ;system error byte location FIVE = 5. ;constant FOUR = 4. ;constant ONE = 1. ;constant SEVEN = 7. ;constant SIX = 6. ;constant THREE = 3. ;constant TWO = 2. ;constant WDSIZ = 128. ;64.-byte (32.-word) window units .SBTTL Macros 03-Jan-85/01-Feb-85. .MCALL .CRAW ;create a window .MCALL .CRRG ;create a region .MCALL .ELAW ;eliminate a window .MCALL .ELRG ;eliminate a region .MCALL .MAP ;map a window into a region .MCALL .RDBBK ;declare a region definition block .MCALL .UNMAP ;unmap a window .MCALL .WDBBK ;declare a window definition block .SBTTL Memory Allocations 03-Jan-85/06-Feb-85. BUFF:: .WORD 0 ;calling program buffer address CAREA: .BLKW 2 ;.CRRG argument block COLINC: .WORD 0 ;column increment in bytes DUNFLG: .WORD 0 ;done flag ERRFLG: .WORD 0 ;error flag ICOL: .WORD 0 ;column index number IROW: .WORD 0 ;row index number NCOL: .WORD 0 ;number of columns NROW: .WORD 0 ;number of rows NSIZ: .WORD 0 ;length of element in bytes RDB:: .RDBBK VASIZ ;region definition block SACELL: .BLKW 2 ;offset address of first cell ; of the row or column in bytes VASIZ: .WORD 0 ;length of virtual array in ; 32.-word units WDB:: .WDBBK SEVEN ,WDSIZ ;window definition block WDLEN: .WORD 0 ;window length in bytes WDNUM: .WORD 0 ;window number or pointer WDOFF: .WORD 0 ;offset into a window in bytes .PAGE .SBTTL ************************ .SBTTL * Entry Point Routines * .SBTTL ************************ .PSECT VRTARY ;Calling sequences to these entry point or interface routines are ;given above in the description section. On entry R5 points to the ;standard FORTRAN argument list. R0 through R5 may be used with ;impunity. The stack pointer (R6) must be restored to the value it ;had on entry if it is used. .SBTTL IGTCOL, get a column 03-Jan-85/29-Jan-85. ;This subroutine transfers the column, whose index number is given in ;the single argument, from the virtual array to the FORTRAN buffer ;pointed to by BUFF. The number of elements to be transferred is ;given in NCOL. It calls a routine to test and save the argument. ;It calls a routine to set things up for the transfer. It calls a ;routine to transfer the column. It calls a routine to clean things ;up following the transfer. ; ;Called by: Host program. ; ;Requirements: Prior call to IVINIT and one argument. ; ;Uses: R0. ; ;Calls: CLNUP, GETCOL, SETUP, and TSTCOL. ; ;Returns: A column of values to the host program's buffer and the ; error-noerror value. IGTCOL:: CALL TSTCOL ;test and save the argument TST ERRFLG ;error condition? BNE 9$ ; yes CALL SETUP ;for the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CALL GETCOL ;transfer the column TST ERRFLG ;error condition? BNE 9$ ; yes CALL CLNUP ;from the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL IGTROW, get a row 03-Jan-85/29-Jan-85. ;This subroutine transfers the row, whose index number is given in the ;single argument, from the virtual array to the FORTRAN buffer pointed ;to by BUFF. The number of elements to be transferred is given in ;NROW. It calls a routine to test and save the argument. It calls a ;routine to set things up for the transfer. It calls a routine to ;transfer the row. It calls a routine to clean things up following ;the transfer. ; ;Called by: Host program. ; ;Requirements: Prior call to IVINIT and one argument. ; ;Uses: R0. ; ;Calls: CLNUP, GETROW, SETUP, and TSTROW. ; ;Returns: A row of values to the host program's buffer and the error- ; noerror value. IGTROW:: CALL TSTROW ;test and save the argument TST ERRFLG ;error condition? BNE 9$ ; yes CALL SETUP ;for the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CALL GETROW ;transfer the row TST ERRFLG ;error condition? BNE 9$ ; yes CALL CLNUP ;from the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL IPTCOL, put a column 03-Jan-85/29-Jan-85. ;This subroutine transfers the column, whose index number is given in ;the single argument, from the FORTRAN buffer pointed to by BUFF to the ;virtual array. The number of elements to be transferred is given in ;NCOL. It calls a routine to test and save the argument. It calls a ;routine to set things up for the transfer. It calls a routine to ;transfer the column. It calls a routine to clean things up following ;the transfer. ; ;Called by: Host program. ; ;Requirements: Prior call to IVINIT and one argument. ; ;Uses: R0. ; ;Calls: CLNUP, PUTCOL, SETUP, and TSTCOL. ; ;Returns: A column of values to the virtual array and the error-noerror ; value. IPTCOL:: CALL TSTCOL ;test and save the argument TST ERRFLG ;error condition? BNE 9$ ; yes CALL SETUP ;for the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CALL PUTCOL ;transfer the column TST ERRFLG ;error condition? BNE 9$ ; yes CALL CLNUP ;from the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL IPTROW, put a row 03-Jan-85/29-Jan-85. ;This subroutine transfers the row, whose index number is given in the ;single argument, from the FORTRAN buffer pointed to by BUFF to the ;virtual array. The number of elements to be transferred is given in ;NROW. It calls a routine to test and save the argument. It calls a ;routine to set things up for the transfer. It calls a routine to ;transfer the row. It calls a routine to clean things up following ;the transfer. ; ;Called by: Host program. ; ;Requirements: Prior call to IVINIT and one argument. ; ;Uses: R0. ; ;Calls: CLNUP, PUTROW, SETUP, and TSTROW. ; ;Returns: A column of values to the virtual array and the error-noerror ; value. IPTROW:: CALL TSTROW ;test and save the argument TST ERRFLG ;error condition? BNE 9$ ; yes CALL SETUP ;for the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CALL PUTROW ;transfer the row TST ERRFLG ;error condition? BNE 9$ ; yes CALL CLNUP ;from the transfer TST ERRFLG ;error condition? BNE 9$ ; yes CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL IVELIM, eliminate the array 03-Jan-85/14-Mar-85. ;This subroutine must be called last. It eliminates the virtual array. ; ;Called by: Host program. ; ;Requirements: Prior call to IVINIT. ; ;Uses: R0. ; ;Calls: .ELRG. ; ;Returns: Error-noerror value. IVELIM:: TSTB (R5) ;zero arguments present? BEQ 1$ ; yes MOV #-ONE ,R0 ; no, so load the error BR 9$ ; code and quit 1$: .ELRG #CAREA ,#RDB ;eliminate region BCC 2$ ; if no error CLR R0 ; if error, MOVB @#ERRBYT,R0 ; load the error BR 9$ ; code and quit 2$: CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL IVINIT, initialize the array 03-Jan-85/14-Mar-85. ;This routine must be called first. It calls a routine to test and ;save the incoming arguments. It calls a routine to create a region ;for the array. It calls a routine to initialize the virtual array. ;Any of the called routines may set the error flag and load an error ;code into R0 if an error condition is detected. If no error condition ;prevails this routine returns with the no-error condition loaded in R0. ; ;Called by: Host program. ; ;Requirements: Four arguments. ; ;Uses: R0. ; ;Calls: CRRGN, INIRGN, and TSARGS. ; ;Returns: Error-noerror value. IVINIT:: CALL TSARGS ;test and save the arguments TST ERRFLG ;error condition? BNE 9$ ; yes CALL CRRGN ;create a region TST ERRFLG ;error condition? BNE 9$ ; yes CALL INIRGN ;initialize the region TST ERRFLG ;error condition? BNE 9$ ; yes CLR R0 ;for normal return 9$: RETURN .PAGE .SBTTL ************************** .SBTTL * Supporting Subroutines * .SBTTL ************************** ;All supporting subroutines are called via "CALL subnam" (JSR PC, ;subnam). Detail prequisite requirements, register usage, calls, ;and returns are listed with each of the routines. When not used ;for scratch purposes register use is as follows: ; ; R0 Array Element Pointer ; R1 Buffer Element Pointer ; R2 Element Counter ; R3 Top of Window Pointer .SBTTL CALCSA 16-Jan-85/30-Jan-85. ;This subroutine calculates and saves the offset into the virtual ;array region of the first cell of the row or column in bytes. The ;calculation is done according to the algorithm described above. ; ;Called by: SETUP. ; ;Requirements: ICOL, IROW, NCOL, and NSIZ must have been loaded with ; valid non-zero values via prior calls to TSARGS and either ; TSTCOL or TSTROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: None. ; ;Returns: SACELL and SACELL+2. CALCSA:: MOV IROW ,R0 ;IROW DEC R0 ;IROW-1 MUL NSIZ ,R0 ;(IROW-1)*NSIZ MOV R1 ,R0 MUL NCOL ,R0 ;(IROW-1)*NSIZ*NCOL MOV ICOL ,R2 ;ICOL DEC R2 ;ICOL-1 MUL NSIZ ,R2 ;(ICOL-1)*NSIZ ADD R3 ,R1 ADC R0 ADD R2 ,R0 ;((IROW-1)*NCOL - (ICOL-1)) * NSIZ MOV R0 ,SACELL ;save the byte value of the MOV R1 ,SACELL+2 ; offset into the region RETURN .PAGE .SBTTL CAWNOF 16-Jan-85/27-Feb-85. ;This subroutine calculates and saves the window number. It also ;calculates the offset in bytes into the window. The calculation is ;performed according to the algorithm described above. ; ;Called by: SETUP. ; ;Requirements: SACELL and SACELL+2 must have been loaded via a prior ; call to CALSA. ; ;Uses: R0, R1, and R2. ; ;Calls: None. ; ;Returns: WDNUM and WDOFF. CAWNOF:: MOV SACELL ,R0 ;get the offset MOV SACELL+2,R1 ; into the region MOV WDB+W.NSIZ,R2 ;compute the standard ASH #6 ,R2 ; window size DIV R2 ,R0 ;WDNUM -> R0, WDOFF -> R1 MOV R0 ,WDNUM ;save the window number MOV R1 ,WDOFF ;save the window offset RETURN .PAGE .SBTTL CLNUP 17-Jan-85/14-Mar-85. ;This subroutine cleans things up following a row or column transfer. ;It calls a routine to unmap the window. It calls a routine to ;eliminate the window. If an error condition develops, the error code ;is loaded and the error flag is set. ; ;Called by: IGTCOL, IPTCOL, IGTROW, and IPTROW. ; ;Requirements: A window must have been created and mapped into the ; region via a prior call to SETUP. ; ;Uses: R0. ; ;Calls: ELAWND and UNMAP. ; ;Returns: ERRFLG. CLNUP:: CALL UNMAPW ;unmap the window TST ERRFLG ;error condition? BNE 9$ ; yes CALL ELAWND ;eliminate the window 9$: RETURN .PAGE .SBTTL CRAWND 16-Jan-85/14-Mar-85. ;This subroutine creates a window that may later be mapped into the ;region containing the virtual array. If an error condition develops, ;the error code is loaded and the error flag is set. ; ;Called by: INIRGN and SETUP. ; ;Requirements: Prior invocation of the .WDBBK request. ; ;Uses: R0. ; ;Calls: .CRAW. ; ;Returns: ERRFLG and WDB values. CRAWND:: .CRAW #CAREA ,#WDB ;create a window into region BCC 9$ ; if no error CLR R0 ; if error, MOVB @#ERRBYT,R0 ; load the error code, INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL CRRGN 03-Jan-85/14-Mar-85. ;This subroutine creates a region in upper memory for the requested ;array. It computes and saves the size requested for the array. It ;then creates the region. If an error condition develops, the error ;code is loaded into R0 and the error flag is set. ; ;Called by: IVINIT. ; ;Requirements: Prior invocation of the .RDBBK request. NCOL, NROW, ; and NSIZ must be loaded with valid non-zero values via a prior ; call to TSARGS. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: .CRRG. ; ;Returns: ERRBYT, RDB+R.GSIZ, and VASIZ. CRRGN:: MOV NSIZ ,R0 ;calculate the MUL NCOL ,R0 ; virtual array MOV R1 ,R0 ; size in MUL NROW ,R0 ; bytes CLR R2 ;convert the MOV #SIX ,R3 ; array size 1$: ASHC #-ONE ,R0 ; into ADC R2 ; 32-word SOB R3 ,1$ ; units TST R2 ;any remainder? BEQ 2$ ; no INC R1 ; yes, so allow for it 2$: MOV R1 ,VASIZ ;VASIZ = NSIZ*NCOL*NROW/64. MOV R1 ,RDB+R.GSIZ ;save region size .CRRG #CAREA ,#RDB ;create region BCC 9$ ; if no error MOV @#ERRBYT,R0 ; if error, get the error code INC ERRFLG ; and set the error flag CMP #SEVEN ,R0 ; if error is lack of memory BNE 9$ ; change the MOV #-FOUR ,R0 ; error code 9$: RETURN .PAGE .SBTTL ELAWND 16-Jan-85/14-Mar-85. ;This subroutine eliminates the window that was used to map into the ;region containing the virtual array. If an error condition develops, ;the error code is loaded into R0 and the error flag is set. ; ;Called by: INIRGN and CLNUP. ; ;Requirements: The window must have been created and mapped, and then ; unmapped via a prior call to UNMAPW. ; ;Uses: R0. ; ;Calls: .ELAW. ; ;Returns: ERRFLG. ELAWND:: .ELAW #CAREA ,#WDB ;eliminate the window BCC 9$ ; if no error CLR R0 ; if error, MOVB @#ERRBYT,R0 ; load the error code, INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL GCBYTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of byte values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETCOL. ; ;Requirements: WDB values must be loaded. Callable only by GETCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of byte values to the host program's buffer and ; ERRFLG. GCBYTS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOVB (R0) ,(R1)+ ;transfer an element ADD COLINC ,R0 ; bumping the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GCCMPS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of complex values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETCOL. ; ;Requirements: WDB values must be loaded. Callable only by GETCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of complex values to the host program's buffer ; and ERRFLG. GCCMPS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0) ,(R1)+ ;transfer an MOV 2(R0) ,(R1)+ ; element MOV 4(R0) ,(R1)+ ; bumping MOV 6(R0) ,(R1)+ ; the ADD COLINC ,R0 ; pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GCINTS 21-Jan-85/27-Feb-85. ;This subroutine transfers a column of integer values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETCOL. ; ;Requirements: WDB values must be loaded. Callable only by GETCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of integer values to the host program's buffer ; and ERRFLG. GCINTS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0) ,(R1)+ ;transfer an element ADD COLINC ,R0 ; bumping the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GCRELS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of real values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETCOL. ; ;Requirements: WDB values must be loaded. Callable only by GETCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of real values to the host program's buffer and ; ERRFLG. GCRELS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0) ,(R1)+ ;transfer an MOV 2(R0) ,(R1)+ ; element bumping ADD COLINC ,R0 ; the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GETCOL 21-Jan-85/31-Jan-85. ;This subroutine tests for the type of data transfer to make and then ;calls a routine to make the proper transfer of column values into the ;calling program's buffer area. If an error condition develops, the ;error code is loaded into R0 and the error flag is set. ; ;Called by: IGTCOL. ; ;Requirements: NSIZ and other values must be loaded via prior calls to ; SETUP and TSTCOL. Callable only by IGTCOL. ; ;Uses: R0. ; ;Calls: GCBYTS, GCCMPS, GCINTS, and GCRELS. ; ;Returns: ERRFLG. GETCOL:: CMP #ONE ,NSIZ ;transfer byte values? BNE 1$ ; no CALL GCBYTS ; yes BR 9$ 1$: CMP #TWO ,NSIZ ;transfer integer values? BNE 2$ ; no CALL GCINTS ; yes BR 9$ 2$: CMP #FOUR ,NSIZ ;transfer real values? BNE 3$ ; no CALL GCRELS ; yes BR 9$ 3$: CMP #EIGHT ,NSIZ ;transfer complex values? BNE 4$ ; no CALL GCCMPS ; yes BR 9$ 4$: MOV #-THREE ,R0 ;load the error code INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL GETROW 21-Jan-85/31-Jan-85. ;This subroutine tests for the type of data transfer to make and then ;calls a routine to make the proper transfer of row values into the ;calling program's buffer area. If an error condition develops, the ;error code is loaded into R0 and the error flag is set. ; ;Called by: IGTROW. ; ;Requirements: NSIZ and other values must be loaded via prior calls to ; SETUP and TSTROW. Callable only by IGTROW. ; ;Uses: R0. ; ;Calls: GRBYTS, GRCMPS, GRINTS, and GRRELS. ; ;Returns: ERRFLG. GETROW:: CMP #ONE ,NSIZ ;transfer byte values? BNE 1$ ; no CALL GRBYTS ; yes BR 9$ 1$: CMP #TWO ,NSIZ ;transfer integer values? BNE 2$ ; no CALL GRINTS ; yes BR 9$ 2$: CMP #FOUR ,NSIZ ;transfer real values? BNE 3$ ; no CALL GRRELS ; yes BR 9$ 3$: CMP #EIGHT ,NSIZ ;transfer complex values? BNE 4$ ; no CALL GRCMPS ; yes BR 9$ 4$: MOV #-THREE ,R0 ;load the error code INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL GRBYTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of byte values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETROW. ; ;Requirements: WDB values must be loaded. Callable only by GETROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of byte values to the host program's buffer and ; ERRFLG. GRBYTS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOVB (R0)+ ,(R1)+ ;transfer an element CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GRCMPS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of complex values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETROW. ; ;Requirements: WDB values must be loaded. Callable only by GETROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of complex values to the host program's buffer and ; ERRFLG. GRCMPS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0)+ ,(R1)+ ;transfer MOV (R0)+ ,(R1)+ ; an MOV (R0)+ ,(R1)+ ; element MOV (R0)+ ,(R1)+ ; CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GRINTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of integer values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETROW. ; ;Requirements: WDB values must be loaded. Callable only by GETROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of integer values to the host program's buffer and ; ERRFLG. GRINTS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0)+ ,(R1)+ ;transfer an element CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL GRRELS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of real values from the virtual ;array to the calling program's buffer area. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: GETROW. ; ;Requirements: WDB values must be loaded. Callable only by GETROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of real values to the host program's buffer and ; ERRFLG. GRRELS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R0)+ ,(R1)+ ;transfer MOV (R0)+ ,(R1)+ ; an element CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2, 1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL INIRGN 11-Jan-85/05-Jun-85. ;This subroutine initializes the region to contain all null (zero) ;values. It calls a routine that creates a window into the region. ;It sets up the mapping pointers and calls a routine to map the window ;to the region, recalling the mapping routine to move the map as ;required to null the region. It calls a routine to unmap the window. ;It calls a routine that eliminates the window. ; ;Called by: IVINIT. ; ;Requirements: Prior call to TSARGS to load parameters, and prior ; call to CRRGN to create a region. Callable only by IVINIT. ; ;Uses: R0, R2, and R3. ; ;Calls: CRAWND, ELAWND, MAPWND, and UNMAPW. ; ;Returns: An initialized virtual array and ERRFLG. INIRGN:: CALL CRAWND ;create a window TST ERRFLG ;error condition? BNE 9$ ; yes MOV RDB+R.GID,WDB+W.NRID ;identify region to window CLR WDB+W.NOFF ;start at bottom of region CALL MAPWND ;map the window TST ERRFLG ;error condition? BNE 9$ ; yes 1$: MOV WDB+W.NBAS,R0 ;get start address of window MOV WDB+W.NSIZ,R2 ;size in 64-byte units ASH #FIVE ,R2 ;make it in words MOV WDB+W.NLEN,R3 ;point to ASH #SIX ,R3 ; the top of ADD WDB+W.NBAS,R3 ; the window 2$: CLR (R0)+ ;null the word, bump the pointer CMP R0 ,R3 ;at or past top of the window? BGE 3$ ; yes SOB R2 ,2$ ; no, so loop back until done ADD WDB+W.NSIZ,WDB+W.NOFF ;move the window up CMP RDB+R.GSIZ,WDB+W.NOFF ;all done? BLOS 3$ ; yes CALL MAPWND ;remap the window TST ERRFLG ;error condition? BNE 9$ ; yes BR 1$ ; no, so continue 3$: CALL UNMAPW ;unmap the window TST ERRFLG ;error condition? BNE 9$ ; yes CALL ELAWND ;eliminate the window 9$: RETURN .PAGE .SBTTL MAPWND 16-Jan-85/14-Mar-85. ;This subroutine maps or remaps a window into the region that contains ;the virtual array. If an error condition develops, the error code is ;loaded and the error flag is set. ; ;Called by: INIRGN and SETUP. ; ;Requirements: Prior call to CRWNDW. ; ;Uses: R0. ; ;Calls: .MAP. ; ;Returns: ERRFLG. MAPWND:: CLR WDB+W.NLEN ;map maximum length .MAP #CAREA ,#WDB ;map to the region BCC 1$ ; if no error CLR R0 ; if error, MOVB @#ERRBYT,R0 ; load the error code, INC ERRFLG ; set the error flag BR 9$ 1$: MOV WDB+W.NLEN,R0 ;convert the window ASH #SIX ,R0 ; size to bytes MOV R0 ,WDLEN ; and save it 9$: RETURN .PAGE .SBTTL PCBYTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of byte values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTCOL. ; ;Requirements: WDB values must be loaded. Callable only by PUTCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of byte values to the virtual array and ERRFLG. PCBYTS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOVB (R1)+ ,(R0) ;transfer an element ADD COLINC ,R0 ; bumping the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PCCMPS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of complex values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTCOL. ; ;Requirements: WDB values must be loaded. Callable only by PUTCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of complex values to the virtual array and ERRFLG. PCCMPS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0) ;transfer an MOV (R1)+ ,2(R0) ; element MOV (R1)+ ,4(R0) ; bumping MOV (R1)+ ,6(R0) ; the ADD COLINC ,R0 ; pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PCINTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of integer values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTCOL. ; ;Requirements: WDB values must be loaded. Callable only by PUTCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of integer values to the virtual array and ERRFLG. PCINTS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0) ;transfer an element ADD COLINC ,R0 ; bumping the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PCRELS 21-Jan-85/06-Feb-85. ;This subroutine transfers a column of real values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTCOL. ; ;Requirements: WDB values must be loaded. Callable only by PUTCOL. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A column of real values to the virtual array and ERRFLG. PCRELS:: MOV NROW ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0) ;transfer an MOV (R1)+ ,2(R0) ; element bumping ADD COLINC ,R0 ; the pointers CMP R0 ,R3 ;at or past top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PRBYTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of byte values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTROW. ; ;Requirements: WDB values must be loaded. Callable only by PUTROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of byte values to the virtual array and ERRFLG. PRBYTS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOVB (R1)+ ,(R0)+ ;transfer an element CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PRCMPS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of complex values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTROW. ; ;Requirements: WDB values must be loaded. Callable only by PUTROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of complex values to the virtual array and ERRFLG. PRCMPS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0)+ ;transfer MOV (R1)+ ,(R0)+ ; an MOV (R1)+ ,(R0)+ ; element MOV (R1)+ ,(R0)+ ; CMP R0 ,R3 ;at or above top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PRINTS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of integer values from the calling ;program's buffer area into the virtual array. It calls a routine to ;set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the error ;flag is set. ; ;Called by: PUTROW. ; ;Requirements: WDB values must be loaded. Callable only by PUTROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of integer values to the virtual array and ERRFLG. PRINTS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0)+ ;transfer an element CMP R0 ,R3 ;past top of window? BEQ 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PRRELS 21-Jan-85/06-Feb-85. ;This subroutine transfers a row of real values from the calling ;program's buffer area into the virtual array. It calls a routine ;to set up the window and buffer pointers. The window is remapped ;as necessary with a call to the remapping routine. If an error ;condition develops, the error code is loaded into R0 and the erro ; flag is set. ; ;Called by: PUTROW. ; ;Requirements: WDB values must be loaded. Callable only by PUTROW. ; ;Uses: R0, R1, R2, and R3. ; ;Calls: REMAP and STPTRS. ; ;Returns: A row of real values to the virtual array and ERRFLG. PRRELS:: MOV NCOL ,R2 ;number of elements CALL STPTRS ;set up the pointers 1$: MOV (R1)+ ,(R0)+ ;transfer MOV (R1)+ ,(R0)+ ; an element CMP R0 ,R3 ;at top of window? BPL 2$ ; yes SOB R2 ,1$ ; no, so loop back until done BR 9$ 2$: DEC R2 ;all done? BEQ 9$ ; yes CALL REMAP ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes TST DUNFLG ;all done? BEQ 1$ ; no, so continue 9$: RETURN .PAGE .SBTTL PUTCOL 21-Jan-85/31-Jan-85. ;This subroutine tests for the type of data to transfer and then calls ;a routine to make the proper transfer from the calling program's ;buffer area. If an error condition develops, the error code is loaded ;into R0 and the error flag is set. ; ;Called by: IPTCOL. ; ;Requirements: NSIZ and other values must be loaded via prior calls to ; SETUP and TSTCOL. Callable only by IPTCOL. ; ;Uses: R0. ; ;Calls: PCBYTS, PCCMPS, PCINTS, and PCRELS. ; ;Returns: ERRFLG. PUTCOL:: CMP #ONE ,NSIZ ;transfer byte values? BNE 1$ ; no CALL PCBYTS ; yes BR 9$ 1$: CMP #TWO ,NSIZ ;transfer integer values? BNE 2$ ; no CALL PCINTS ; yes BR 9$ 2$: CMP #FOUR ,NSIZ ;transfer real values? BNE 3$ ; no CALL PCRELS ; yes BR 9$ 3$: CMP #EIGHT ,NSIZ ;transfer complex values? BNE 4$ ; no CALL PCCMPS ; yes BR 9$ 4$: MOV #-THREE ,R0 ;load the error code INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL PUTROW 21-Jan-85/31-Jan-85. ;This subroutine tests for the type of data to transfer and then calls ;a routine to make the proper transfer from the calling program's ;buffer area. If an error condition develops, the error code is loaded ;into R0 and the error flag is set. ; ;Called by: IPTROW. ; ;Requirements: NSIZ and other values must be loaded via prior calls to ; SETUP and TSTROW. Callable only by IPTROW. ; ;Uses: R0. ; ;Calls: PRBYTS, PRCMPS, PRINTS, and PRRELS. ; ;Returns: ERRFLG. PUTROW:: CMP #ONE ,NSIZ ;transfer byte values? BNE 1$ ; no CALL PRBYTS ; yes BR 9$ 1$: CMP #TWO ,NSIZ ;transfer integer values? BNE 2$ ; no CALL PRINTS ; yes BR 9$ 2$: CMP #FOUR ,NSIZ ;transfer real values? BNE 3$ ; no CALL PRRELS ; yes BR 9$ 3$: CMP #EIGHT ,NSIZ ;transfer complex values? BNE 4$ ; no CALL PRCMPS ; yes BR 9$ 4$: MOV #-THREE ,R0 ;load the error code INC ERRFLG ; and set the error flag 9$: RETURN .PAGE .SBTTL REMAP 05-Feb-85/05-Jun-85. ;This subroutine sets up for and calls the window mapping routine ;to remap the window. It resets the window element and window top ;pointers. If an error condition is detected the routine aborts. ;Also, if the data transfer has completed the done flag is set. ; ;Called by: GCBYTS, GCCMPS, GCINTS, GCRELS, GRBYTS, GRCMPS, GRINTS, ; GRRELS, PCBYTS, PCCMPS, PCINTS, PCRELS, PRBYTS, PRCMPS, ; PRINTS, and PRRELS. ; ;Requirements: Prior mapping of the window via a call to MAPWND. ; ;Uses: R0 and R3. ; ;Calls: MAPWND ; ;Returns: The remapped window, DUNFLG, and ERRFLG. REMAP:: SUB WDLEN ,R0 ;save SUB WDB+W.NBAS,R0 ; the offset MOV R0 ,WDOFF ; for later ADD WDB+W.NSIZ,WDB+W.NOFF ;move the window up CMP RDB+R.GSIZ,WDB+W.NOFF ;all done? BLOS 1$ ; yes CALL MAPWND ; no, so remap the window TST ERRFLG ;error condition? BNE 9$ ; yes MOV WDB+W.NBAS,R0 ; no, so ADD WDOFF ,R0 ; reset MOV WDB+W.NLEN,R3 ; the ASH #SIX ,R3 ; window ADD WDB+W.NBAS,R3 ; pointers BR 9$ 1$: INC DUNFLG ;set the done flag 9$: RETURN .PAGE .SBTTL SETUP 17-Jan-85/05-Jun-85. ;This subroutine sets up for a row or column transfer. It calls a ;routine to create a window into the region. It calls a routine to ;calculate the offset into the virtual array of the first cell of the ;row or column. It calls a routine that calculates the window number ;and the offset into the window in bytes. It sets up for and calls a ;routine to map the window into the region. If an error condition is ;found the error code is loaded into R0 and the error flag is set. ; ;Called by: IGTCOL, IGTROW, IPTCOL, and IPTROW. ; ;Requirements: Prior call to TSTCOL or TSTROW. ; ;Uses: R0 and R1. ; ;Calls: CALCSA, CAWNOF, CRAWND, and MAPWND. ; ;Returns: A mapped window and ERRFLG. SETUP:: CLR DUNFLG ;for starters CALL CRAWND ;create a window TST ERRFLG ;error condition? BNE 9$ ; yes CALL CALCSA ;calculate the offset into the ; region CALL CAWNOF ;calculate the window number and ; offset into the window MOV RDB+R.GID,WDB+W.NRID ;identify region to window MOV WDNUM ,R0 ;calculate and load the MUL #WDSIZ ,R0 ; window offset into MOV R1 ,WDB+W.NOFF ; the region CALL MAPWND ;map the window 9$: RETURN .PAGE .SBTTL STPTRS 05-Feb-85/06-Feb-85. ;This subroutine sets up the buffer and window pointers. ; ;Called by: GCBYTS, GCCMPS, GCINTS, GCRELS, GRBYTS, GRCMPS, GRINTS, ; GRRELS, PCBYTS, PCCMPS, PCINTS, PCRELS, PRBYTS, PRCMPS, ; PRINTS, and PRRELS. ; ;Requirements: Prior initial mapping of the window. ; ;Uses: R0, R1, and R3. ; ;Calls: None. ; ;Returns: Window pointers in R0 (element) and R3 (top), and buffer ; pointer in R1. STPTRS:: MOV WDB+W.NBAS,R0 ;point to the ADD WDOFF ,R0 ; first element MOV BUFF ,R1 ;point to the buffer MOV WDB+W.NLEN,R3 ;point to ASH #SIX ,R3 ; the top ADD WDB+W.NBAS,R3 ; of the window RETURN .PAGE .SBTTL TSARGS 03-Jan-85/14-Mar-85. ;This subroutine tests and saves the arguments for the initialization ;routine. It tests for the proper number of arguments. It tests for ;proper values for the arguments. If an error condition is found the ;error code is loaded into R0 and the error flag is set. ; ;Caller by: IVINIT. ; ;Requirements: Prior call to IVINIT. Callable Only by IVINIT. ; ;Uses: R0 and R5. ; ;Calls: None. ; ;Returns: BUFF, NCOL, NROW, NSIZ, and ERRFLG. TSARGS:: CMPB (R5) ,#FOUR ;proper number of arguments? BEQ 1$ ; yes MOV #-ONE ,R0 ; no, so set up error BR 5$ ; code and quit 1$: TST (R5)+ ;bump the argument pointer MOV @(R5)+ ,NROW ;save NROW bumping the pointer BGT 2$ ; if greater than zero MOV #-TWO ,R0 ; if zero or negative, load the BR 5$ ; error code and quit 2$: MOV @(R5)+ ,NCOL ;save NCOL bumping the pointer BGT 3$ ; if greater than zero MOV #-TWO ,R0 ; if zero or negative, load the BR 5$ ; error code and quit 3$: MOV @(R5)+ ,R0 ;save NSIZ bumping MOV R0 ,NSIZ ; the pointer CMP R0 ,#ONE ;byte elements? BEQ 4$ ; yes CMP R0 ,#TWO ;integer elements? BEQ 4$ ; yes CMP R0 ,#FOUR ;real elements? BEQ 4$ ; yes CMP R0 ,#EIGHT ;complex elements? BEQ 4$ ; yes MOV #-THREE ,R0 ; no, so load the error BR 5$ ; code and quit 4$: MOV (R5) ,BUFF ;save the buffer address BR 9$ ;all done 5$: INC ERRFLG ;set the error flag 9$: RETURN .PAGE .SBTTL TSTCOL 15-Jan-85/14-Mar-85. ;This subroutine tests and saves the argument for the IGTCOL and IPTCOL ;routines. It tests for one only argument. It tests for the argument ;to be in range. It saves the argument value. It computes the column ;increment and saves it. If an error condition develops, the error code ;is loaded and the error flag is set. ; ;Called by: IGTCOL and IPTCOL. ; ;Requirements: Prior call by IGTCOL or IPTCOL. ; ;Uses: R0, R1, and R5. ; ;Calls: None. ; ;Returns: ICOL, COLINC, and ERRFLG. TSTCOL:: CMPB (R5) ,#ONE ;one argument only? BEQ 1$ ; yes MOV #-ONE ,R0 ; no, so load the error code BR 3$ ; and quit 1$: CMP @2(R5) ,NCOL ;value in range? BLE 2$ ; yes MOV #-SIX ,R0 ; no so load the error code BR 3$ ; and quit 2$: MOV @2(R5) ,ICOL ;save the COL index value and MOV #ONE ,IROW ; set the ROW index value MOV NCOL ,R0 ;compute and MUL NSIZ ,R0 ; save the column MOV R1 ,COLINC ; increment in bytes BR 9$ 3$: INC ERRFLG ;set the error flag 9$: RETURN .PAGE .SBTTL TSTROW 15-Jan-85/14-Mar-85. ;This subroutine tests and saves the argument for the IGTROW and IPTROW ;routines. It tests for one only argument. It tests for the argument ;to be in range. It saves the argument value. If an error condition ;develops, the error code is loaded and the error flag is set. ; ;Called by: IGTROW and IPTROW. ; ;Requirements: Prior call by IGTROW or IPTROW. ; ;Uses: R0 and R5. ; ;Calls: None. ; ;Returns: IROW and ERRFLG. TSTROW:: CMPB (R5) ,#ONE ;one argument only? BEQ 1$ ; yes MOV #-ONE ,R0 ; no, so load the error code BR 3$ ; and quit 1$: CMP @2(R5) ,NROW ;value in range? BLE 2$ ; yes MOV #-SIX ,R0 ; no so load the error code BR 3$ ; and quit 2$: MOV @2(R5) ,IROW ;save the ROW index value, MOV #ONE ,ICOL ; set the COL index value, CLR COLINC ; and zero the column increment BR 9$ 3$: INC ERRFLG ;set the error flag 9$: RETURN .PAGE .SBTTL UNMAPW 16-Jan-85/14-Mar-85. ;This subroutine unmaps the window. If an error condition develops, the ;error code is loaded and the error flag is set. ; ;Called by: CLNUP and INIRGN. ; ;Requirement: A mapped mapped window via a prior call to MAPWND. ; ;Uses: R0. ; ;Calls: .UNMAP. ; ;Returns: ERRFLG. UNMAPW:: .UNMAP #CAREA ,#WDB ;unmap the window BCC 9$ ; if no error CLR R0 ; if error, MOVB @#ERRBYT,R0 ; load the error code, INC ERRFLG ; set the error flag 9$: RETURN .SBTTL Finis 03-Jan-85/. .PSECT VADATA .END