TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: CHRIS BERKHOUT
from: CAMERON CLARK
date: 1997-12-22 14:48:00
subject: Re: Moving things in ASM

CB> mov     ah,b[var]
CB> mov     al,b[var+1]
CB> var     dw      0102Fh
CB> 
CB>         AX = 0102Fh, but with this:
CB> 
CB> mov     ax,w[var]
CB> var     dw      0102Fh
CB> 
CB>         AX = 0201h, aren't they meant to do the same thing ?
    The x86 machines are little endian. This means that numbers are
    stored using the 'least significant byte' first.
    The little endian version of human readable 0201h is 01 02.
    Why? You can compare numbers of different sizes without any
    manipulation.
    01 02 30 5a     4 bytes  5a300201
    01 02           2 bytes  0201
    Using the size of the smallest memory area, these two numbers
    are equal up to the maximum significance of the number with the
    least amount of bytes.
    01 02 00 00    (an example where the numbers are exactly equal)
    01 02
    In big endian  00 00 01 02 
                   01 02            are not equal (unless converted).
    
--- GEcho 1.00
---------------
* Origin: Digital OnLine Magazine! - (409)839-8237 (1:3811/350)

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™.