News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Sending and Reading from a COM port.

Started by GODlike, May 29, 2005, 09:52:35 AM

Previous topic - Next topic

GODlike

I have successfully made a 16bit program for COM communication using BIOS's "int 14h". Now I want to make the same thing using MASM32. I've used the "int 14h" but I get runtime error. I've also used the command "in" and the "out" but I still get runtime error.

My question is how to read and receive from a COM port using MASM32 and if possible without using WIN32 API's functions??



Thanks!!

Tedd

In Win32 you're not allowed direct access to the Ints :P You're not allowed access to ports with in/out either :bdg
Look for functions with "comm" in their name - eg. "CommConfigDialog", "GetCommState", "SetupComm", "TransmitCommChar", etc
I think you need to get an id for the device, and then open it with CreateFile. You can then use the handle returned to access it.
No snowflake in an avalanche feels responsible.

AeroASM

DOing anything without using the Win32 API functions is impossible. I suggest you do what Tedd suggested.

However if you want to confuse yourself then download the KMD Kit and look at the giveio.sys driver as a way to give your program direct access to the in/out commands.

farrier

For the FAQ and GODlike (?):

Use the following link to set up the Com Port

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/configuring_a_communications_resource.asp

Then use the WriteFile and ReadFile function with the hCom handle created in the above link.  This works fine and requires no special drivers.  The CreateFile, WriteFIle, and ReadFile functions work fine for the parallel ports also.

farrier
It is a GOOD day to code!
Some assembly required!
ASM me!
With every mistake, we must surely be learning. (George...Bush)

Mark Jones

That is good to know, thanks Farrier. :bg
"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

GODlike

Thanks for the support :U. I will try this and I'll post the results.