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

  1. ;
  2. ; *** Listing 10-14 ***
  3. ;
  4. ; Generates the 8-bit checksum of a 1000-byte array
  5. ; using LODS with an ES: override.
  6. ;
  7.     jmp    Skip
  8. ;
  9. FarSeg    segment    para
  10. ARRAY_LENGTH    equ    1000
  11. ByteArray    db    ARRAY_LENGTH dup (0)
  12. FarSeg    ends
  13. Skip:
  14.     call    ZTimerOn
  15.     mov    si,seg ByteArray
  16.     mov    es,si    ;point ES:SI to the array to
  17.             ; checksum
  18.     mov    si,offset ByteArray
  19.     mov    cx,ARRAY_LENGTH    ;# of bytes to checksum
  20.     sub    ah,ah    ;zero the checksum counter
  21.     cld        ;make LODS move the pointer up
  22. ChecksumLoop:
  23.     lods    byte ptr es:[si]
  24.             ;get the next byte to checksum
  25.     add    ah,al    ;add the byte into the checksum
  26.     loop    ChecksumLoop
  27.     call    ZTimerOff
  28.