View Single Post
Old 19 January 2007, 17:12   #20
Steve
I Identify as an Ewok
 
Steve's Avatar
 
Join Date: Jul 2001
Location: North Lincolnshire
Age: 45
Posts: 2,356
Stick out tongue

Yes, well explained musashi. Doh! I said static instead of storage! I've been hanging around c++ too much! lol.

Yes the EQU directive is actually nothing like ds and dc, you're right. lol. As you say, it is used to give a numeric value to a name (usually in upper case letters) and can never change its value while the program is running.

One thing I didn't mention is why EQU is so useful. Imagine in your code you wanted the speed of your player to be 2 pixels per frame so you would write:

Code:
PLYRSPEED	EQU	2
You can now place PLYRSPEED in your code and the assembler will replace it with the value 2.

Now imagine that later on you decide to make the player a bit quicker for playability reasons. Ok, now imagine you hadn't used EQU and had lots of 2s all over your program for the players speed. You would have to replace that 2 value in every part of your program! Ack! What a pain in the arse!

Using the equate directive allows great versatility in your program. To change the speed of your player you would only need to replace the EQU from 2 to whatever value you liked. Wherever there was a PLYRSPEED in your program code, this would be replaced with the new value when the program is compiled. Magic!

Last edited by Steve; 19 January 2007 at 17:22.
Steve is offline  
 
Page generated in 0.09364 seconds with 11 queries