home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / sigm / vol131 / hexout.src < prev    next >
Text File  |  1984-04-29  |  1KB  |  41 lines

  1. ********************************************************************
  2.  
  3. *                           HEXOUT                                 *
  4.  
  5. ********************************************************************
  6.  
  7.                        name hexout
  8.                        entry hexout
  9.                        ext chrout
  10.  
  11. ;FUNCTION:Prints on console ,in HEX,the no.whose binary value
  12. ;is transmitted ,in A,by the calling program.
  13.  
  14. ;CALLS:CHROUT
  15.  
  16. hexout:               push psw
  17.               push psw
  18.                       srlr a    ;shift A right
  19.                       srlr a    ;4 times,to
  20.                       srlr a    ;get hi-nibble
  21.                       srlr a
  22.                       adi 30H   ;add 30h
  23.                       cpi 3AH   ;if < 3A,=ASCII
  24.                       jm OK1    ;for 1st hex-digit
  25.                                 ;if >3A,must add
  26.                       adi 7     ;7 to get ASCII
  27. OK1:                  call CHROUT;output hi-digit
  28.                       pop psw   ;now get 
  29.                       ani 0FH   ;lo-nibble
  30.                       adi 30H   ;& do the
  31.                       cpi 3AH   ;same again
  32.                       jm OK2
  33.                       adi 7
  34. OK2:                  call CHROUT
  35.               pop psw
  36.                       ret
  37.  
  38.                       end hexout
  39.  
  40. ********************************************************************
  41.