TIP: Click on subject to list as thread! ANSI
echo: 80xxx
to: CHRIS BERKHOUT
from: DARRYL GREGORASH
date: 1997-12-22 02:00:00
subject: Moving things in ASM

Replying to a message of Chris Berkhout to All:
 CB>         With this code:
 CB> mov     ah,b[var]
 CB> mov     al,b[var+1]
 CB> var     dw      0102Fh
 CB>         AX = 0102Fh, but with this:
 CB> mov     ax,w[var]
 CB> var     dw      0102Fh
I assume that b[var] is equivalent to MASM's "byte pointer var", and w[var] 
means "word pointer var".
 CB>         AX = 0201h, aren't they meant to do the same thing ?
No, they are not; the Intel CPU stores the least significant portion of any 
item in the least significant memory location. Thus the value at byte pointer 
var is 02Fh and the value at byte pointer var+1 is 02h.
BTW, I do not believe that these are the results you obtain with an Intel 
CPU; with the first code fragment, your result should be AX = 02F10h, with 
the second code fragment your result should be 0102Fh.
--- FleetStreet 1.21 NR
---------------
* Origin: BIG BANG Burger Bar: Regina SK Canada (1:140/86)

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