Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Aug 14th, 2006, 1:25 PM   #1
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
[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
__________________
http://www.klarre.se
Klarre is offline   Reply With Quote
Old Aug 14th, 2006, 2:17 PM   #2
DaWei
Resident Grouch
 
DaWei's Avatar
 
Join Date: Jun 2005
Posts: 6,453
Rep Power: 10 DaWei is on a distinguished road
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].
__________________
Abstraction doesn't make it impossible to write bad code; it makes it possible to write superior code.
Contributor's Corner: Grumpy on C++ Exceptions DaWei on Pointers
DaWei is offline   Reply With Quote
Old Aug 14th, 2006, 2:25 PM   #3
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
Thanks alot! Now the code make sense.

/Klarre
__________________
http://www.klarre.se
Klarre is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
List and explanation of all dev-c++ error messages Josef_Stalin C++ 4 Jul 18th, 2005 2:30 PM
DragMove a better explanation of what I need cybatech Delphi 1 Jul 6th, 2005 9:29 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 3:39 AM.

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