I'm writing some SGDK tutorials (in spanish, but google translate is making a good job, here).
Now it's (simple) debug tools turn. At the same time I am learning, lot of years without C programming.
Just learning now about KDebug_AlertNumber()+GensKmod. I have some doubts.
INTEGER (Positive numbers)
Code: Select all
int v = 100;
KDebug_AlertNumber(v);
...
Message window-> 64
INTEGER (Negative numbers)
Code: Select all
int v = -100;
KDebug_AlertNumber(v);
...
Message window-> FFFFFF9C
To check this easily:
Open windows CALC program:
Select Windows/Programmer option + Select DWORD + Select HEX, write FFFFFF9C.
Then Select DEC and obtain -100. All ok.
But I have to do manually everytime I check int numbers using KDebug_AlertNumber()
FIX16
Code: Select all
fix16 v = FIX16(5.4);
KDebug_AlertNumber(v);
...
Message window-> 159
I think I need to split int and frac part.
Code: Select all
fix16 v = FIX16(5.4);
KDebug_AlertNumber(fix16Int(v));
KDebug_AlertNumber(fix16Frac(v));
...
Message window-> 140
Message window-> 19
So 140 for integer part and 19 for fractional part. Lets start with 140. So we are checking now 5.0 instead 5.4
Fix16: 1 bit for sign + 9 bits for integer part + 6 bits for fractional part (16 bits in total)
Open windows CALC program:
Select Windows/Programmer option + Select WORD (16 bits) + Select HEX, write 140.
Then Select BIN and obtain 0000 0001 0100 0000
That is 0 (sign bit) + 000 0001 01 (integer part) + 00 0000 (frac part)
0 (sign bit) -> is ok
000000101 = 101 = 5 dec -> is ok
000000 = 0 = 0 dec -> is ok
So all seems ok but not easy to "translate".
Are all these steps the right ones?
Are all these steps necessary? Maybe there is an easy way.
Now 19 for fractional part. So we are checking 0.4
Hmmmm. Not sure what to do now. As I said, lot of years without programming.