TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: SERKAN KENAR
from: BRIAN MCCLOUD
date: 1998-02-05 05:36:00
subject: Extended Registers

SK>What is the best way of getting the high word of EAX ?
I can think of several ways of doing that, but I am uncertain which you would
consider the "best" way...  Here's a few ideas for moving the high word of 
AX
into AX:
1.      SHR     EAX, 16
2.      PUSH    EAX
        POP     AX
        POP     AX
3.      BSWAP   EAX     ; 486+ only
        XCHG    AL, AH
4.      ROR     EAX, 16
   (or) ROL     EAX, 16
5.      SHRD    EAX, EDX, 16    ; EDX can be changed to another register
                                ; if desired... only the new high word of EAX
                                ; will be affected
6.      MOV     [mem], EAX
        MOV     AX, WORD PTR [mem+02]
7.      PUSH    DS
        PUSH    ES
        POP     DS
        MOV     SI, DI          ; assuming ES:[DI] points to valid memory
        STOSD
        LODSW
        LODSW
        POP     DS
I suspect there are more possibilities, but I'll leave it at that for now.
((Cloud))
MauveCloud@juno.com
 * OLX 2.2 * I'm in shape ... round's a shape isn't it?
--- PCBoard (R) v15.3/M 10
---------------
* Origin: Next time, Dial The Wrong Number! (209) 943-1880 (1:208/205)

SOURCE: echomail via exec-pc

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.