Mail Archives: djgpp/2000/06/17/04:58:52
From: | "Alvin Lau" <alvin_lau AT yahoo DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Inline assembly code problem
|
Date: | Sat, 17 Jun 2000 15:36:43 +0800
|
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
|
Message-ID: | <394b2954@newsgate.hknet.com>
|
NNTP-Posting-Host: | news.hknet.com
|
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.
- Raw text -