home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / assemblr / library / zenlib / lst8_17.asm < prev    next >
Assembly Source File  |  1990-02-15  |  667b  |  26 lines

  1. ;
  2. ; *** Listing 8-17 ***
  3. ;
  4. ; Adds AL to each element in an array until the result
  5. ; of an addition exceeds 7Fh.
  6. ; Uses one jump in the loop, with a predecrement before
  7. ; the loop, an INC before the ADD in the loop, and a final
  8. ; INC to adjust BX for the last addition.
  9. ;
  10.     jmp    Skip
  11. ;
  12. Data    db    999 dup (0),7fh
  13. ;
  14. Skip:
  15.     mov    bx,offset Data
  16.     mov    al,2    ;we'll add 2 to each array element
  17.     call    ZTimerOn
  18.     dec    bx    ;compensate for the initial INC
  19. AddLoop:
  20.     inc    bx    ;point to the next array element
  21.     add    [bx],al    ;add the value to this element
  22.     jns    AddLoop    ;do the next element, if any
  23. EndAddLoop:
  24.     inc    bx    ;adjust BX for the final addition
  25.     call    ZTimerOff
  26.