home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 33 VDrivers / 33-VDrivers.zip / DBMONO.ZIP / README < prev   
Text File  |  1993-03-05  |  7KB  |  246 lines

  1. Description
  2. -----------
  3.  
  4. DBMONO.SYS is an OS/2 monochrome adapter device driver compatible
  5. with OS/2 1.x and OS/2 2.0.
  6.  
  7. This device driver allows applications and DLLs to display text
  8. on an attached monochrome monitor.
  9.  
  10. These applications can be DOS, OS/2 1.x, OS/2 2.0, Microsoft
  11. Windows applications, and DLLs.
  12.  
  13.  
  14. Device Driver Installation
  15. --------------------------
  16.  
  17. 1. Copy the file DBMONO.SYS to your hard disk:
  18.  
  19.    copy dbmono.sys c:\
  20.  
  21. 2. Add the following line to your CONFIG.SYS file:
  22.  
  23.    DEVICE=c:\dbmono.sys
  24.  
  25. This example assumes that the file DBMONO.SYS is placed on
  26. the root of the C drive.  Change this to meet your own
  27. requirements.
  28.  
  29. 3. Shutdown OS/2 and then reboot your computer.
  30.  
  31. 4. Observe the device driver's installation messages during
  32.    OS/2's startup sequence.
  33.  
  34.  
  35. Testing the Device Driver for proper installation
  36. -------------------------------------------------
  37.  
  38. 1.  Make sure your monochrome monitor is properly attached to your
  39.     computer and is turned on.
  40.  
  41. 2.  At an OS/2 FULL SCREEN prompt, type in the following and press
  42.     the Enter key:
  43.  
  44.     mode mono
  45.  
  46.     Your full screen session should now be visible on the
  47.     monochrome monitor (if not, then you've got other problems).
  48.  
  49. 3.  Now get back to your full screen by typing in the following and
  50.     press the Enter key:
  51.  
  52.     mode co80,25
  53.  
  54. 4.  At this point you have verified that your monochrome monitor is
  55.     correctly attached to your computer and working.  To test if the
  56.     monochrome device driver is working, type in the following and
  57.     press the Enter key:
  58.  
  59.     dir > dbmono$$
  60.  
  61.     You should see the output of the dir command displayed on the
  62.     monochrome monitor (if not, something is wrong).
  63.  
  64.  
  65. Sending debug output to monochrome monitor from your applications
  66. -----------------------------------------------------------------
  67.  
  68. Keep in mind that this monochrome monitor device driver is a
  69. standard OS/2 1.x character mode device driver.  This fact
  70. has the following implications:
  71.  
  72. o Multiple concurrent threads (or processes) can interact with
  73.   this device without the need for explicity exclusion semaphores,
  74.   etc, since OS/2 itself will serialize requests to the device.
  75.  
  76. o Any application (EXE or DLL) that can open the device can write
  77.   to it.  This means that both executables and dynamic link libraries
  78.   can display text on the monochrome monitor.  These executables can
  79.   be DOS, OS/2 1.x, OS/2 2.0, or Microsoft Windows applications.
  80.   This driver functions both under OS/2 1.x and OS/2 2.0.
  81.  
  82. o This device driver basically implements a very simple "dumb" TTY
  83.   terminal.  This implies that:
  84.  
  85.   - text is automatically scrolled as necessary.
  86.  
  87.   - carriage returns (\r) and line feeds (\n) are correctly
  88.     interpreted.  Note to C programmers: if you open the device 
  89.     in "binary" mode, you will need to send a "\r\n" sequence
  90.     to move to the next line; if you open the device in
  91.     text mode (fopen), the "\n" will be translated into a
  92.     "\r\n" by the C runtime.
  93.  
  94.   - a form feed (\f) character clears the screen and sets the
  95.     current position at the upper left corner of the screen.
  96.  
  97. An application (or DLL) must do the following two things to send 
  98. output to the monochrome monitor, 1) Open the device (done once), 
  99. and 2) write to it (as often as you wish).
  100.  
  101. This device driver is known by the device name "DBMONO$$".
  102.  
  103. Open this device using whatever standard file open API is
  104. appropriate for your programming environment.
  105.  
  106. For example, if you program in C Set/2 under OS/2 2.0, the following
  107. code fragment shows one method of opening the device, writing a string
  108. to it, then closing it:
  109.  
  110. #define Error( code, string ) \
  111.   ( fprintf( stderr, "%d: %s.\n", code, string ), exit(0) )
  112.  
  113. static CHAR szText[] = "Hello out there from 32-bit land!" ;
  114.  
  115. #define CBYTES  (sizeof szText - 1)
  116.  
  117. int main()
  118. {
  119.   HFILE     hf = 0 ;
  120.   APIRET    rc ;
  121.   ULONG     ulTemp ;
  122.   ULONG     cBytes = 0 ;
  123.  
  124.   rc = DosOpen( "DBMONO$$"
  125.               , &hf
  126.               , &ulTemp
  127.               , 0
  128.               , FILE_NORMAL
  129.               , FILE_OPEN
  130.               , OPEN_ACCESS_WRITEONLY
  131.               | OPEN_SHARE_DENYNONE
  132.               | OPEN_FLAGS_FAIL_ON_ERROR
  133.               , 0
  134.               ) ;
  135.  
  136.   if ( rc )
  137.     Error( rc, "DosOpen failed" ) ;
  138.  
  139.   rc = DosWrite( hf, szText, CBYTES, &cBytes ) ;
  140.  
  141.   if ( rc )
  142.     Error( rc, "DosWrite failed" ) ;
  143.  
  144.   if ( cBytes != CBYTES )
  145.     Error( cBytes, "DosWrite: cBytes != CBYTES" ) ;
  146.  
  147.   rc = DosClose( hf ) ;
  148.  
  149. }/*main*/
  150.  
  151. You could also use the standard ANSI C file API to accomplish the
  152. same thing:
  153.  
  154. #define Error( code, string ) \
  155.   ( fprintf( stderr, "%d: %s.\n", code, string ), exit(0) )
  156.  
  157. static CHAR szText[] = "Hello out there from 32-bit land!" ;
  158.  
  159. #define CBYTES  (sizeof szText - 1)
  160.  
  161. int main()
  162. {
  163.   FILE * fp = NULL ;
  164.   int    cBytes = 0 ;
  165.  
  166.   fp = fopen( "DBMONO$$", "w" ) ;
  167.  
  168.   if ( NULL == fp )
  169.     Error( fp, "fopen failed" ) ;
  170.  
  171.   cBytes = fwrite( szText, 1, CBYTES, fp ) ;
  172.  
  173.   if ( rc )
  174.     Error( rc, "DosWrite failed" ) ;
  175.  
  176.   if ( cBytes != CBYTES )
  177.     Error( cBytes, "fwrite: cBytes != CBYTES" ) ;
  178.  
  179.   fclose( fp ) ;
  180.  
  181. }/*main*/
  182.  
  183. Here is a useful function that I use:
  184.  
  185. //=============================================================================
  186. // DB - display debug output to DBMONO$$.  If the DBMONO.SYS device driver is
  187. //      installed, then DBMONO$$ refers to the monochrome adapter.  Otherwise,
  188. //      DBMONO$$ refers to the file DBMONO$$.
  189. //-----------------------------------------------------------------------------
  190. // pszFormat - format string optionally followed by parameters.  This is the
  191. //             same syntax as the standard printf() function.  For example:
  192. //             
  193. //               DB( "My id is %d.\n", sId ) ;
  194. //               DB( "p1 = %0x, p2 = %0x, p2 = %ld.\n", ulp1, ulp2, lp3 ) ;
  195. //               DB( "%s: %c %d.\n", szName, chData, sAge ) ;
  196. //
  197. //-----------------------------------------------------------------------------
  198. // Returns nothing.
  199. //=============================================================================
  200.  
  201. VOID DB( const CHAR * pszFormat, ... )
  202. {
  203.   va_list         args ;
  204.  
  205.   if ( NULL == hfDebug ) 
  206.     hfDebug = fopen( "DBMONO$$", "w+" ) ;
  207.  
  208.   if ( NULL == hfDebug ) 
  209.     return ;
  210.  
  211.   va_start( args, pszFormat ) ;
  212.   vfprintf( hfDebug, pszFormat, args ) ;
  213.   va_end( args ) ;
  214.  
  215. }/*DB*/
  216.  
  217.  
  218. Limitations
  219. -----------
  220.  
  221. The following limitations are know to exist with this device driver:
  222.  
  223. 1. The cursor is not modified in any way.  Disregard the cursor
  224.    completely.
  225.  
  226. 2. Sometimes your monochrome monitor's screen may seem to go blank.
  227.    I don't know why this occurs, but its real easy to "get it back"
  228.    by typing the following two lines at an OS/2 FULL SCREEN prompt:
  229.  
  230.    mode mono
  231.    mode co80,25
  232.  
  233. 3. This device driver is provided on an "as is" basis, with no
  234.    guarantee that it won't trash your hard disk, your work in
  235.    progress, etc (<grin>).
  236.  
  237.  
  238. Adel Hazzah (70720,411)
  239.  
  240.  
  241.  
  242.  
  243.  
  244.  
  245.  
  246.