Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Assembly (http://www.programmingforums.org/forum20.html)
-   -   [x86]Need explanation (http://www.programmingforums.org/showthread.php?t=11069)

Klarre Aug 14th, 2006 1:25 PM

[x86]Need explanation
 
Have been reading an asm tutorial source file, where there is two lines I don't really understand. Would be great if you could help me by explaining them.
:

Palette db 768 dup(0)
The part I don't understand here is the 768 dup(0).
:

mov es:[di],al
Dont really get the es:[di] syntax.

Thanks alot for your time!

/Klarre

DaWei Aug 14th, 2006 2:17 PM

dup means that the value of 0 will be duplicated in each element of the Palette array (collection of adjacent values) that is being defined here. This is an assembly-time action, not a run-time action.

The second results in the value of al being stored in the address represented by the contents of es, offset by the value of di. For example, if you leave es alone, but increment the value of di after each move, your values will be stored in successive locations. ES is like a pointer to an array (or the address of the beginning of the array). DI is then the index. ES [DI].

Klarre Aug 14th, 2006 2:25 PM

Thanks alot! Now the code make sense.

/Klarre


All times are GMT -5. The time now is 11:30 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC