NNTP-Posting-Host: news.hknet.com Newsgroups: comp.os.msdos.djgpp Date: Sat, 17 Jun 2000 03:36:43 -0400 Message-ID: <642A954DD517D411B20C00508BCF23B0012B16BA@mail.sauder.com> From: "Alvin Lau" Subject: Inline assembly code problem Lines: 26 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2014.211 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2014.211 X-Original-NNTP-Posting-Host: 202.67.174.238 X-Trace: 17 Jun 2000 15:46:51 +0800, news.hknet.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com 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) ); } Anyone can tell me why ? I saw same code appearing in some timer modules.