From: "Andrew Crabtree" Newsgroups: comp.os.msdos.djgpp Subject: Re: does anyone have anyideas on how to optimize this code Date: Fri, 14 Nov 1997 09:59:19 -0800 Organization: Hewlett Packard Lines: 42 Message-ID: <64i3hl$ko1$1@rosenews.rose.hp.com> References: <346C8822 DOT D3725C8E AT earthlink DOT net> NNTP-Posting-Host: ros51675cra.rose.hp.com To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Precedence: bulk STEVEN S. FALLS wrote in message <346C8822 DOT D3725C8E AT earthlink DOT net>... >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: Some quick suggestions. Comment your code. Use Defines for the arguments to the function and reference the stack based on those. Its easier to keep track of. You appear to be pushing and popping EBP for no reason. Looks like you started with compiler generated code which had a stack frame setup , and removed a portion of it but not all. Remove the push and pop and update the stack references.