Re: Hexadecimal words



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Kjeld Jacobsen wrote:
[snip]
> Hi Alex
>
> ;Code to shift dx:ax 4 bits left on any x86 CPU
>
> shl ax,1 ;Shift ax 1 bit left, into carry
> rcl dx,1 ;Shift carry left into dx bit 0
>
> shl ax,1
> rcl dx,1
>
> shl ax,1
> rcl dx,1
>
> shl ax,1
> rcl dx,1
>
> ;Result, dx:ax shifted 4 bits left
>
>
> Regards
> Kjeld Jacobsen
>


Hi,
If you can assume the upper 16 bits are zero initially (as you can
here), then this code works without having to clear DX, and it's shorter:



mov dx, ax
shl ax, 4
shr dx, 12



Chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (MingW32)

iD8DBQFC6X4v6ZGQ8LKA8nwRAhFeAKC+xOfL/WQqeW5amAYxY48v32iwLACeLCvd
09ms3JM4c2872NYGEwH2G6E=
=xlkT
-----END PGP SIGNATURE-----

.



Relevant Pages