X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: =?ISO-2022-JP?B?GyRCPi44UUBnGyhC?= Newsgroups: comp.os.msdos.djgpp Subject: Re: An interrupt drived uart program dead Date: Thu, 21 May 2009 06:49:07 -0700 (PDT) Organization: http://groups.google.com Lines: 26 Message-ID: <83605232-a7c9-4de6-98db-1f3122c14584@y33g2000prg.googlegroups.com> References: NNTP-Posting-Host: 58.38.4.123 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1242913747 26214 127.0.0.1 (21 May 2009 13:49:07 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Thu, 21 May 2009 13:49:07 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: y33g2000prg.googlegroups.com; posting-host=58.38.4.123; posting-account=qc6pEAoAAACyFixjIDHUvf8HsKSt31ce User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US) AppleWebKit/530.9 (KHTML, like Gecko) Chrome/2.0.180.0 Safari/530.9,gzip(gfe),gzip(gfe) To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com The bug is found. Rod Pemberton is right. The do-while loop in the commISR never exits. I miss a "break" statement after "txIdle = true;" in the do-while loop. the correct code block is follow: ------------------------------------------------------------------------------------------------------------------------------- do { if (queueSize > 0) { byte data = writeQueue[queueHead]; queueHead = (queueHead + 1) % QUEUE_CAPABILITY; queueSize --; outportb(baseAddress + OFFSET_THR, data); txIdle = false; } else { txIdle = true; break; // this statement missed so can't exit the do-while loop. } lsr = inportb(baseAddress + OFFSET_LSR); } while((lsr & (LSR_THRE | LSR_TEMT)) != 0); ------------------------------------------------------------------------------------------------------------------------------- Very thanks for everybody's help. All suggestion give me the good idea for the future develop in DOS. God bless you all ! :-D