3DO ZONE Forums

The Only R.E.A.L. 3DO Experience.
It is currently Sat Mar 25, 2017 6:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: EQU vs. REGEQU
PostPosted: Mon Feb 24, 2014 7:27 pm 
Offline
Jaguar MOD
User avatar

Joined: Mon Apr 01, 2013 7:09 am
Posts: 816
LinkoVitch wrote:
Rocky1138 wrote:
I saw this in the T2K sources:
L_INC REGEQU R5

What is REGEQU? A Google search pulls up some Jaguar results but no definitions. How is it different from a regular EQU?


It's a register equate.. purely to make your code more readable.

Instead of refering soley to register values (which with 32 of them can be a bit of a mind melter, especially a few 1000 lines in and re-reading your code a month later) you can use more friendly names.

in the example you gave.. without the REGEQU you might have

moveq #4,r5

which will set register 5 to be the value 4

using the REGEQU however, you could rewrite that to

moveq #4,L_INC

The result is exactly the same, except now when you read the code you don't need to remember that register 5 is L_INC. The assembler would simply transpose it to moveq #4,r5 internally and assemble it.

Also should you decide you want it to be a different register (you know for your own OCD reasons or whatever ) you just change that one EQUREG and bingo, they all change.

an EQU on the other hand is a way of setting a constant for use in your code, so you could say have

STARTLIVES EQU 3

now in your code you could have

LIVES EQUREG r10

moveq #STARTLIVES,LIVES

and the value 3 would end up in the LIVES (r10) register. Should you at some point decide you want to change this default value, you change the EQU and your code changes. Very useful if you make use of a single value throughout your code. Saves trawling through code looking for every instance of a value.. Also can make code more readible too, as you don't have to remember why your are putting a particular random looking number into a register.. you can see that at this point you are putting a named constant into a register which will probably make more sense.

HTH

_________________
What came after the Jaguar was the PS1 which for all it's greatness, ushered in corporate development and with it the bleached, repetitive, bland titles which for the most part we're still playing today. - David Wightman


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group