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

  1. ;
  2. ; *** Listing 13-24 ***
  3. ;
  4. ; Zeros the high-bit of each byte in a 100-byte array,
  5. ; using partial in-line code.
  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.
  14. ;
  15. ; Input:
  16. ;    BX = pointer to the start of the array to clear
  17. ;    CX = number of bytes to clear (must be a multiple
  18. ;        of 4)
  19. ;
  20. ; Output: none
  21. ;
  22. ; Registers altered: AL, BX, CX
  23. ;
  24. ClearHighBits:
  25.     mov    al,not 80h        ;pattern to clear
  26.                     ; high bits with
  27.     shr    cx,1            ;# of passes through
  28.     shr    cx,1            ; partial in-line
  29.                     ; loop, which does
  30.                     ; 4 bytes at a pop
  31. ClearHighBitsLoop:
  32.     rept    4            ;we'll put 4 bit-
  33.                     ; clears back to
  34.                     ; back, then loop
  35.     and    [bx],al            ;clear the high bit
  36.                     ; of this byte
  37.     inc    bx            ;point to the next
  38.                     ; byte
  39.     endm
  40.     loop    ClearHighBitsLoop
  41.     ret
  42. ;
  43. Skip:
  44.     call    ZTimerOn
  45.     mov    bx,offset ByteArray
  46.                 ;array in which to clear
  47.                 ; high bits
  48.     mov    cx,ARRAY_LENGTH    ;# of bytes to clear
  49.                 ; (always a multiple of 4)
  50.     call    ClearHighBits    ;clear the high bits of the
  51.                 ; bytes
  52.     call    ZTimerOff
  53.