DPRG
DPRG List  



DPRG: Accessing the Parallel Port from BCB 1.0

Subject: DPRG: Accessing the Parallel Port from BCB 1.0
From: J. Reeves Hall reeves at earthling.net
Date: Sun Aug 15 22:13:33 CDT 1999

Elliot Johnson wrote:

> I am having trouble accessing the parallel port from borland c++ builder 1.0.   I can't find any library functions to do it.  I have tried this assembly code
>
> asm mov dx, Port
> asm mov al, Value
> asm out dx,al
> asm pop dx
>
> But i always get a linker error and have to restart borland before it will be able to compile again with the assembly code commented out.  any help would be appreciated, I managed to get my hands on a very basic very small lathe and wrote some nice control software to run the two stepper motors that run it. Its all finished except for this most important part of writing to the parallel port.
>
> later,
> Elliot

This would be my first attempt:
asm {
    mov dx, word ptr [port]
    mov al, byte ptr [val]
    out dx,al
};

There might be an outportb() function; there used to be. Inline assembly is messy (except in Turbo Pascal, which did an exceptionally good job of it). I once wrote an extension for Tcl/Tk to allow direct port access from scripts (without using assembler), so I know it can be done under Windows. I was using Visual C++.

BTW I do fully intend to send you a check for the Boelube - I'm sorry it's taking so long!

- -Reeves

------------------------------

More information about the DPRG mailing list