[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

outportb in WIN32

Posted on 1997-01-31
1
Medium Priority
?
711 Views
Last Modified: 2013-12-04
A group at Queen's University is trying to implement the (out,in)portb command in an WIN32 program. We are using the command to directly control the digital port of a National Instruments A/D card. In a 16-bit Dos application, we could simply use the (in,out)portb command, but when trying to create a 32-bit windows GUI application, Borland C++ 5.0 won't compile the program. Checking the help manual and the compatibility list for certain commands, it lists that (in,out)portb is not avaliable to WIN32. Is there any way around this in a WIN95 environment to use the outportb command in a 32-bit application. If so, how would one do it? (does it possibly involve accessing the EISA.vxd file in windows 95?)

Thanks for such consideration,

Yael Maguire
Queen's University, Kingston, Ontario.
0
Comment
Question by:yael
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 1

Accepted Solution

by:
glittle earned 100 total points
ID: 1298619
2 possible methods that should work for Win95.

1.  If your compiler has inline assembly, use it to insert the proper assembly calls.

unsigned char inportb(int port)
{
    _asm {
        mov    dx, port
        xor      ax,ax
        in         al, dx
    }
    return;
}

void outputb(int port, char ch)
{
    _asm {
        mov    dx, port
        xor       ax,ax
        mov    al, ch
        out       dx, al
    }
    return;
}

These examples are for Microsoft C, but should give you the basic concept.  


2.  Write 2 assembly language functions and link them with your C program.  The assembly used above can be the kernel code for these functions.  You simply need to know how to interface assembly with Borlannd's C++ 5.0 environment.

0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows how to make a Windows 7 gadget that extends its U/I with a flyout panel -- a window that pops out next to the gadget.  The example gadget shows several additional techniques:  How to automatically resize a gadget or flyout panel t…
A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question