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

  1. ;
  2. ; *** Listing 13-3 ***
  3. ;
  4. ; Tests whether several characters are in the set
  5. ; {A,Z,3,!} by using the compare-and-jump approach,
  6. ; branching each time a match isn't found.
  7. ;
  8.     jmp    Skip
  9. ;
  10. ; Determines whether a given character is in the set
  11. ; {A,Z,3,!}.
  12. ;
  13. ; Input:
  14. ;    AL = character to check for inclusion in the set
  15. ;
  16. ; Output:
  17. ;    Z if character is in TestSet, NZ otherwise
  18. ;
  19. ; Registers altered: none
  20. ;
  21. CheckTestSetInclusion:
  22.     cmp    al,'A'    ;is it 'A'?
  23.     jnz    CheckTestSetZ
  24.     ret        ;yes, we're done
  25. CheckTestSetZ:
  26.     cmp    al,'Z'    ;is it 'Z'?
  27.     jnz    CheckTestSet3
  28.     ret        ;yes, we're done
  29. CheckTestSet3:
  30.     cmp    al,'3'    ;is it '3'?
  31.     jnz    CheckTestSetEx
  32.     ret        ;yes, we're done
  33. CheckTestSetEx:
  34.     cmp    al,'!'    ;is it '!'?
  35.     ret        ;the success status is already in
  36.             ; the Zero flag
  37. ;
  38. Skip:
  39.     call    ZTimerOn
  40.     mov    al,'A'
  41.     call    CheckTestSetInclusion    ;check 'A'
  42.     mov    al,'Z'
  43.     call    CheckTestSetInclusion    ;check 'Z'
  44.     mov    al,'3'
  45.     call    CheckTestSetInclusion    ;check '3'
  46.     mov    al,'!'
  47.     call    CheckTestSetInclusion    ;check '!'
  48.     mov    al,' '
  49.     call    CheckTestSetInclusion    ;check space, so
  50.                     ; we've got a failed
  51.                     ; search
  52.     call    ZTimerOff
  53.