Mail Archives: djgpp/1996/09/01/09:24:52
Xref: | news2.mv.net comp.os.msdos.djgpp:8149
|
From: | "Mark Gilbert" <mark DOT gilbert AT pop3 DOT hiway DOT co DOT uk>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | Assembler problem
|
Date: | 1 Sep 1996 12:48:12 GMT
|
Organization: | UUNet PIPEX server (post doesn't reflect views of UUNet PIPEX)
|
Lines: | 73
|
Message-ID: | <01bb9803$2adbeac0$89fa82c1@hiway.co.uk.hiway.co.uk>
|
NNTP-Posting-Host: | ak137.du.pipex.com
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
I have a limited understanding of assembler (so please don't shout at me).
This is an in-line asm routine from a platform game I'm making . . .
for(n=0;n<200;n++)
{
n3=((n+yoff) << 12) + ((n+yoff) << 10)+(n2-100);
asm(
"push %eax\n\t"
"push %ebx\n\t"
"push %ecx\n\t"
"push %edx\n\t"
"push %edi\n\t"
"push %esi\n\t"
"movl _imgbuffer, %esi\n\t"
"addl _n3, %esi\n\t"
"movl _doublebuffer, %edi\n\t"
"addl _n1, %edi\n\t"
"movl 0, %ecx\n\t"
"movl $0, %eax\n\t"
"movl $320, %ebx\n\t"
"movb $119, %edx\n\t"
"lint:\n\t"
"movb (%esi), %edx\n\t"
"cmpb 0, %edx\n\t"
"jne mints\n\t"
"mintsa:\n\t"
"addl $1, %eax\n\t"
"addl $1, %esi\n\t"
"addl $1, %edi\n\t"
"cmp %ebx, %eax\n\t"
"jne lint\n\t"
"pop %esi\n\t"
"pop %edi\n\t"
"pop %ecx\n\t"
"pop %edx\n\t"
"pop %ebx\n\t"
"pop %eax\n\t"
"mints:\n\t"
"movb %edx, (%edi)\n\t"
"jne mintsa\n\t"
);
n1+=320;
}
The level is a huge image (imgbuffer) that is well about 5120x600, whilst
the screen mode I'm using is standard 320x200 with 256 colours. This
routine copies a 320x200 segment from the imgbuffer to the doublebuffer
(64000 chars) whilst ignoring colour 119 to allow the background to show
through.
This routine is a little faster than the C equivalent I made. But it has
some major, major problems.
In Windows95 8 out of ten times I run it works perfectly but occasionally
when the games loads the colour it ignores changes for the hole session. I
simply don't understand this one at all. My C equivalent didn't do this.
When run in DOS via CWSDPMI it bombs out and gives a page fault as soon as
it gets to this assembler section. But when run through PMODETSR I don't
get a page fault but instead the bit that the assembler draws is all
corrupt.
I know that there's a lot to look at but could you please help me out.
Forgive me for having labels such as lint.
--
Mark Gilbert
mark DOT gilbert AT pop3 DOT hiway DOT co DOT uk
http://ourworld.compuserve.com/homepages/chris_gilbert_10/scissor.htm
- Raw text -