delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/12/23/15:15:13

Date: Wed, 23 Dec 92 11:57:13 EST
From: lowry AT neuronet DOT pitt DOT edu (Brian Lowry)
To: djgpp AT sun DOT soe DOT clarkson DOT EDU

    By way of introduction, my name is Brian,
    and I am having a few sticky problems 
    in getting DJGPP GNU C/C++ to deal with MSDOS 
    interrupts and device drivers.

    First, let me describe what I'm attempting to do.
    I am a C/UNIX programmer--I know next to nothing about DOS--only
    that it has horrific memory problems.  I have some data
    acquisition code running on some Hp/Apollo workstations
    that I'd like to port to other platforms.  I'm using
    X11R4 and OSF/Motif for the app's GUI.  Back in
    October, QuarterDeck Office Systems released a product
    called DesQView/X that runs an X server on a DOS machine.
    They also provided XView and OSF/Motif toolkits with
    support for DJGPP GNU C/C++ port and also for the MetaWare High C compiler.
    For the most part, the code ported beautifully -- essentially
    no compiler errors and a handful of warnings.  The problematic
    part of the code is dealing with the data acquisition board device driver.
    The board comes with some C interface code, but the code is
    all real-mode (the manufacturer provides Borland and MSC support).
    The interface code must be compiled with the rest of the application.

    The device driver logic seems to be pretty straightforward:
    The driver makes the acquisition board look like a DOS device, which
    DOS apparently treats like a disk file.  Thus, to use the board, the code
    uses "fopen", "fprintf" to write acquisition commands, and "fclose" when
    finished.  "int86x" (int 21h) calls are used by the supplied toolkit to check
    to check the device input status, send control data, and set file
    attributes.  My problem is that the code crashes whenever the int86(x) call is made.
    The "int86(x)" calls require that the segment and offsets of a 32-bit pointer
    be passed as arguments -- this is undoubtedly the problem.
    
    My questions, then, are:

        1. How is it possible to load the registers with the correct 
           offset and segment values for an arbitrary 32-bit pointer? 
           It seems that I would need to somehow get at the extender tables.
           Is there some way of forcing a pointer allocation so that it 
           is in the first 1Mb of memory?

        2. If it is impossible (or not worth it in the sense of man-hours),
           could you suggest any type of workaround, or any other resources?

        3. Is there some way to use stdio calls, like fread and fwrite
           instead of the int86 calls?

    Many thanks for your time & suggestions.

    Brian C. Lowry
    Dept. of Behavioral Neuroscience
    University of Pittsburgh
    TEL: 412-624-4564          
    FAX: 412-624-9198


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019