home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / asmutil / zendisk2.zip / LST13-19.ASM < prev    next >
Assembly Source File  |  1990-02-15  |  897b  |  44 lines

  1. ;
  2. ; *** Listing 13-19 ***
  3. ;
  4. ; Zeros the high-bit of each byte in a 100-byte array,
  5. ; using the LOOP instruction.
  6. ;
  7.     jmp    Skip
  8. ;
  9. ARRAY_LENGTH    equ    100
  10. ByteArray    label    byte
  11.     db    ARRAY_LENGTH dup (80h)
  12. ;
  13. ; Clears the high bit of each byte in an array of
  14. ; length ARRAY_LENGTH.
  15. ;
  16. ; Input:
  17. ;    BX = pointer to the start of the array to clear
  18. ;
  19. ; Output: none
  20. ;
  21. ; Registers altered: AL, BX, CX
  22. ;
  23. ClearHighBits:
  24.     mov    cx,ARRAY_LENGTH        ;# of bytes to clear
  25.     mov    al,not 80h        ;pattern to clear
  26.                     ; high bits with
  27. ClearHighBitsLoop:
  28.     and    [bx],al            ;clear the high bit
  29.                     ; of this byte
  30.     inc    bx            ;point to the next
  31.                     ; byte
  32.     loop    ClearHighBitsLoop    ;repeat until we're
  33.                     ; out of bytes
  34.     ret
  35. ;
  36. Skip:
  37.     call    ZTimerOn
  38.     mov    bx,offset ByteArray
  39.                 ;array in which to clear
  40.                 ; high bits
  41.     call    ClearHighBits    ;clear the high bits of the
  42.                 ; bytes
  43.     call    ZTimerOff
  44.