I recently started looking at the 'end' specification for the USING statement, 
something I've neglected for a long time.  I *thought* it indicated the last 
location that could be assembled with that USING, but I'm not so sure any more. 
 I have the following source file:

dummy    csect ,                   
         using (dummy,dummy+6000),1
         ceject 0                  
         lg    1,far1              
         lg    1,far2              
         lg    1,far3              
         lg    1,far4              
                                   
         org   dummy+4000          
far1     dc    ad(1)               
         org   dummy+5000          
far2     dc    ad(2)               
         org   dummy+6000          
far3     dc    ad(3)               
         org   dummy+7000          
far4     dc    ad(4)               
         end   ,                   

The relevant portion of the listing looks like this:

  Loc    Object Code      Addr1    Addr2    Stmt  Source Statement              
    
00000000                00000000 00001B60      1 dummy    csect ,               
    
                    R:1 00000000               2          using 
(dummy,dummy+6000),1
                                                                                
    
  Active Usings: dummy(X'1770'),R1                                              
    
  Loc    Object Code      Addr1    Addr2    Stmt  Source Statement              
    
00000000 E310 1FA0 0004          00000FA0      4          lg    1,far1          
    
00000006 E310 1388 0104          00001388      5          lg    1,far2          
    
0000000C E310 1770 0104          00001770      6          lg    1,far3          
    
00000012 E310 1B58 0104          00001B58      7          lg    1,far4          
    
00000018                00000018 00000FA0      9          org   dummy+4000      
    
00000FA0 0000000000000001                     10 far1     dc    ad(1)           
    
00000FA8                00000FA8 00001388     11          org   dummy+5000      
    
00001388 0000000000000002                     12 far2     dc    ad(2)           
    
00001390                00001390 00001770     13          org   dummy+6000      
    
00001770 0000000000000003                     14 far3     dc    ad(3)           
    
00001778                00001778 00001B58     15          org   dummy+7000      
    
00001B58 0000000000000004                     16 far4     dc    ad(4)           
    
                                              17          end   ,               
    

The last sentence of the description of the 'end' specification for an ordinary 
USING says, "Thus USING base,reg is equivalent to USING (base,base+4096),reg."  
So, my thinking was as follows:

- Since a "default" USING can only be used up to base+4095 (because the maximum 
4K displacement is x'FFF'), I assume this means that the 'base+4096' points to 
the byte *past* the last valid USING location.

- If the previous item is true then the "Active Usings" line that shows a range 
of x'1770' bytes for 'dummy' would mean that the last valid address that can 
use R1 as a base is dummy+5999.

- If the previous item is true then the LG of FAR3 at location x'C' should not 
successfully assemble because FAR3 is at DUMMY+6000.

- Even if there is a confusion between "1 byte prior to the specified end" vs. 
"the specified end", the LG for FAR4 at location x'12' should certainly fail.

Since the LG of FAR4 didn't fail, my understanding of the function of the 'end' 
specification must be a misunderstanding.  Can anyone offer any clarity?  
Thanks.

- mb

Reply via email to