home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / lan / driver6s / getdig.asm < prev    next >
Assembly Source File  |  1990-01-15  |  593b  |  35 lines

  1. ;put into the public domain by Russell Nelson, nelson@clutx.clarkson.edu
  2.  
  3.     public    get_digit
  4. get_digit:
  5. ;enter with al = character
  6. ;return nc, al=digit, or cy if not a digit.
  7.     cmp    al,'0'            ;decimal digit?
  8.     jb    get_digit_1        ;no.
  9.     cmp    al,'9'            ;. .?
  10.     ja    get_digit_2        ;no.
  11.     sub    al,'0'
  12.     clc
  13.     ret
  14. get_digit_2:
  15.     cmp    al,'a'            ;hex digit?
  16.     jb    get_digit_3
  17.     cmp    al,'f'            ;hex digit?
  18.     ja    get_digit_3
  19.     sub    al,'a'-10
  20.     clc
  21.     ret
  22. get_digit_3:
  23.     cmp    al,'A'            ;hex digit?
  24.     jb    get_digit_1
  25.     cmp    al,'F'            ;hex digit?
  26.     ja    get_digit_1
  27.     sub    al,'A'-10
  28.     clc
  29.     ret
  30. get_digit_1:
  31.     stc
  32.     ret
  33.  
  34.  
  35.