Mail Archives: djgpp/1996/10/21/18:39:52
Mohan Khurana (mohan AT stealth DOT net) wrote:
:
: I am not very good with ASM, can you show me some source?
:
: What does rep stosl do?
Ok here's a short example for you
__asm__ __volatile__ ("
movw %0, %%es
movl $0xA0000, %%edi
movl %1, %%eax
movl $0x4000, %%ecx
rep
stosl"
:
: "g" (_dos_ds), "g" (Packed)
);
This code will fill one page of the screen when when in 256 color mode.
The packed varaible is the color byte (0-255) repeated four times in a
word. (0x3D => 0x3D3D3D3D). The stosl command simply stores the DWORD
located in the eax register, into the memory pointed at by es:edi. The rep
command means that this operation should be repeated however many times as
the ecx registers says.
If you don't understand this, I recommend the ASM tutorials on the AT&T
syntax that are available on the web at:
http://remus.rutgers.edu/~avly/djgfx.html
If assembly simply doesn't appeal to you at all, you can get around the
problem by using the dosmemput command, but that would be slower i guess.
It depends on what kind of operations you are dong. If it is graphics, and
videomemory access, i recommend you learn the assembly stuff
Have fun.. :-)
--
Olav Kindt | email: oak9755 AT silver DOT sdsmt DOT edu
737 E. Anamosa Street #103 | xedb_oak AT debet DOT nhh DOT no
Rapid City SD-57701 | MAIL me man.......
- Raw text -