delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/12/12/13:31:19

From: "PETER NORDLANDER" <peter DOT nordlander AT mbox301 DOT swipnet DOT se>
Newsgroups: comp.os.msdos.djgpp
Subject: Inline assembly question
Date: 12 Dec 1997 16:07:27 GMT
Organization: -
Lines: 26
Message-ID: <01bd0717$ffc6c1e0$3ca1f482@default>
NNTP-Posting-Host: dialup161-1-60.swipnet.se
NNTP-Posting-User: s-323400
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I've been coding in DJGPP for quite a while now. I've written all my GFX
functions, like put_pixel etc in inline assembly. The qestion is now,
please look at the fraction of code
provided in this message, is it a fast way to plot a pixel or could I
optimize it more by
using __djgpp_nearptr_enable and then use direct acces to videomem.
(SCREEN[offset]=col). 

put_pixel (int x,int y,unsigned char col)
{
asm ("
movw _dos_page,%%es			(dos_page is preloaded with _dos_ds)
movl $0xa0000,%%edi
addl %%ebx,%%edi
stosb
:
:"a"(col),"b"((y<<8)+(y<<6)+x)
:"%eax,"%ebx",%edi"
}

It this way of plotting a pixel the same as the farpokeb (...) version??

Thanks in advance
/Peter Nordlander


- Raw text -


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