Hi all,

I am new to this forum, so please excuse me if my question is off topic or has been discussed previously.

I have developed many applications for windows using Visual studio.  Now I need to develop a console (no Windows) application for communicating two pcs via serial port usign pure assembler.  The application must have some graphical interface for showing serial data in a tabular form.

Can some one point me in the right direction.  Where can I find asm code examples for serial communications and display handling. Can I develop this application using MASM? Or what is the recomended compiler for this?

Tanks a lot for your kinldy help!

John
Posted on 2006-05-04 14:33:33 by John Vargas
Lo,

i am currently still working on some other project. but eventualy i also want to do something whit my serial ports, i am thinking about building something outside the PC, which is controlled through my serial port.

i would look for the following: The Art of Assembly (PDF-book)
Chapter 22, it covers the Serial port

you should also get Ralf Brown's interupt and port lists. it covers a lot of stuf.


but you got 1 problem, since i dont know if windows will allow you to write directly to the Serial ports, so you will probely need to boot whit some old Dos diskette, then u can also use simple Dos int's (functions) to display stuff on the screen.

it can be written in any asm, so also masm (i am coding an OS in masm, so u should be able to program the serial port whit it :P ). but u will need to be able to write some Dos-Exe file, if u are booting whit Dos.


If u got anything which works, please post it here, cause i also need to use the serial port in the future, as explained above


Regards.
PyroMathic
Posted on 2006-05-12 04:13:48 by pyr0_mathic
Use CreateFile to open access to the serial port (set the file name to the port name, e.g. "COM1").
Next, setup the internal buffer sizes, using SetupComm.
Now you might want to set some options (like baud rate), so use GetCommState/SetCommState.
The last setup thing to do is to set the timeouts, use GetCommTimeouts/SetCommTimeouts for that.

After this, you can use ReadFile and WriteFile for communications (using blocking or non-blocking calls, whatever you like - just like using a file... I would use overlapped IO, even though it is more complex... it means the thread can be doing somethign else at the same time... tho maybe for a console app, this wont be needed)

Finally, just use CloseHandle to close the connection

Ossa

PyroMathic - you're right, you can't use interrupts under windows... you MUST use the API
Posted on 2006-05-12 04:34:21 by Ossa
Ossa's way is probably the best way to do it for windows programming - clean and portable, and can be done the same way whether you implement it in assembly or a HLL.

By the way, is this some school project? If so, your teacher might have some special requirements.
Posted on 2006-05-12 09:44:01 by f0dder