home *** CD-ROM | disk | FTP | other *** search
/ C!T ROM 5 / ctrom5b.zip / ctrom5b / PROGRAM / ASM / ALIB30B / CONV23.ASM < prev    next >
Assembly Source File  |  1994-10-15  |  2KB  |  73 lines

  1.     page    66,132
  2. ;******************************** CONV23.ASM *********************************
  3.  
  4. LIBSEG           segment byte public "LIB"
  5.         assume cs:LIBSEG , ds:nothing
  6.  
  7. ;----------------------------------------------------------------------------
  8. .xlist
  9.     include  mac.inc
  10.     include  common.inc
  11. .list
  12. comment 
  13. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
  14. ;DWORD_TO_HEX_STDOUT - display byte as decimal to stdout
  15. ;
  16. ; input:  dx,ax = binary value
  17. ; output: ascii hex to stdout
  18. ;* * * * * * * * * * * * * *
  19. 
  20.     public    dword_to_hex_stdout
  21. DWORD_TO_HEX_STDOUT    PROC    FAR
  22.     push    ax
  23.     xchg    ax,dx
  24.     call    word_to_hex_stdout
  25.     pop    ax    
  26. DWORD_TO_HEX_STDOUT    ENDP
  27. comment 
  28. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
  29. ;WORD_TO_HEX_STDOUT - display word as decimal to stdout
  30. ;
  31. ; input:     ax = binary value
  32. ; output: ascii hex to stdout
  33. ;* * * * * * * * * * * * * *
  34. 
  35.  
  36.     public    WORD_TO_HEX_STDOUT
  37. WORD_TO_HEX_STDOUT    proc    far        
  38.     push    ax
  39.     xchg    ah,al
  40.     call    BYTE_TO_HEX_STDOUT
  41.     pop    ax
  42. WORD_TO_HEX_STDOUT    ENDP    
  43.  
  44. comment 
  45. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -( CONVERT )
  46. ;BYTE_TO_HEX_STDOUT - display byte as decimal to stdout
  47. ; display data byte as two hex ascii characters
  48. ;  inputs: al=data
  49. ;  output: registers ax,dx changed
  50. ;* * * * * * * * * * * * * *
  51. 
  52.     PUBLIC    BYTE_TO_HEX_STDOUT
  53. BYTE_TO_HEX_STDOUT    PROC    FAR    
  54.         mov     ah,0
  55.         mov     dl,10h
  56.         div     dl
  57.         call    local_proc
  58.         mov     al,dh
  59. BYTE_TO_HEX_STDOUT    ENDP
  60.  
  61. local_proc    proc    far
  62.         cmp     al,0Ah
  63.         sbb     al,69h
  64.         das
  65.         xchg    ax,dx
  66.         mov     ah,2
  67.         int     21h
  68.         retf
  69. local_proc    endp        
  70.  
  71. LIBSEG    ENDS
  72.     end
  73.