Author: Eugene Nalimov
Date: 13:45:03 01/27/99
Go up one level in this thread
On January 27, 1999 at 15:40:06, James Robertson wrote: >On January 27, 1999 at 15:00:37, Eugene Nalimov wrote: > >>On January 27, 1999 at 14:50:59, James Robertson wrote: >> >>>On January 27, 1999 at 01:32:28, Eugene Nalimov wrote: >>> >>>>On January 26, 1999 at 22:38:37, James Robertson wrote: >>>> >>>>>Once again I show my absolute ignorance of assembly with these two questions: >>>>>I am trying to acces the 3rd [+ 4th] byte of a register. How? E.g., what is next >>>>>after al, ah, ? >>>>>How do I pop something off the stack without moving the stack pointer? >>>>> >>>>>Thanks, >>>>>James >>>> >>>>1. Use shift instruction. E.g. >>>> shr eax, 16 >>>> mov byte ptr [esi], al >>>> You can also use rotate instruction (it'll not destruct >>>> other bytes): >>>> ror eax, 16 >>>> mov byte ptr [esi], al >>>> ror eax, 16 >>>> But if I remember it correctly, rotate is worse than shift >>>> (cannot be executed in parallel) on both Pentium and P6 family. >>>>2. mov reg32, dword ptr [esp] >>>> >>>>Eugene >>> >>>Ok.... that would work. Because I already have stuff stored in ax, and I know >>>the exact values I want to put into the 'e' part, I wrote: >>> >>>or eax,0xeeee0000 >>>and eax,0x0000ffff >>>or eax,0xeeee0000 >>> >>>where eeee=what I want to put in. This seems to work. Are there any problems I >>>am missing? >>> >>>James >> >>First instruction is unnecessary - one "and" and one "or" will >>be enough. >> >>Also, try to use 32-bit values instead of 16-bit values where >>possible. 16-bit operations are more expensive than either 8-bit >>or 32-bit. > >I'm confused. Aren't these 32 bit values? > >James > >> >>Eugene Yes, those values are all 32-bit. But you wrote "stuff already stored in ax", so I guessed that you made so using instruction that operates with 16-bit values. That instruction is usually worse than instruction that operates with all 32 bits. One more hint (as you still refusing to read documentation): if you used 16-bit move to load ax, or if you done that using 2 8-bit moves, and then immediately (less than 20 instructions later) try to use eax as a whole, than P6/PII will stall for up to 10 CPU clocks before executing those instructions (there are some exceptions to that rule - you can read about it Intel manuals). Eugene
This page took 0.01 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.