delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/06/18/03:23:14

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" <alvin_lau AT yahoo DOT com>
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.


- Raw text -


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