Archived

This topic is now archived and is closed to further replies.

cococool

Need help on I/O access!

Recommended Posts

cococool    122
I''m a Delphi user. And I am developing a 3D game using a electronic device (something similar as a Joystick) made by myself as the input device via the Joystick/MIDI port. Don''t tell me to try something like DirectInput, etc, instead, I need a hardware-level method to read the exact value of the port, which reflects the analog signal being inputted. But I''m not sure how to do this in Delphi (I know that in Turbo Pascal 6.0 PORT[] is used to access the port). Please help if you know it. Thanx in advance!

Share this post


Link to post
Share on other sites
Dean Harding    546
If you''re using Windows 2000 (or any NT-based kernel), then you''ll need to write a device driver for accing the hardware, since user-mode programs are not allowed access to the I/O ports. This is quite an undertaking, and shouldn''t be taken lightly. If you''re interested, download the DDK (driver developement kit). I''m not sure if you''ll have any luck compiling device drivers in delphi (it would require a delphi SDK, which you''re probably not going to find.)

Under Windows 95/98/ME, you can still directly access the I/O ports from a user-mode program, so if you can write assembly, you just need to use the "in" and "out" instructions. Again, I don''t know if delphi has inline assembly, but my guess is "probably not"...

I think you should consider writing at least the driver for your input device in C, because delphi was never meant to access low-level stuff like this (heck, even C wasn''t designed to access low-level stuff like this, but at least you got better libraries and inline assembly to help you).


codeka.com - Just click it.

Share this post


Link to post
Share on other sites