HELP!!!: Doing INs and OUTs under OS/2 with BCC

HELP!!!: Doing INs and OUTs under OS/2 with BCC

Post by Paolo Ien » Sun, 04 Jul 1993 00:08:55



I'm trying to port an MSDOS application to OS/2 and I know almost nothing of
the latter.

My problem is that inp() and outp() have disappeared. I tried to rewrite them
(essentially following an example of Ray Duncan) in a .asm declaring a
segment MY_TEXT of class CODE, I've defined them in the C code using the __pascal
modifier (as for a few API calls I used) and I linked all together.
The .def file contains a line "SEGMENTS \n MY_TEXT IOPL". The bcc help
description of tlink seems completely false, the accepted parameters of tlink
being apparently those of link (in the on-line help, the IOPL modifier to the
SEGMENTS definition is not supported).

Result: without a "CODE IOPL" line in the .def the program runs normally but stops at the execution of the IN or OUT. With it, it stops at the very beginning.
In both cases I get many "fixupp" warnings from the linker, in different
quantity in the two cases.

Can anybody help?  

Thank you in advance!

Paolo.

===============================================================================

Paolo IENNE
EPFL - Laboratoire de Microinformatique
IN-F Ecublens
CH - 1015 Lausanne

office: +41-21-693 3910
fax:    +41-21-693 5263


 
 
 

HELP!!!: Doing INs and OUTs under OS/2 with BCC

Post by CSCHU.. » Tue, 06 Jul 1993 17:17:16




>I'm trying to port an MSDOS application to OS/2 and I know almost nothing of
>the latter.

>My problem is that inp() and outp() have disappeared. I tried to rewrite them
>(essentially following an example of Ray Duncan) in a .asm declaring a
>segment MY_TEXT of class CODE, I've defined them in the C code using the
>__pascal
>modifier (as for a few API calls I used) and I linked all together.
>The .def file contains a line "SEGMENTS \n MY_TEXT IOPL". The bcc help
>description of tlink seems completely false, the accepted parameters of tlink
>being apparently those of link (in the on-line help, the IOPL modifier to the
>SEGMENTS definition is not supported).

>Result: without a "CODE IOPL" line in the .def the program runs normally but
>stops at the execution of the IN or OUT. With it, it stops at the very
>beginning.
>In both cases I get many "fixupp" warnings from the linker, in different
>quantity in the two cases.

I've been having the same problem.  I don't have the answer for you but
hopefully I can add to the problem description.  I've created a DLL, actually

LIBRARY PORTIO
CODE PRELOAD EXECUTEONLY IOPL

EXPORTS




When dynmamically linking I get a Priviledged Operation Exception.  When
statically linking, the OS/2 loader complains that the EXE file is not an
OS/2 executable.  (If I omit the SEGMENTS statements, TLINK aborts with a
"general error").  According to EXEHDR the EXE and DLL files look OK.

Any hints or suggestions?  IBM C Set is not an option at the present time.

Regards,                       Phone:  (604)389-3827
Cy Schubert                    OV/VM:  BCSC02(CSCHUBER)



 
 
 

HELP!!!: Doing INs and OUTs under OS/2 with BCC

Post by Antony Sut » Wed, 07 Jul 1993 15:26:43





>>I'm trying to port an MSDOS application to OS/2 and I know almost nothing of
>>the latter.

>>My problem is that inp() and outp() have disappeared. I tried to rewrite them
>>(essentially following an example of Ray Duncan) in a .asm declaring a

>I've been having the same problem.  I don't have the answer for you but
>hopefully I can add to the problem description.  I've created a DLL, actually

Under OS/2 this kind of thing is not so much a problem as a design feature.
Access to hardware under OS/2 is more limited to device drivers - one of
reasons why OS/2 is more secure when multitasking. A straight port from
a DOS program to OS/2 is usually not a simple or a wise thing if you get
into hardware manipulation.

What kind of thing are you trying to achieve with the ins and outs?
--
--


"Savannah River, K Reactor, 1968 - that was a VERY good year."

 
 
 

HELP!!!: Doing INs and OUTs under OS/2 with BCC

Post by David Bol » Wed, 07 Jul 1993 22:22:04



>I've been having the same problem.  I don't have the answer for you but
>hopefully I can add to the problem description.  I've created a DLL, actually

>LIBRARY PORTIO
>CODE PRELOAD EXECUTEONLY IOPL

>EXPORTS





You need to remember to specify the number of words to transfer from
the stack.  This is important because the IOPL segment runs within a
different privilege ring, which has an independent stack.  During the
transition to ring 2 (IOPL), OS/2 will transfer the specified number
of 16-bit words from the callers stack to the ring 2 stack, which will
allow the functions to locate their arguments appropriately.

What you are probably running into with your exception is that the
functions are looking up in the stack expecting to see their arguments
and are overrunning the top of the stack since nothing was ever pushed
there.

I'm not sure I remember the exact definitions of these functions, but
I think it was something like:

                inp (unsigned)
                inpw (unsigned)
                outp (unsigned, int)
                outpw (unsigned unsigned)

so you're basically talking about one or two 16-bit arguments.  Just
change your exports to:

                inp 1
                inpw 1
                outp 2
                outpw 2

and I think you'll be ok.

--
-- David
--
/-----------------------------------------------------------------------\

  |   Advanced Network & Services, Inc.   \   Phone: (914) 789-5327   |
 / 100 Clearbrook Road, Elmsford, NY 10523  \   Fax: (914) 789-5310    \
\-----------------------------------------------------------------------/

 
 
 

HELP!!!: Doing INs and OUTs under OS/2 with BCC

Post by David Charl » Thu, 08 Jul 1993 05:45:10



>I've been having the same problem.  I don't have the answer for you but
>hopefully I can add to the problem description.  I've created a DLL, actually

>LIBRARY PORTIO
>CODE PRELOAD EXECUTEONLY IOPL

>EXPORTS




>When dynmamically linking I get a Priviledged Operation Exception.  When
>statically linking, the OS/2 loader complains that the EXE file is not an
>OS/2 executable.  (If I omit the SEGMENTS statements, TLINK aborts with a
>"general error").  According to EXEHDR the EXE and DLL files look OK.

I don't know the solution, but check out the file xlibos2.zip on
ftp-os2.  It does port I/O pas part of it's code to set display
mode-X.  Source code is included in the zip file.
--
+--------------------------+------------------------------------+
| David Charlap, TEAM-OS/2 | OS/2 2.1.  Not just up and coming. |

+--------------------------+------------------------------------+
 
 
 

1. Ins and outs of File Replicator

I am trying to figure out the best way of coordinating files between a
laptop (Thinkpad 385) and a desktop, both running OS/2 Warp4, fp5. With
considerable trial and error, I have File Replicator (standard OS/2
function) up and running, and it seems to work. I have it set up so that
files from the \export directory of each computer are automatically
transferred to the \import directory of the other computer (linked on a
home LAN or university Netware network connected by File and Print
Sharing). To make it somewhat more convenient, I put shadows of the
\import and \export directories on the desktop, so that files can be
drag-copied to the export folder and from the import folder (to and from
their real home directories). The question is this:

Is there a convenient way to bypass this extra file copying to and from
the import and export directories? It would be most convenient if one
could edit the files in their native directories and have them
replicated each time they are saved (which replicator does for all files
in the \export directory). The way it is now, a file which is edited in
its native directory has first to be copied to the export directory
before it is replicated. I thought the obvious thing to do was to drag a
shadow of a file (in its native directory) to the \export directory.
Then every time the original was edited, the shadow would reflect the
changes. However, this doesn't work. The shadow is not replicated to the
other computer. I tried.

Is there a way to link two copies of a file so that when one is updated,
the other is updated too? That ought to do the trick. The system would
have to recognize when an update had been done, and automatically update
the copy.

I can see that keeping the files for export and import distinct from the
original files (in their native directories) provides a measure of
protection from inadvertently replacing a file. But this system is not
very convenient.

Any ideas?

2. Please help with win2k PCMCIA problem

3. BCC 3.1 Kill dos sessions!

4. Philips Pronto (System Remote Control) UK - SOLD

5. Setting up BCC++/DOS under OS2??

6. 3.01 not acceptable with INTEL Cam

7. Need Help in Load DOS UMB under Virtual Dos Machine (True DOS) in OS/2 Warp

8. EDT source?

9. ZModem Time Outs In OS/2

10. icc *SLOWER* than bcc help on speed up?

11. socket time-outs