home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / cpm / utils / asmutl / asmlib.lbr / ASCHEX.AZM / ASCHEX.ASM
Encoding:
Assembly Source File  |  1991-06-25  |  896 b   |  39 lines

  1. ;----------------------------------------------------------------
  2. ;         This is a module in the ASMLIB library. 
  3. ;
  4. ; Convert the ascii characters -> by DE into a pair of hex digits 
  5. ; into HL.
  6. ;            Written        R.C.H.        16/8/83
  7. ;            Last Update    R.C.H.        16/8/83
  8. ;----------------------------------------------------------------
  9. ;
  10.     name    'aschex'
  11. ;
  12.     public    aschex
  13.     extrn    caps
  14.     maclib    z80
  15. ;
  16. aschex:
  17.     lxi    h,00            ; clear to initialize
  18. aschex2:    ; loop here to read memory characters and make them into hex's
  19.     ldax    d            ; Get a character
  20.     inx    d            ; Point to next character
  21.     call    caps            ; Make upper case
  22.     sui    '0'
  23.     cpi    10
  24.     jrc    aschex3
  25.     sui    'A' - '0' - 10
  26.     cpi    16            ; Check if NON LEGAL character
  27.     rnc
  28. aschex3:    ; Mask in the digit
  29.     dad    h
  30.     dad    h
  31.     dad    h
  32.     dad    h            ; move right 4 places
  33.     ora    l            ; mask in
  34.     mov    l,a            ; re-load
  35.     jr    aschex2
  36.     end
  37.  
  38.  
  39.