Mail Archives: djgpp/1996/12/06/16:00:26
From: | lonniem AT mail DOT utexas DOT edu
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Inline Assembly
|
Date: | Fri, 06 Dec 1996 21:49:10 GMT
|
Organization: | The University of Texas at Austin, Austin, Texas
|
Lines: | 52
|
Message-ID: | <589tcn$8lj@geraldo.cc.utexas.edu>
|
NNTP-Posting-Host: | slip-a-7.ots.utexas.edu
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I'm doing some VESA stuff for maybe use in a GUI later. I don't know
I'm basically just messing arround with it. I've got all the VBE
functions encapsulated in a class plus some extra things of course
like BitBlt and DrawLine (). I am in the process of converting all
the time critical portions into inline asm but when I got to the
BitBlt, the first one to be asm'ed, I could not get movl's to work at
all. I am using movsl to copy the image 32-bits at a time per each
scanline then mov'ing the extra number of bytes into ecx then doing a
movsb to handle the extra pixels. Heres the code
void GraphicsInterface::BltImage (int nX, int nY, int nWidth, int
nHeight, unsigned char* pSource)
{
int pVideoMemory;
int nNumberOfTimes;
int nNumberOfMoves = nWidth / 4;
int nExtraMoves = nWidth % 4; // moving longs at a time
pVideoMemory = nVideoMemory + __djgpp_conventional_base;
pVideoMemory += nY * nXResolution + nX;
for (int lcv = 0; lcv < nHeight; lcv++)
{
asm ("cld \n\t"
"rep \n\t"
"movsl \n\t"
"movl %eax, %ecx \n\t" // this will not work
"rep \n\t"
"movsb \n\t"
: // no outputs
: "a" (nExtraMoves),
"c" (nNumberOfMoves),
"S" (pSource),
"D" (pVideoMemory)
: "%eax", "%ecx", "%esi", "%edi");
pVideoMemory += nXResolution;
pSource += nWidth;
}
}
GXX issues the error:
svga.cpp:199: invalid 'asm': operand number missing after %-letter
svga.cpp:199: invalid 'asm': operand number missing after %-letter
The code works if I comment out the line with the movl %eax, %ecx but
of course does not output any extra bytes over the width / 4. I'm
using DJGPP v2.0.
Thanks for any help.
Lonnie McCullough
lonniem AT mail DOT utexas DOT edu
- Raw text -