Mail Archives: djgpp/1998/10/11/08:31:35
][v][]2. ][) wrote:
> Maybe you people get questions like these lots of times, I don't
> know 'cause I'm new to this group, but let's have a go at it anyway. =)
> Maybe someone can
> translate this piece of code for me? Pretty please? =)
> Here goes:
> push ds
> mov cx, double_buffer_size
> les di, video_buffer
> mov ax, 320
> mul y
> add di, ax
> lds si, buffer
> rep movsw
> pop ds
asm ("mull %3;" "addl %%eax, %%edi;"
"rep;"
"movsw;"
: : "c" (double_buffer_size), "D" (video_buffer), "a" (320), "m" (y), "S"
(buffer)
: "%edi");
I think that will do what you asked, but it would be better to use a
"movsl" to do 32-bit moves. There may be problems with that code, I did not
test it.
It is not hard to convert. First, swap the order of the parameters to
your opcodes. Then prefix all register names with "%%", then postfix all
opcodes with the size of the operands (b=byte, w=word, l=long). You can't
access non-global variables directly from asm. You can ask to have them
loaded into special locations. I've had double_buffer_size loaded into ECX,
video_buffer loaded into EDI, y loaded into memory. I can address those
parameters as %0,%1,%2,%3,... Segments are now called selectors and they work
differently. My code assumed that you had turned off memory protection
(discussed in the FAQ). If you haven't, then you will have to make your own
selector (also discussed in the FAQ) and move it into DS.
>
>
> Okay, maybe you need these: buffer and video_buffer are char *'s,
> double_buffer_size is an integer, and so is y.
> Is there, by the way, some sort of document that contains most
> (all?) of the old asm commands, and states the DJGPP equivalents next to
> it? Perhaps it's a nice idea for someone to make it? (I would like to do
> it, sure, but I don't get it yet =)
> Thanks for any help,
>
> Jan-Jaap
--
(\/) Endlisnis (\/)
s257m AT unb DOT ca
Endlisnis AT GeoCities DOT com
Endlisnis AT BrunNet DOT Net
- Raw text -