PDP-11 32-Bit Support In 1971, the PDP-11's 16-bit address space seemed large enough for all but the most complex programming problems. Fifteen years later, the same PDP-11 16-bit address space seems barely enough for even the simplest programs. Where did all the bits go? One major consumer of address space are the new functions which make our jobs as programmers much simpler. In 1971, our Macro-11 programs issued their own direct QIO's to disk. Screen management consisted of double line feeds so the last line was visible above the LA30 print head. Today's programmer uses Fortran, Basic, Cobol, Pascal, and C. Standard packages such as RMS and FMS eliminate the hassles of index file management and screen layout. Each new software layer makes our job as application programmers easier, but each also eats away at the 16-bit address space. PDP-11's can also physically handle more data than the 1971 model. A large disk in 1971 was the RK05 which held 2.4 million bytes. An RK05 is 1/4 the size of today's smallest Winchester disk. The J-11 processors are orders of magnitude faster and can handle 64 times the physical memory than the the original PDP-11/20 model. Problems impractical fifteen years ago are now easily within the capacity of the hardware. Only the 16-bit virtual address space has remained constant. Fortunately, RSX provides many techniques to make the 16-bits stretch well beyond the original design. These techniques were covered in the previous two columns. The June 1986 column looked at task builder features which let user code and software packages share the same virtual address space. Last month's column covered the Program Logical Address Space (PLAS) Directives. These RSX executive directives give a program complete control of its virtual address space. This article completes the three-part series by looking at subroutine package which manages a region using 32-bit addresses and how the package has been used for two different applications. The PLAS32 package consists of a set of Fortran callable subroutines which create a dynamic region and move a window within the region. The package uses INTERGER*4 variables to hold addresses within the region. The first byte in the region is address 0. The size of region and thus maximum address is set when the region is created. The region may be directly addressed or used as a dynamically allocated pool. Fortran routines can gain direct access to data in the region by using a named common area and the task builder VSECT option. For example, a 8KW common area window is declared using the following statement: COMMON /VIEW/DATA(8192) INTEGER*2 DATA The common area VIEW can now be mapped to virtual addresses 140000 to 177777 by using the VSECT=VIEW:140000:40000 statement when building the task. The region size, window, and window size are then passed to the PLAS32 package when the dynamic region is initialized. Note the region size is in 32 word units so the following statement creates a 64KW region which will accessed through the previous common. status = INITDR(2048,DATA,8192*2) INITDR can be called as either a subroutine or function. As a function, INITDR returns a value of 1 for success and a negative directive status code for failure. The features of the PLAS32 package are best shown by two examples. The first application is a control system which uses several different types of dynamic data records. The following code segment shows how one type of new record was created and added to the front of a list. INTEGER*4 NEXT INTEGER*2 RECORD(100) EQUIVALENCE (NEXT,DATA(1)),(RECORD(1),DATA(3)) INTEGER*4 ADDR,HEAD CALL ALOCDR(ADDR,204) CALL MAPDR(ADDR,204) NEXT = HEAD HEAD = ADDR The ALOCDR subroutine allocates a 204 byte section of the region and returns its 32-bit address to ADDR. The MAPDR subroutine positions the mapping window such that the first element of DATA address the first word in the allocated segment. By using the EQUIVALENCE statement to map different variables to the common area VIEW, we now have direct access to the desired record. Note the PLAS directives can move windows within only a 32 word granularty. The addresses returned by ALOCDR will always fall on a 32 word boundary. MAPDR will also round the supplied address down to a 32 word boundary. The other technique to use PLAS32 is to directly address the dynamic region directly. An example of this technique is a sort. In this case, the sort package operates on elements which are 15 words long. The sort element INDEX is accessed by the following code segment: COMMON /VIEW/DATA(8192) INTEGER DATA INTEGER*4 ADDR INTEGER*2 I,INDEX PARAMETER (ISIZE = 15*2) ADDR = INDEX * ISIZE I = IDXDR(ADDR,ISIZE) DATA(I+0) = ... DATA(I+1) = ... The IDXDR function returns the Fortran INTEGER*2 array index to the start of the specified 32-bit address. The window is only remapped if the specified address is outside the current window. The mechanism can be somewhat faster than the MAPDR call which always forces a mapping call. There are several possible extensions to the PLAS32 package which are not shown in order to present a simple, clean package. PLAS32 could be modified to use multiple windows so separate sets of data can view at once. Similarly, multiple regions could be supported. A different initialization routine could access an existing region. This would allow one task pass a region to another task using the send-by-refernece directives. Finally, the fast mapping feature of RSX-11M-PLUS V3.0 would greatly increase execution speed.