home bbs files messages ]

Just a sample of the Echomail archive

Cooperative anarchy at its finest, still active today. Darkrealms is the Zone 1 Hub.

   PCBOARD      PCBoard Support directly from Clark Deve      815 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 266 of 815   
   John Kelly to All   
   OS/2 com.sys ioctl   
   07 Feb 14 00:59:00   
   
   The OS/2 PDD reference has some working examples of ioctls for 32-bit   
   OS/2 code, but none for 16-bit DOS code. It just says "use the DOS INT   
   21h ioctl interface." It would help to know how!   
      
   I google'd for hours without finding a working example. I gave up. But   
   some time later, I read Ray Gwinn's sio160d\sioref.txt and noticed that   
   his SIO supports some ioctls, like the original IBM com.sys. And what do   
   you know, he has a working example of how to call the ioctls from DOS 16   
   bit code (in assembler). At last, the missing information I needed.   
      
   I also learned that IBM's com.sys from MCP2 suports my shared IRQ 2-port   
   PCI serial card, and backports to WARP 4.   
      
   I think I can write a FOSSIL wrapper that loads DOS PCBoard; the key to   
   making it work is the DOS ioctl interface. I used what I learned from   
   Ray, and wrote an example in C (Turbo C 2.0+ or Borland C++ 3.1+) that   
   sets the baud rate. With this interface, you can control all details of   
   how com.sys works.   
      
   I may be the only person on the planet interested in this, but just in   
   case, here is the code ...   
      
      
   # include    
   # include    
   # include    
   # include    
   # include    
      
   typedef unsigned short USHORT;   
   typedef void VOID;   
      
   void   
   dos440c (USHORT hand, USHORT func, VOID far *parm, VOID far *data)   
   {   
       asm push ds;   
      
       _DS = FP_SEG (data);   
       _DX = FP_OFF (data);   
      
       _SI = FP_SEG (parm);   
       _DI = FP_OFF (parm);   
      
       _CX = func;   
       _BX = hand;   
       _AX = 0x440c;   
      
       geninterrupt (0x21);   
       asm pop ds;   
       if (_FLAGS & 1) {   
           ;                               /* error, do something */   
       }   
   }   
      
   void   
   main (void)   
   {   
       int fd;   
       unsigned short baud = 19200;   
      
       fd = open ("COM1", O_RDWR);   
       if (fd == -1) {   
           perror ("failure opening com port");   
           exit (EXIT_FAILURE);   
       }   
      
       dos440c (fd, 1 << 8 | 0x41, (VOID far *) &baud, (VOID far *) 0);   
      
       close (fd);   
       exit (EXIT_SUCCESS);   
   }   
      
   --- PCBoard (R) v15.4/M 250 Beta   
    * Origin: Torres Vedras - Portugal (2:362/6)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca