home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / sd386v50.zip / sd386src.zip / SHOWAF.C < prev    next >
Text File  |  1994-06-06  |  11KB  |  187 lines

  1. /*****************************************************************************/
  2. /* File:                                              IBM INTERNAL USE ONLY  */
  3. /*      showaf.c                                                             */
  4. /*                                                                           */
  5. /* Description:                                                              */
  6. /*      Display and Edit Registers' and Flags' contents.                     */
  7. /*                                                                           */
  8. /*                                                                           */
  9. /*                                                                           */
  10. /* History:                                                                  */
  11. /*                                                                           */
  12. /*   02/08/91 Creation of 32-bit SD86, from 16-bit version.                  */
  13. /*                                                                           */
  14. /*...16->32 port.                                                            */
  15. /*...                                                                        */
  16. /*... 02/08/91  100   Philip    port to 32 bit.                              */
  17. /*... 02/08/91  101   Joe       port to 32 bit.                              */
  18. /*... 02/08/91  102   Pratima   port to 32 bit.                              */
  19. /*... 02/08/91  103   Dave      port to 32 bit.                              */
  20. /*... 02/08/91  104                                                          */
  21. /*... 02/08/91  105   Christina port to 32 bit.                              */
  22. /*... 02/08/91  106   Srinivas  port to 32 bit.                              */
  23. /*... 02/08/91  107   Dave      port to 32 bit.                              */
  24. /*... 02/08/91  108   Dave      port to 32 bit.                              */
  25. /*... 02/08/91  109                                                          */
  26. /*... 02/08/91  110   Srinivas  port to 32 bit.                              */
  27. /*... 02/08/91  111   Christina port to 32 bit.                              */
  28. /*... 02/08/91  112   Joe       port to 32 bit.                              */
  29. /*... 02/08/91  113                                                          */
  30. /*... 02/08/91  114                                                          */
  31. /*... 02/08/91  115   Srinivas  port to 32 bit.                              */
  32. /*... 02/08/91  116   Joe       port to 32 bit.                              */
  33. /*                                                                           */
  34. /*...Release 1.00 (Pre-release 1)                                            */
  35. /*...                                                                        */
  36. /*... 07/09/91  213   srinivas  one byte memory operand problem.             */
  37. /*...                                                                        */
  38. /***Includes******************************************************************/
  39.  
  40. #include "all.h"                        /*   SD86 Include Files              */
  41.  
  42. /***External declarations*****************************************************/
  43.  
  44. extern UINT TopLine;
  45. extern UINT VideoCols;
  46. extern UINT FnameRow;
  47.  
  48.  
  49. static uchar hexdig[] = "0123456789ABCDEF";
  50.  
  51.  void
  52. fmtasm(AFILE *fp)
  53. {
  54.     ShowData( TopLine );
  55.     fmtfname( fp );
  56.     fmtthread();
  57.     fmterr( NULL );
  58.     HideCursor();
  59. }
  60.  
  61. #define  MAXTHDLEN  19
  62.   void
  63. fmtthread( )
  64. {
  65.     uchar buffer[MAXTHDLEN];
  66.  
  67.     sprintf(buffer, "%cThread %u       ", Attrib(vaInfo), GetExecTid());
  68.     putrc( FnameRow, VideoCols - MAXTHDLEN, buffer );
  69. }
  70.  
  71.  
  72. /*****************************************************************************/
  73. /* utox2()                                                                   */
  74. /*                                                                           */
  75. /* Description:                                                              */
  76. /*                                                                           */
  77. /*      Convert an unsigned integer to a 2-char hex string.                  */
  78. /*                                                                           */
  79. /* Parameters:                                                               */
  80. /*                                                                           */
  81. /*      u     unsigned integer to be converted                               */
  82. /*                                                                           */
  83. /* Return:                                                                   */
  84. /*      x2    pointer to converted 2-char hex output                         */
  85. /*                                                                           */
  86. /* Assumptions:                                                              */
  87. /*                                                                           */
  88. /*      none                                                                 */
  89. /*                                                                           */
  90. /*****************************************************************************/
  91.  
  92.  void
  93. utox2(uchar u,uchar *x2)                /* unsigned input char            213*/
  94.                                         /* ptr to resulting 2-char hex output*/
  95. {
  96.  
  97.     *(x2+1) = hexdig[u & 0x0F];
  98.     *x2     = hexdig[(u >> 4) & 0x0F];
  99. }
  100. /*****************************************************************************/
  101. /* utox4()                                                                   */
  102. /*                                                                           */
  103. /* Description:                                                              */
  104. /*                                                                           */
  105. /*      Convert an unsigned integer to a 4-char hex string.                  */
  106. /*                                                                           */
  107. /* Parameters:                                                               */
  108. /*                                                                           */
  109. /*      u     unsigned integer to be converted                               */
  110. /*                                                                           */
  111. /* Return:                                                                   */
  112. /*      x4    pointer to converted 4-char hex output                         */
  113. /*                                                                           */
  114. /* Assumptions:                                                              */
  115. /*                                                                           */
  116. /*      none                                                                 */
  117. /*                                                                           */
  118. /*****************************************************************************/
  119.  
  120.  void
  121. utox4(uint u,uchar *x4)                 /* unsigned input word               */
  122.                                         /* ptr to resulting 4-char hex output*/
  123. {
  124.     uint n;
  125.  
  126.     for( n=4 ; n-- ; u >>= 4 )
  127.         x4[n] = hexdig[u & 0xF];
  128. }
  129. /*************************************************************************112*/
  130. /* utox8()                                                                112*/
  131. /*                                                                        112*/
  132. /* Description:                                                           112*/
  133. /*                                                                        112*/
  134. /*      Convert an unsigned integer to an 8-char hex string.              112*/
  135. /*                                                                        112*/
  136. /* Parameters:                                                            112*/
  137. /*                                                                        112*/
  138. /*      u     unsigned integer to be converted                            112*/
  139. /*                                                                        112*/
  140. /* Return:                                                                112*/
  141. /*      x8    pointer to converted 8-char hex output                      112*/
  142. /*                                                                        112*/
  143. /* Assumptions:                                                           112*/
  144. /*                                                                        112*/
  145. /*      none                                                              112*/
  146. /*                                                                        112*/
  147. /*************************************************************************112*/
  148.                                                                         /*112*/
  149.  void                                                                   /*112*/
  150. utox8(uint u,uchar *x8)                                                 /*112*/
  151. {                                                                       /*112*/
  152.     uint n;                                                             /*112*/
  153.                                                                         /*112*/
  154.     for( n=8 ; n-- ; u >>= 4 )                                          /*112*/
  155.         x8[n] = hexdig[u & 0xF];                                        /*112*/
  156. }                                                                       /*112*/
  157.  
  158. /*****************************************************************************/
  159. /* atou()                                                                    */
  160. /*                                                                           */
  161. /* Description:                                                              */
  162. /*                                                                           */
  163. /*      Convert a char to an unsigned integer.                               */
  164. /*                                                                           */
  165. /* Parameters:                                                               */
  166. /*      cp     pointer to the char to be converted                           */
  167. /*                                                                           */
  168. /* Return:                                                                   */
  169. /*      n      unsigned integer resulting from the conversion                */
  170. /*                                                                           */
  171. /* Assumptions:                                                              */
  172. /*                                                                           */
  173. /*      none                                                                 */
  174. /*                                                                           */
  175. /*****************************************************************************/
  176.  
  177.  uint
  178. atou(uchar *cp)
  179. {
  180.     uint n;
  181.  
  182.  
  183.     for( n=0 ; (*cp >= '0') && (*cp <= '9') ; ++cp )
  184.         n = 10*n + (*cp - '0');
  185.     return( n );
  186. }
  187.