Board index » delphi » Accessing LPT hardware port from Delphi2

Accessing LPT hardware port from Delphi2

Hello All!

I know this isn't normally possible, that it requires a VxD or some tricky
coding :) But I need this very much for a project of mine.. SInce the resulting
product will be released as freeware, I can't spend very much money on this.
Despite this fact, I'm looking for some way to do this.. What I'd like is
ideally someone with enough knowledge in C/C++ and the DDK to whip up this kind
of thing. Is there anyone suiting this description out there? I could pay for
this, but not the $5000 one person asked :(

Best regards,
   Christian // ctib...@silver.ct.se

.. The best vacations are spent near the budget.

 

Re:Accessing LPT hardware port from Delphi2


Quote
christian.tib...@silver.ct.se (Christian Tiberg) wrote:
>Hello All!
>I know this isn't normally possible, that it requires a VxD or some tricky
>coding :) But I need this very much for a project of mine.. SInce the resulting
>product will be released as freeware, I can't spend very much money on this.
>Despite this fact, I'm looking for some way to do this.. What I'd like is
>ideally someone with enough knowledge in C/C++ and the DDK to whip up this kind
>of thing. Is there anyone suiting this description out there? I could pay for
>this, but not the $5000 one person asked :(
>Best regards,
>   Christian // ctib...@silver.ct.se
>.. The best vacations are spent near the budget.

There is a company called Bluewater something that markets WinRt which is
something that is supposed to solve the hardware access problems in 32 bit
Windows systems (NT & 95). It's not $5000 but it is not free!
Check out:
http://www.bluewatersystems.com/winrt.htm

And Christian: if you get hold of any free- or shareware please tell me
about it :-)

Re:Accessing LPT hardware port from Delphi2


In article <ftn_2.200.602.0_1ab8a100_Christian.Tib...@silver.ct.se>
           christian.tib...@silver.ct.se "Christian Tiberg" writes:

Quote
> Hello All!

> I know this isn't normally possible, that it requires a VxD or some tricky
> coding :) But I need this very much for a project of mine.. SInce the resulting
> product will be released as freeware, I can't spend very much money on this.
> Despite this fact, I'm looking for some way to do this.. What I'd like is
> ideally someone with enough knowledge in C/C++ and the DDK to whip up this kind
> of thing. Is there anyone suiting this description out there? I could pay for
> this, but not the $5000 one person asked :(

> Best regards,
>    Christian // ctib...@silver.ct.se

> .. The best vacations are spent near the budget.

Try Just coding the access to the port hard into your code!
I suggest:
asm
 out 278h, Value
end;

Otherwise I may be able to whip up a 16bit DLL, but I can't help you
re: 32bit ones, as I currently do not yet own Delphi!

--
News Reader Silverstone

Re:Accessing LPT hardware port from Delphi2


News Reader Silverstone <NewsT...@seaquest.demon.co.uk> wrote:

Quote
>Try Just coding the access to the port hard into your code!
>I suggest:
>asm
> out 278h, Value
>end;

I can usually figure these things out, but am having problems, I try
the above code and get an 'Error 155: Invalid combination of opcode
and operands, '

No matter what I try I seem to get this, I don't have any documentaion
on the 'out' function, unless I am looking in the wrong places, I
can't find an answer in the Turbo Assembler manual, Any ideas???
Please??

Re:Accessing LPT hardware port from Delphi2


Quote

> I know this isn't normally possible, that it requires a VxD or some tricky
> coding :) But I need this very much for a project of mine.. SInce the

NRS> Try Just coding the access to the port hard into your code!
NRS> I suggest:
NRS> asm
NRS>  out 278h, Value
NRS> end;

Oh WOW, was it that simple :) I didn't even TRY to code in assembly, since I
was sure they had removed it from the Asm too.. Many Thanks!

Best regards,
   Christian // ctib...@silver.ct.se

.. Where are we going? And why are we in this handbasket?

Re:Accessing LPT hardware port from Delphi2


In article <4oqfup$...@news.mind.net>, From stuco...@mind.net (Stuart
Cotts), the following was written:

Quote
> No matter what I try I seem to get this, I don't have any documentaion
> on the 'out' function, unless I am looking in the wrong places, I
> can't find an answer in the Turbo Assembler manual, Any ideas???
> Please??

When using a port address larger than FFh, the port address must be
stored in the DX register. Also, the value to be written must be stored
in the AX or AL register.

So instead of

Quote
>> asm
>> out 278h, Value
>> end;

use this:

asm
  mov  dx, 278h
  mov  ax, Value
  out  dx, ax
end;

Cheers, Andre

--
Andre M. Naef
n...@sprynet.com
http://ourworld.compuserve.com/homepages/naef

Re:Accessing LPT hardware port from Delphi2


Quote
Stuart Cotts wrote:

> News Reader Silverstone <NewsT...@seaquest.demon.co.uk> wrote:

> >Try Just coding the access to the port hard into your code!
> >I suggest:
> >asm
> > out 278h, Value
> >end;

> I can usually figure these things out, but am having problems, I try
> the above code and get an 'Error 155: Invalid combination of opcode
> and operands, '

> No matter what I try I seem to get this, I don't have any documentaion
> on the 'out' function, unless I am looking in the wrong places, I
> can't find an answer in the Turbo Assembler manual, Any ideas???
> Please??

Hi

There seems to be a lot of people trying to access I/O using Delphi 2 that are having
problems now that the Port and PortW commands have been deleted.

If you need to output to the LPT port try the following bit of code (I've used it to
switch bits on and off to drive hardware through the parallel port and it works fine).

Its worth noting the StdCall directive. The optimization feature of Delphi 2 uses
registers to pass info to the procedure, messing up the values in the assembler
routine. StdCall forces normal stack passing and makes it all work properly.

Procedure PortOut(IOPort : Word; Value : Byte); Assembler; StdCall;
Asm
   MOV AL, Value
   MOV DX, IOPort
   OUT DX, AL
End;  { PortOut }

where IOPort is $378 for the first Parallel port.

Regards

Denham

Other Threads