Task

Start an integer value at   1024.

Loop while it is greater than zero.

Print the value (with a newline) and divide it by two each time through the loop.



Related tasks

   Loop over multiple arrays simultaneously
   Loops/Break
   Loops/Continue
   Loops/Do-while
   Loops/Downward for
   Loops/For
   Loops/For with a specified step
   Loops/Foreachbas
   Loops/Increment loop index within loop body
   Loops/Infinite
   Loops/N plus one half
   Loops/Nested
   Loops/While
   Loops/with multiple ranges
   Loops/Wrong ranges


*        While                     27/06/2016
WHILELOO CSECT                     program's control section 
         USING WHILELOO,12         set base register
         LR    12,15               load base register
         LA    6,1024              v=1024
LOOP     LTR   6,6                 while v>0 
         BNP   ENDLOOP             .
         CVD   6,PACKED              convert v to packed decimal
         OI    PACKED+7,X'0F'        prepare unpack
         UNPK  WTOTXT,PACKED         packed decimal to zoned printable
         WTO   MF=(E,WTOMSG)         display v
         SRA   6,1                   v=v/2   by right shift 
         B     LOOP                end while
ENDLOOP  BR    14                  return to caller
PACKED   DS    PL8                 packed decimal
WTOMSG   DS    0F                  full word alignment for wto
WTOLEN   DC    AL2(8),H'0'         length of wto buffer (4+1)
WTOTXT   DC    CL4' '              wto text
         END   WHILELOO