where to place ah or al ?

Programming, for all ages and all languages.
Post Reply
popey
Posts: 1
Joined: Wed Dec 03, 2008 5:16 pm

where to place ah or al ?

Post by popey »

hello

i have a small confusion.....when we write mov ah,0x0e why do we move 0x0e to ah not to al...similarly for many other mov instructions do i always need to remember such things or there is any reason
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: where to place ah or al ?

Post by Combuster »

Does it make a difference to send mail to your left or right neighbour?
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
CodeCat
Member
Member
Posts: 158
Joined: Tue Sep 23, 2008 1:45 pm
Location: Eindhoven, Netherlands

Re: where to place ah or al ?

Post by CodeCat »

al and ah are two distinct registers, just as for example eax and ebx are. So ask yourself the same question about eax and ebx, and obviously it makes no sense anymore. ;)
User avatar
Zenith
Member
Member
Posts: 224
Joined: Tue Apr 10, 2007 4:42 pm

Re: where to place ah or al ?

Post by Zenith »

However, don't forget that al and ah make up the lower and higher 8 bits of ax, respectively. You'd do operations on ah if you only wanted to change the contents of the high 8 bits of ax.

Hope this helps!
"Sufficiently advanced stupidity is indistinguishable from malice."
Post Reply