Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
Using IN and OUT assembly Inline in Borland C 5+
I've discovered that when BCC32 passes the assembly code to the assembler, it deletes all "IN" and "OUT" words, therefore if you type "OUT DX, AL", the assembler will see "DX, AL" and give an error. This is to discourage people from directly accessing ports in Windows. To get around this use the actual machine code as follows:
use "DB 0xEE" instead of "OUT DX, AL"
use "DB 0xEC" instead of "IN AL, DX"
You should find that it works fine. It should fix similar problems in other Compilers as well.
Unfortunately, in NT/2000 and probably XP, I'm not sure, you'll need to use a program like [italic]UserPort[/italic] to allow access to the port you're trying to use.