• OS/2 com.sys ioctl

    From John Kelly@2:362/6 to All on Fri Feb 7 00:59:00 2014
    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 <dos.h>
    # include <fcntl.h>
    # include <io.h>
    # include <stdio.h>
    # include <stdlib.h>

    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)
  • From Holger Granholm@2:20/228 to John Kelly on Sun Feb 9 22:38:00 2014
    In a message dated 02-07-14, John Kelly said to All:

    Hello John,

    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.

    I have been using OS/2 to run my BBS since feb. 1996 and have yet to
    find a DOS program that doesn't work under OS/2+DOS. The BBS is running
    under Warp 4 FP12.

    My DOS applications stem from the time of DOS v3.2 whenever that was.


    Regards,

    Holger

    ___
    * MR/2 2.30 * OS/2 is 25 years old; dead but still walking!



    --- PCBoard (R) v15.22 (OS/2) 2
    * Origin: Coming to you from the Sunny Aland Islands. (2:20/228)
  • From John Kelly@2:362/6 to Holger Granholm on Tue Feb 11 04:00:00 2014
    I have been using OS/2 to run my BBS since feb. 1996 and have yet to
    find a DOS program that doesn't work under OS/2+DOS.

    Borland C++ 3.1 fails.

    The BBS is running under Warp 4 FP12.

    FP12 seems good here too. But I had to use IBM1S506.ADD from MCP2 to get
    my SIS IDE controller using UDMA. And the IBM com.sys driver from MCP2
    works with my PCI serial card.

    Running a stress test with SIO (1.60d) shows that it uses 100% of the
    CPU on an inbound transfer at 115200. The IBM com.sys only uses 3% on
    the same test. SIO gives the app many small packets, hammering the CPU.

    --- PCBoard (R) v15.4/M 250 Beta
    * Origin: Torres Vedras - Portugal (2:362/6)
  • From Holger Granholm@2:20/228 to John Kelly on Wed Feb 12 09:25:00 2014
    In a message dated 02-11-14, John Kelly said to Holger Granholm:

    Hi John,

    Borland C++ 3.1 fails.

    I have never tried that.

    FP12 seems good here too. But I had to use IBM1S506.ADD from MCP2 to
    get my SIS IDE controller using UDMA. And the IBM com.sys driver
    from MCP2 works with my PCI serial card.

    There's another solution that I prefer, the DaniS506.ADD but as long as
    your solution works that's the main objective. There are a heap of other Danielas drivers that substitute the original IBM supplied ones.

    Running a stress test with SIO (1.60d) shows that it uses 100% of
    the CPU on an inbound transfer at 115200. The IBM com.sys only uses
    3% on the same test. SIO gives the app many small packets, hammering
    the CPU.

    I haven't checked that, as long as it works it's OK with me.

    Have a nice day,

    Holger

    ___
    * MR/2 2.30 * Problem with troubleshooting is that trouble shoots back.


    --- PCBoard (R) v15.22 (OS/2) 2
    * Origin: Coming to you from the Sunny Aland Islands. (2:20/228)