www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1996/05/26/02:49:18

Date: Sun, 26 May 1996 09:36:38 +0200 (IST)
From: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
To: Jamul <mhommel AT trumpet DOT aix DOT calpoly DOT edu>
Cc: djgpp AT delorie DOT com, Samuel Vincent <svincent AT cs DOT sonoma DOT edu>
Subject: Re: COM port access
In-Reply-To: <Pine.A32.3.91.960525151511.164082B-100000@trumpet.aix.calpoly.edu>
Message-Id: <Pine.SUN.3.91.960526093238.7733N-100000@is>
Mime-Version: 1.0

On Sat, 25 May 1996, Jamul wrote:

> init_rs232(); (this is done with inline asm, using the "int" instruction 
>   - is that bad?)

No, except that I'd suggest to first write it without inline assembly.  
The inline assembly facilities of Gcc are very powerful, but dangerous if 
misused and use conventions that are quite different from what you see in 
other DOS compilers.  Initialization is only done once, so why do it in 
assembly?

> while(1) {
>   if(status port says data_ready)
>     data=inportb(buffer port);
>   (when it comes time to send something) {
>     if(status port says xmission buffer clear)
>       outportb(buffer port, data to send);
>   }
> }
> 

This seems OK, but the bugs can be in the details.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019