Mail Archives: djgpp/1997/11/29/21:47:36
STEVEN S. FALLS <ELN/broadview AT earthlink DOT net> wrote in article
<346C8822 DOT D3725C8E AT earthlink DOT net>...
> Hi, my name is Ardy and I have a pixelplotting ruteen that needs to be
> optmized. This is what I got, please help!
> thanks,
> -Ardy
>
> This was writen in NASM:
>
> BITS 32
> GLOBAL _SetPix__Fiic
> GLOBAL _SetPixRam__Fiic
> GLOBAL _GetPix__Fii
> GLOBAL _GetPixRam__Fii
> GLOBAL _ClearPg__Fv
> GLOBAL _ClearPgRam__Fv
> GLOBAL _CopyPg__Fv
> GLOBAL _Line__Fiiiic
> EXTERN __go32_info_block
> EXTERN _YTbl
> EXTERN _RamPg
>
> SECTION .text
> _SetPix__Fiic:
> push ebp
> mov edx,[_YTbl]
> mov ebx,[esp+12]
> mov ebx,[edx+ebx*4]
> add ebx,[esp+8]
> mov al,[esp+16]
> mov fs,[__go32_info_block+26]
> add ebx,0A0000h
> mov [fs:ebx],al
> pop ebp
> ret
> _SetPixRam__Fiic:
>
Ok, that was original, here's one with suggestions.
BITS 32
GLOBAL _SetPix__Fiic
GLOBAL _SetPixRam__Fiic
GLOBAL _GetPix__Fii
GLOBAL _GetPixRam__Fii
GLOBAL _ClearPg__Fv
GLOBAL _ClearPgRam__Fv
GLOBAL _CopyPg__Fv
GLOBAL _Line__Fiiiic
EXTERN __go32_info_block
EXTERN _YTbl
EXTERN _RamPg
SECTION .text
_SetPix__Fiic:
push ebp
mov edx,[_YTbl]
mov ebx,[esp+12]
mov ebx,[edx+ebx*4] // Look below
add ebx,[esp+8]
mov al,[esp+16]
mov fs,[__go32_info_block+26]
add ebx,0A0000h
mov [fs:ebx],al
pop ebp
ret
_SetPixRam__Fiic:
I don't know if GCC will take care of this, but it appears that you're
multiplying ebx by 4. You can simply do this
shl $2, %ebx // what should be AT&T format
I don't know if that's the correct syntax (I'm used to Intel format), so if
you get an error, just try
shl %ebx, $2 // format used by Intel
That will do it in 1 clock cycel on a 486, as opposed to 10-50(about)
clocks on a 486. You might try that and see if that helps you at all.
-Steve
- Raw text -