delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/06/15/22:00:36

From: gathers AT cyberdude DOT com (Gathers)
Newsgroups: comp.os.msdos.djgpp
Subject: Why dosn't my asm getpixel() work?
Organization: Green Dragon
Message-ID: <3766f436.5083819@nntpserver.swip.net>
X-Newsreader: Forte Agent 1.0/32.354
MIME-Version: 1.0
Lines: 48
Date: Wed, 16 Jun 1999 01:00:07 GMT
NNTP-Posting-Host: 130.244.102.170
X-Complaints-To: news-abuse AT swip DOT net
X-Trace: nntpserver.swip.net 929495101 130.244.102.170 (Wed, 16 Jun 1999 03:05:01 MET DST)
NNTP-Posting-Date: Wed, 16 Jun 1999 03:05:01 MET DST
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

I can't get the getpixel function here to work, but the putpixel under
it seems to work ok, can someone help me?

/Gathers

unsigned char mygetpixel(unsigned short seg,unsigned long add,unsigned
short x,unsigned short y)
{
unsigned char c;
asm("movw %1,%%ax\n\t"
    "movw %%ax,%%es\n\t"
    "xor %%ax,%%ax\n\t"
    "movw %2,%%ax\n\t"
    "xor %%bx,%%bx\n\t"
    "movw $0x140,%%bx\n\t"
    "mul %%bx\n\t"
    "addl %3,%%ax\n\t"
    "addw %4,%%ax\n\t"
    "movl %%ax,%%si\n\t"
    "lodsb\n\t"
    "movb %%al,%0\n\t"
    :"g="(c)
    :"g"(seg),"g"(y),"g"(add),"g"(x)
    :"ax","bx","memory"
);
return c;
}

void myputpixel(unsigned short seg,unsigned long add,unsigned short
x,unsigned short y,unsigned char c)
{
asm("movw %0,%%ax\n\t"
    "movw %%ax,%%es\n\t"
    "xor %%ax,%%ax\n\t"
    "movw %1,%%ax\n\t"
    "xor %%bx,%%bx\n\t"
    "movw $0x140,%%bx\n\t"
    "mul %%bx\n\t"
    "addl %2,%%ax\n\t"
    "addw %3,%%ax\n\t"
    "movl %%ax,%%di\n\t"
    "movb %4,%%al\n\t"
    "stosb"
    :
    :"g"(seg),"g"(y),"g"(add),"g"(x),"g"(c)
    :"ax","bx","memory"
);
}

- Raw text -


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