Question about certain code types

Started by BrutalBrutal, December 04, 2008, 08:54:23 AM

Previous topic - Next topic

BrutalBrutal

I am using the Code Type Technical document but I am unable to understand certain parts of it. Any help would be appreciated.

Question 1:
Quote8400 : writes the 8bits in grN ZZZ times+1 at [XXXXXXXX]
Does that mean that 8400 will write the same value ZZZ+1 times in the same location? Isn't that useless?

Question 2:
Quote00______ YYYY00XX : 8bits ram write and fill (ba) writes XX YYYY+1 times at ba+address
Again, why would I want to write the same value to the same address YYYY+1 times?

Question 3:
Quote20______ YYYYYYYY : 32bits If equal (ba) Compares if 32bits at [ba+address]==YYYYYYYY.
If yes, codes are executed (else code execution set to false).
What exactly won't be executed if the "code execution" is set to false? Is it all the following lines until an endif?

Question 4:
If so, is it possible to get an endif without a new if condition? If so, how?

In fact, thinking about it, the technical code type document is so brief and extremely light on explanations, is there a better way to learn about code types, especially if conditions etc? I have tried searching the forums but haven't found anything.

Igglyboo

Maybe you want to write a value more than once?
To end and if code you would use and endif, E200000X 00000000

BrutalBrutal

#2
Thanks for the answer.

QuoteMaybe you want to write a value more than once?

OK, so my assumption was correct, but I guess my real question now is, why would you want to write the same value at the same address more than once in a row? I was under the impression that these codes ran once a frame or more. Why would you ever need to repeatedly (without doing anything else between write) assign a memory location the same value?

Also, am I right in assuming, in light of what you told me about endifs, that all if condition lines prevent execution of all subsequent lines until an endif if they return false? How do if conditions and loops work exactly?

Thanks for your help.

Link

It's written a little confusing to say the truth:

writing 8 bit values to address XXXXXXXX means:
to XXXXXXXX
then to XXXXXXXX+1
then XXXXXXXX+2
then XXXXXXXX+3
....
for 16 bit it would be +2, +4. +6, +8, +A and so on
for 32 bit +4, +8, +C, +10

for code execution set to false.. the code handler is pretty intelligent..
it won't execute codes until the next endif - it will stop handling codes until the corresponding endif.. that would be:

20123458 11111111
2012345C 22222222
04512348 33333333
E2000001 00000000
0451234C 44444444
E2000001 00000000

write that in pseudo code:


#1 if ba+123458 == 11111111
#2    if ba+12345C == 22222222
#3        set ba+512348 to 33333333
#4    endif
#5    set ba+51234C to 44444444
#6 endif


and it will handle that strictly: if the "if" at #1 fails.. it will not reactivate execution status at the endif at line #4.. this endif belongs to the "if" in line #2. It will therefore not execute lines #3 and #5, code execution status will be set at #6 again. If #1 succeeds, but #2 fails the code handler will not execute line #3 but it will handle line #5 as the status is reactivated in #4. If both line #1 and #2 succeed.. then of course lines #3 and #5 are executed!

BrutalBrutal

Thank you so much, that's cleared up everything for me. It all makes sense now: the if, endifs work the same as #if and #endif preprocessor commands in C++, and your explanation of how those write-multiple-times codes fixes my confusion over that. Your help is much appreciated.