delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/04/29/10:55:34

From: "nchuming" <nchuming AT magix DOT com DOT sg>
Newsgroups: comp.os.msdos.djgpp
Subject: Problem with following code
Date: Thu, 29 Apr 1999 22:33:48 +0800
Organization: Singapore Telecommunications Ltd
Lines: 28
Message-ID: <7g9qi5$9n4$1@mawar.singnet.com.sg>
NNTP-Posting-Host: ad130-110.magix.com.sg
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
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Can anyone help me with the following piece of code,
it seems the program generates a fault...
Thanks a lot

void putpixel(int x,int y,unsigned char color)
{
  int vid_descriptor;

  vid_descriptor = __dpmi_segment_to_descriptor(0xa000);
 __asm__ __volatile__
 ("
   movw _vid_descriptor,%%es
   xorw %%di,%%di
   movw %1,%%ax
   imulw $320,%%ax
   addw %0,%%ax
   addw %%ax,%%di
   movb %2,%%al
   stosb
 "
 :
 : "g" (x), "g" (y), "g" (color)
 : "di","ax","memory"
 );
}



- Raw text -


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