LinkoVitch wrote:It's a register equate.. purely to make your code more readable.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?
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
which will set register 5 to be the value 4
using the REGEQU however, you could rewrite that to
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
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.
Let's get coding!
1 post • Page 1 of 1
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