home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.tar / ftp.whtech.com / compuserve / Basic / PCCHAS.ZIP / EXAMPLE1.LST < prev    next >
File List  |  1995-01-08  |  1KB  |  32 lines

  1. BINHEX      99000 FAMILY MACRO ASSEMBLER  PC2.1 84.107    22:42:48  01-08-95
  2. Binary To ASCII Hex Conversion Routine                           PAGE 0001
  3.  
  4.  0002                   IDT  'BINHEX'
  5.  0003 0000              RORG
  6.  0004                   DEF  BINHEX
  7.  0005                   REF  HEXTXT
  8.  0006            *
  9.  0007            *  IN  : R0 Number to be converted
  10.  0008            *        R1 Buffer to store number in
  11.  0009            *
  12.  0010            *  OUT : R0 Destroyed
  13.  0011            *        R1 Pointer to end of stored number
  14.  0012            *        R2 Destroyed
  15.  0013            *        R3 Destroyed
  16.  0014            *
  17.  0015            *  REF : HEXTXT string
  18.  0016            *
  19.  0017 0000 0202  BINHEX LI   R2,4              4 digits required
  20.       0002 0004  
  21.  0018 0004 C0C0  LOOP   MOV  R0,R3             copy value
  22.  0019 0006 09C3         SRL  R3,12             move digit to lsb & zero fill
  23.  0020 0008 DC63         MOVB @HEXTXT(R3),*R1+  store the ascii character for
  24.       000A 0000  
  25.  0021 000C 0A40         SLA  R0,4              position next digit
  26.  0022 000E 0602         DEC  R2                done all of the digits ?
  27.  0023 0010 16F9         JNE  LOOP              n, keep going
  28.  0024 0012 045B         RT                     y, return to caller
  29.  0025            *
  30.  0026                   END
  31. NO ERRORS, NO WARNINGS
  32.