access IO Ports?

Everything else that doesn't fall into one of the other PB categories.
Kazmirzak
User
User
Posts: 92
Joined: Fri Jun 18, 2004 5:44 pm
Location: Germany

access IO Ports?

Post by Kazmirzak »

How can I write a value in one of the computer's IO Ports?

In old dos basic languages it was simply done by "Out(port,value), where port was a value between 0 and 65000.

Under DOS I could achiever crazy things like with some random outs i could manage to get the computer making noises out of the soundcard without ANY driver! [and this was indeed a great thing under DOS]
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

Well, DOS allowed (and some times required) the programmer to do lots of things that modern OSes won't let you do directly, since more than one program could be trying to do the same thing. So... it's possible, but I'm certain you'd have to go through the OS's API (although you may be able to 'lock' access under some conditions). Have a look in the Win32.hlp file (look on Google) for information about port access.

Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
Froggerprogger
Enthusiast
Enthusiast
Posts: 423
Joined: Fri Apr 25, 2003 5:22 pm
Contact:

Post by Froggerprogger »

You might have a look at the port.dll and the inpout32.dll.
Both let you access the serial and/or parallel port as well as e.g. the PC-speaker-port in an easy way.
But playing these digitalized sounds over the pc-speaker in the way it was done under DOS is not possible any longer due to the modern OS.
There could be a way by giving your program realtime-priority.
%1>>1+1*1/1-1!1|1&1<<$1=1
Amiga5k
Enthusiast
Enthusiast
Posts: 329
Joined: Fri Apr 25, 2003 8:57 pm

Post by Amiga5k »

Actually, now that I think of it, there has to be a way to directly access the ports (or close to it), since my old Wacom tablet uses the serial port under XP with no problems. Sure, it was probably written in C (or perhaps asm because it is a driver), but it still works directly with the port.

Russell
*** Diapers and politicians need to be changed...for the same reason! ***
*** Make every vote equal: Abolish the Electoral College ***
*** www.au.org ***
Berikco
Administrator
Administrator
Posts: 1326
Joined: Wed Apr 23, 2003 7:57 pm
Location: Belgium
Contact:

Post by Berikco »

There is no way you can access IO ports directly under NT/W2K/XP/2003 without a device driver.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

Hi Berikco,

I have always wondered .. how is a driver accessed?


(The answer is probably so simple that I am going to wish I hadn't asked this).
@}--`--,-- A rose by any other name ..
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

Post by Psychophanta »

Here are some related threads:
http://www.purebasic.fr/english/viewtopic.php?t=18232
http://www.purebasic.fr/english/viewtopic.php?t=9316
http://www.purebasic.fr/english/viewtopic.php?t=2595

Dare2, drivers on WinNT, 2k, XP... patch and/or modify the NT kernel and/or the kernel shell.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
Post Reply