Mail Archives: djgpp/1997/09/08/09:50:56
JL> movl %2, %%ecx ; load ecx with second x2 coord
JL> movb %%al, %%es:(%%edi) ; move the color, i originally had this
JL> at the very end after stosb
JL> subl %1, %%ecx ; subtract the x values, I'm gonna check this....
JL> incl %%ecx ; increment counter
jz finished
JL> testl $1, %%edi ; test for odd number address (help!?? :)
jz Even ; instead of
JL> loopz Even ; jump to even if on even address (?)
JL> stosb
JL> decl %%ecx ; decrement the counter
JL> Even:
JL> shr $1, %%ecx ; from my real mode tutorial; what is this? :)
; when you use stosw you put 2 pixels at time (rep
stosw == 2 x rep stosb so you need two things. a) counter - ecx divide by two,
b) you have to have color in ah and al either. so do here i.e. imulw $0x0101,
%%ax
JL> rep
JL> stosw
JL> adc $0, %%ecx ; ditto
JL> rep
JL> stosb
finished:
JL> ;orginally movb'd the color here..."
JL> : /* no output */
JL> : "g" (_dos_ds), "g" (x1), "g" (x2), "g" (y),
JL> "a" (color), "D" (0xA0000)
JL> : "eax", "ebx", "ecx", "edi"); }
Tip to do your code faster - use movl %%eax, (%%edi) instead of using 16bit
stosw
Another tip. Use imul instead of shifts or look up tables, it is faster on
pentium. (I've tested it. imul takes only 2 clocks!, when in pipe)
Thnx & see ya,
Luke
- Raw text -