From: Prashant TR Newsgroups: comp.os.msdos.djgpp Subject: Re: Inline assembly code problem Date: 17 Jun 2000 22:05:49 +0530 Organization: VSNL Lines: 31 Message-ID: References: <394b2954 AT newsgate DOT hknet DOT com> NNTP-Posting-Host: ppp-181-225.bng.vsnl.net.in X-Trace: news.vsnl.net.in 961297649 21227 203.197.181.225 (18 Jun 2000 03:07:29 GMT) X-Complaints-To: postmaster AT news DOT vsnl DOT net DOT in NNTP-Posting-Date: 18 Jun 2000 03:07:29 GMT X-Newsreader: Gnus v5.7/Emacs 20.5 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Alvin Lau" writes: > When I run the following code, my computer will halt and sometimes will > reboot automatically: > > int main(void) > { > unsigned factor=4; > unsigned short rate=1193180/(18*factor); > // speed up timer > asm ( > "cli\n" > "movb $36h,%%al\n" > "outb %%al,$43h\n" > "movw %0,%%ax\n" > "outb %%al,$40h\n" > "movb %%ah,%%al\n" > "outb %%al,$40h\n" > "sti\n" > : > :"m"(rate) > ); > } > I don't see anything wrong here. Perhaps another portion of the code in your program is causing the problem. And also, if you're using Allegro or some other program which hooks interrupts, this _maybe_ be the reason. Prashant