Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Question for Eugene Nalimov

Author: James Robertson

Date: 14:35:26 12/21/98

Go up one level in this thread


On December 21, 1998 at 15:58:12, Bo Persson wrote:

>On December 21, 1998 at 12:16:49, James Robertson wrote:
>
>>I was recommended to you as someone who is good with x86 register programming.
>>
>>I am writing a function of my program in assembly, and I have run out of
>>registers; I have already used eax, ebx, ecx, edx, esi, and edi; and I need
>>one more. Unfortunately, esp, eip generate errors "improper operand type".
>>My function looks kinda like this:
>>
>>MyFunction(MoveList ml)
>>{
>>	__asm
>>	{
>>		//and I would like to put:
>>		mov	eip,[ml]
>>	}
>>}
>>Compiler: &%^*$ Improper operand type.
>>
>>I am using VC++ 5.0 under Win95, with a Win32 console program. Please help!
>>
>>James
>
>Hi, James!
>
>Welcome to x86 programming, never enough registers!  :-)
>
>   mov     eip,[ml]
>should be coded as
>   jmp     [ml]
>
>Seriously, the EIP register points to the next instruction and can not be used
>as a general purpose register.
>
>Depending on the enviromnent you might be able to use the EBP register, but I
>think VC++ often uses that for local stack frame reference.
>
>Try to rearrange your code to save a register or push one on then stack and pop
>it later.
>
>
>Bo Persson
>bop@malmo.mail.telia.com

Darn. No more registers!? How fast is stack pushing and popping? For instance,
would

mov     esi,[ml]
....
push    esi
....
pop     esi
....

be faster than

mov     esi,[ml]
....
mov     esi,eax
.....
mov     esi,[ml]

?
Thanks for you help!

James



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.