Newsgroups: comp.lang.asm370
Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!zaphod.mps.ohio-state.edu!sdd.hp.com!news.cs.indiana.edu!ux1.cso.uiuc.edu!phil
From: phil@ux1.cso.uiuc.edu (Phil Howard KA9WGN)
Subject: Re: memo on my structure assembler macros
Message-ID: <1991Apr18.185203.26190@ux1.cso.uiuc.edu>
Organization: University of Illinois at Urbana
References: <1991Apr12.053317.2473@ux1.cso.uiuc.edu> <4532@gmdzi.gmd.de>
Date: Thu, 18 Apr 1991 18:52:03 GMT
Lines: 116

icking@gmdzi.gmd.de (Werner Icking) writes:

[text deleted]

You have taken a simple example:

>R0        EQU   0
>HWORD     DS    H
>          LH    R0,HWORD
>          $IF   ZERO
>          LTR   R0,R0
>          $THEN

And coded it using another method:

>R0       #EQUR  0
>HWORD    DS     H
>         IF     HWORD,EQ,0,THEN

Try THIS one, which is slightly more difficult:

           $IF   NOT-EQUAL           if does not begin with                     
             CLI   0(R2),X'40'         a blank                                  
           $AND  NOT-EQUAL           nor                                        
             CLI   0(R2),X'05'         a tab                                    
           $AND  POS                 and                                        
             MVI   PROCESS,0           (header start so clear flag)             
             BAL   R14,TESTHDR         this is a header we process              
           $THEN ,                   then                                       
             MVI   PROCESS,1           process this header                      
           $END  ,                                                              

Then this one which is more difficult yet:

           $IF   ON                  if                                         
             TM    PROCESS,1           this header is being processed           
           $AND  HIGH                and                                        
             STM   R2,R3,ORIGREC       save original address and length         
             BAL   R14,FIXIT           processing causes                        
             CL    R3,=F'80'           an overflow                              
           $AND  HIGH                and                                        
             BAL   R14,SQUEEZE         squeezing will not fix                   
             CL    R3,=F'80'           the overflow                             
           $THEN ,                   then                                       
             LM    R2,R3,ORIGREC       restore original                         
           $END  ,                                                              

And then this one which is starting to really get hard:

         $IF   POS                 if (the following test is positive)          
                                                                 SPACE          
           $IF   ZERO                if                                         
             TM    8(R5),B'10000000'   upper-right value is positive            
           $THEN ,                   then                                       
             LCDR  FPR2,FPR4           test lower-left for negative             
           $ELSE ,                   else                                       
             LTDR  FPR2,FPR4           test lower-left for positive             
           $END  ,                                                              
                                                                 SPACE          
         $OR   POS                 or (the following test is positive)          
                                                                 SPACE          
           $IF   ZERO                if                                         
             TM    0(R5),B'10000000'   upper-left value is positive             
           $THEN ,                   then                                       
             LCDR  FPR2,FPR0           test lower-right for negative            
           $ELSE ,                   else                                       
             LTDR  FPR2,FPR0           test lower-right for positive            
           $END  ,                                                              
                                                                 SPACE          
         $THEN ,                   then                                         
           EX    *-*,PLOTOI(R7)      OI 0(R6),B'one bit'                        
         $END  ,                                                                

And finally this one which also looks rather hard:

         $IF   EQUAL               if                                           
           CLI   0(R10),X'FF'        there are no arguments                     
         $OR   NOT-CC0             or                                           
           $IF   EQUAL               ( if                             )         
             CLI   8(R10),X'FF'      (   there was just one argument  )         
           $OR   ZERO                ( or                             )         
             LM    R2,R3,8(R10)      (   (get position argument)      )         
             LTR   R2,R2             (   the pos argument was omitted )         
           $OR   NOT-CC0             ( or                             )         
             DECINT ,                (   >>> the number cannot convert)         
           $THEN ,                   ( then                           )         
             LA    R1,1              (   assume position to be 1      )         
           $END  ,                   ( endif                          )         
           LM    R2,R3,0(R10)        ( get address, length of list    )         
           BAL   R14,FINDELEM        >>> the element cannot be found            
         $THEN ,                   then                                         
           SLR   R3,R3               use a null element                         
         $END  ,                   endif                                        

>We started this type of programming in the late 60-th -- and stopped it
>some years ago. If anybody is interested I will look for a description
>and the corresponding macro-library.

I'd like to see the description.  I'd suggest posting it.

What is the difference between these methods?  Well obviously a lot of
detail difference.  I don't know for sure what Werner's method really is,
but it looks syntactically like one I read about in an assembler text.
Unfortunately the one in that text had limitations that restricted the
scope of what kinds of conditions could be tested, and had an even more
primitive looping macro setup that required things be expressed in terms
of BXH/BXLE conditions only.  I did not include any loops in the examples
above, but I can include them.  BTW, the "DECINT" in example 4 above is a
macro that calls a subroutine that is generated elsewhere by the same macro,
OR generates inline code in place, depending on the setting of a global
variable by one of yet other macros (INLINE, INTORG, EXTABS, etc.).
-- 
 /***************************************************************************\
/ Phil Howard -- KA9WGN -- phil@ux1.cso.uiuc.edu   |  Guns don't aim guns at  \
\ Lietuva laisva -- Brivu Latviju -- Eesti vabaks  |  people; CRIMINALS do!!  /
 \***************************************************************************/
