home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / compuserve / Basic / PCCHAS.ZIP / EXAMPLE1.ASM next >
Assembly Source File  |  1995-01-08  |  798b  |  27 lines

  1.        TITL 'Binary To ASCII Hex Conversion Routine'
  2.        IDT  'BINHEX'
  3.        RORG
  4.        DEF  BINHEX
  5.        REF  HEXTXT
  6. *
  7. *  IN  : R0 Number to be converted
  8. *        R1 Buffer to store number in
  9. *
  10. *  OUT : R0 Destroyed
  11. *        R1 Pointer to end of stored number
  12. *        R2 Destroyed
  13. *        R3 Destroyed
  14. *
  15. *  REF : HEXTXT string
  16. *
  17. BINHEX LI   R2,4              4 digits required
  18. LOOP   MOV  R0,R3             copy value
  19.        SRL  R3,12             move digit to lsb & zero fill the rest
  20.        MOVB @HEXTXT(R3),*R1+  store the ascii character for it
  21.        SLA  R0,4              position next digit
  22.        DEC  R2                done all of the digits ?
  23.        JNE  LOOP              n, keep going
  24.        RT                     y, return to caller
  25. *
  26.        END
  27.