Mail Archives: djgpp/1996/09/18/21:17:42
> > Well, in as much as I understand 16 vs 32-bit assembly, the 'e*x'
> > registers
> > are simply 32-bit extended versions of the '*x' registers. So, %%ax is
> > in
> > actuality the lower 16 bits of %%eax. What you are trying to do is add
> > the register to itself, which I doubt will work.
> Actually, adding a register to itself just might work. But intel
> provides no opcodes to mix 16-bit and 32-bit registers in an
> instruction. Besides, even if such opcodes existed, the resulting
> algorithm would not be portable.
You can add a register to itself...its a great way to do a quick multiply.
(x 2). As for adding a 16 bit register to a 32bit one, what you could do is
make sure the top 16 bits of a 32 bit register are zeroed, and perform
an addl. using another register ie:
xorl %%ebx, %%ebx // 1 cycle
movw %%ax, %%bx // 2 cycles
addl %%ebx, %%eax // 1 cycle
Leathal.
- Raw text -