delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/24/01:33:20

From: "Alexei A. Frounze" <alex DOT fru AT mtu-net DOT ru>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: Inline ASM
Date: Fri, 24 Mar 2000 08:18:31 +0300
Organization: MTU-Intel ISP
Lines: 42
Message-ID: <38DAFAA7.CC352387@mtu-net.ru>
References: <38daf59d AT news DOT integrityonline DOT com>
NNTP-Posting-Host: ppp97-64.dialup.mtu-net.ru
Mime-Version: 1.0
X-Trace: gavrilo.mtu.ru 953875140 88316 212.188.97.64 (24 Mar 2000 05:19:00 GMT)
X-Complaints-To: usenet-abuse AT mtu DOT ru
NNTP-Posting-Date: 24 Mar 2000 05:19:00 GMT
X-Mailer: Mozilla 4.61 [en] (Win95; I)
X-Accept-Language: en,ru
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Something like this:
--------------8<------------------
void putpixel (long x, long y, char color) {
  if (VGAAddr)
    *(VGAAddr+x+y2addr(y)) = color;
  else {
    __asm__ __volatile__ ("
      pushw   %%es
      movw    %3, %%ax
      movw    %%ax, %%es
      movl    %1, %%edi
      shl     $6, %%edi
      movl    %%edi, %%eax
      shl     $2, %%eax
      addl    %%eax, %%edi
      addl    %0, %%edi
      movb    %2, %%al
      stosb
      popw    %%es"
      :
      : "g" (x), "g" (y), "g" (color), "g" (VGA_sel)
    );
  };
}
--------------8<------------------

Better find and read the FAQ it's somewhere on the web:
http://www.delorie.com/dgjpp/doc/
http://www.rt66.com/~brennan/djgpp/bgtia.html
http://sag-www.ssl.berkeley.edu/~korpela/djgpp_asm.html
www.castle.net/~avly/djgpp.html

Good Luck

bobbi AT integrityonline DOT com wrote:
> 
> How do you do inline assembly code with DJGPP?
> -Scott

-- 
Alexei A. Frounze

- Raw text -


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