Mail Archives: djgpp/1996/03/06/17:46:50
A9>This is the code:
asm("
pusha
movl $0xa0000,%edi
movl _virt,%esi # virt declared somewhere
movl $32000,%ecx
movw _dos_seg,%es
cld
rep movsw
popa
")
How's this for more speed? The REP command will repeat the
string command immediately following it (MOVSW). I also shortened all
those push/pop operations into one pusha/popa command.. like 6 less
operations plus the loop should be a bit faster..
A9>Wait! One more thing (*stupid thing*) How can i get a random int from zero
A9>to a fixed value??? I don't know how to use the random functions in DJGPP!
A9>They talk about MAXINT, but i do not know what is that!
my_random_number = rand() % 100;
This gives me a number between 0 and 99. (Just add parenthesis
and add one to the value.. works ok for me... You may have to do a
randomize(); somewhere in the begining once to initialize the seed for
the random number.. I don't remember to clearly.. it's been a while)
Jonathan Tarbox
-----------------
battle DOT axe AT pegasuz DOT com
- Raw text -