home *** CD-ROM | disk | FTP | other *** search
/ Stars of Shareware: Programmierung / SOURCE.mdf / programm / msdos / c / mscwattc / elib / outhex.asm < prev    next >
Encoding:
Assembly Source File  |  1992-01-17  |  1.0 KB  |  66 lines

  1. PAGE    66,132
  2. ;
  3. ;
  4. ;
  5. ;
  6. ;
  7. ;
  8. ;
  9. ;
  10. ;  outhex.asm
  11. ;
  12. ;  print a hex byte to standard out
  13. ;
  14. ;
  15. ;  Usage :
  16. ;        outch( ch )
  17. ;
  18. ;  (c) 1990 University of Waterloo,
  19. ;           Faculty of Engineering,
  20. ;           Engineering Microcomputer Network Development Office
  21. ;
  22. ;  version
  23. ;
  24. ;    0.1    7-Nov -1990   E. P. Engelke
  25. ;
  26. ;
  27.     include masmdefs.hsm
  28.     include    model.hsm
  29.  
  30. codedef OUTHEX
  31. datadef
  32.  
  33.         cextrn outch
  34.  
  35. cstart  OUTHEX
  36.  
  37. h1      proc near
  38. ; Arg is in low Nybble of AL
  39. ; This was wrong        mov     AL, +@AB [BP]    ; get byte
  40.         and     AL, 0fh
  41.         cmp     AL, 9
  42.         jle     @1
  43.         add     AL, 'A' - '9' - 1
  44. @1:     add     AL, '0'
  45. ;
  46. ;        mov     AH, 2
  47. ;        int     21h
  48.         push    AX
  49.         ccall    outch
  50.         pop     AX
  51.         ret
  52. h1      endp
  53.  
  54. cpublic outhex
  55.         mov     AL, +@AB [BP]
  56.         mov     CL, 4
  57.         shr     AL, CL
  58.  
  59.         mov     DL, AL
  60.         call    h1
  61.         mov     AL, +@AB [BP]
  62.         call    h1
  63. creturn outhex
  64. cend    OUTHEX
  65.         end
  66.