Mail Archives: djgpp/1996/05/12/08:56:05
Xref: | news2.mv.net comp.os.msdos.djgpp:3731
|
From: | 004277a AT news DOT acadiau DOT ca (Hafiz Awang Pon)
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | inline assmembly error problem
|
Date: | 12 May 96 05:46:04 GMT
|
Organization: | Dalhousie University
|
Lines: | 58
|
Message-ID: | <31957b1c.0@131.162.2.91>
|
NNTP-Posting-Host: | iceberg.acadiau.ca
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
i've got a couple question:
i) I've written this inline assembly procedure for drawing a groud shaded line
void gline(unsigned char *dest, int val, int step, int length) {
asm ("movw %0,%%dx":: "g" (step):"%dx");
asm ("movw %0,%%cx":: "g" (length):"%cx");
asm ("movl %0,%%edi":: "g" (dest):"%edi");
asm ("movw %0,%%ax":: "g" (val):"%ax");
asm ("grdagain: movb %ah, (%edi)");
asm ("addw %dx, %ax");
asm ("inc %edi");
asm ("dec %cx");
asm ("jnz grdagain");
}
I use this routine to draw to a screen buffer which later will
be copied to the screen. On my previous version of (written
in djgppv1) the program it works. My question is when compiled,
it gives the error that the opcode is not understood(operands
dont't match any 386 instructions, symbol grdagain already
defined, etc). The thing is (this question might be relevant
or not to answer the question). When the program is compiled
without any part of the program using that procedure, no
error is reported. But when compile with a program that
uses it such as
gline(&((*v).line[y][x1]), colorvalue, step, length);
it gives the previously mentioned error. What basically i'm
attempting to do is to use the allegro library, so that
my engine will also have svga capabilites. My first hunch
was that maybe such manipulation is not allowed but when i test
the same method on my flat shaded line drawing procedure;
void bstore(unsigned char *dest, unsigned char val, int size) {
asm ("cld");
asm ("movl %0,%%ecx":: "g" (size):"%ecx");
asm ("movb %0,%%al":: "g" (val):"%al");
asm ("movl %0,%%edi":: "g" (dest):"%edi");
asm ("rep");
asm ("stosb %al, (%edi)");
}
bstore(&((*v).line[y][x1]), polyc, (x2 - x1 + 1));
it works. This is a very confusing problem. I spend nights
trying to get around it but to no avail. I need to get this
procedure to work because it's a very crucial part of my
engine. I also have an inline procedure which draws a textured
line but i don't dare to test it yet until this problem is solved
thanks in advance
004277a AT dragon DOT acadiau DOT ca
http://dragon.acadiau.ca/~004277a
- Raw text -