Mail Archives: djgpp/1999/08/01/12:01:55
From: | "Centrozity" <centrozity AT SPAMMENOT DOT tekkenking DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Intel - AT&T inline with DJGPP
|
Date: | Sun, 1 Aug 1999 23:41:45 +0800
|
Organization: | iiNet Limited
|
Lines: | 66
|
Message-ID: | <7o1psl$d46$1@news.iinet.net.au>
|
NNTP-Posting-Host: | reggae-17-240.nv.iinet.net.au
|
X-Newsreader: | Microsoft Outlook Express 4.72.3110.1
|
X-MimeOLE: | Produced By Microsoft MimeOLE V4.72.3110.3
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
My problem is simple, I currently have a set of mode 13h routines in C that
I use with all the programs( mostly poor quality and extremely small games )
that I write. One of my more recent projects had a rather choppy framerate,
so I optimised all my C code, including my 13h routines, but it didn't do
much good, I have never gotten into assembly too well but now it is looking
like my only way around this bottleneck.
The asm tutorials I found were all Intel format, and so with the help of an
additional Intel - AT&T FAQ I attempted to convert the asm routines into
inline(is that the correct term for when the asm is in the c file?) AT&T
ones that would compile with DJGPP.
Since I really have no idea what I'm doing to these functions, I decided
it's time to ask for help. The error I'm getting is 'Base/Index register
must be 32bit".
Here is one of the original asm functions:
void putpixel(int x, int y, char col)
{
asm{
mov ax,0a000h //ax = segment adress of the screen
mov es,ax //es = A000h
mov bx,y //bx = y
mov di,bx //di = y
xchg bh,bl //bx = 256*y
shl di,6 //di = 64*y
add di,bx //di = (256 + 64)*y = 320*y
add di,x //di = 320*y + x
mov al, col //move the colorbyte to al
mov [es:di],al // and move it to the screen
}
}
Not really understanding what any of that meant, I somewhat converted it to
AT&T, this is what I got:
void putpixel(int x, int y, char col)
{
asm(
"mov $0xA000,%ax \r
mov %ax,%es \r
mov y,%bx \r
mov %bx,%di \r
xchg %bl,%bh \r
shl $6,%di \r
add %bx,%di \r
add x,%di \r
mov col,%al \r
mov %al,%es[%di]"'''
);
}
I gathered the problem was with that last line, so i changed %di to %edi not
knowing what the difference between the two were( %edi was used on the
Intel - AT&T FAQ somewheres ) and it managed to compile, but then when
linking came along it threw some undefined references to (x, y, col) at me.
The FAQ had said something about having the input registers and "g" x,
etc... but all that means nothing to me.
Can someone help me out with this function?
Many thanks in advance.
H.
- Raw text -