How to use IO.DLL?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Gustavo.

I'm a complete newbie to PureBasic and I want to know how to use IO.DLL (see more details in http://www.geekhideout.com/iodll.shtml for C, Delphi and VB examples)
I'm only trying this because I did not find the usual Basic commands Inp(port) and Out port,value in PureBasic docs. Am I wrong? Does PureBasic have I/O commands?
Thanks for any help.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Num3.

No those commands are not directly implemented...

Download the Purefrog example from [url]http://www.purebasic.com,[/url] it has an unofficial port command...

--
Kind Regards
Rui Carvalho

Old programmers never die... They branch into a subroutine...
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by fredb.

Hi Gustavo,

I'm the developer of IO.DLL. Accessing it in PureBasic is pretty simple:

Result = OpenLibrary(#1, "IO.DLL")
CallFunction(#1, "PortOut", $378, 12)
value.b = CallFunction(#1, "PortIn", $378)
CloseLibrary(#1)

I have my IO.DLL in \WINNT\SYSTEM, but it will probably work in in your project's directory as well. I haven't tested this though.

In the above code, the first line opens IO.DLL, assigning it to ID #1. The second line calls the PortOut function, writing 12 to $378 (LPT1). The third line reads a byte from the port $378 and stores it in value.b. Note that it is necessary to suffix the variable with a ".b" to ensure that a byte is being read. Finally, line 4 closes the library.

Using the other functions of IO.DLL can be done in a similar manner.

I'm not a PureBasic expert by any means, in fact I never heard of it until this morning when I was checking the stats of my webpage and saw a link to your question here.

Hope this helps,

Fred
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Berikco.
Originally posted by fredb
Hope this helps,

Fred
Aaargghhh....another Fred :)

Where did i deserve this :)
Hope this one does not hit me all the time :)


Where is that IO.dll homepage?
Okay, i found it :)
Post Reply