The above video goes away if you are a member and logged in, so log in now!
|
| |
Would you like to get all the new info from PSX-Scene in your email each day?
| |
|
-
#1
Questions on code condensing
Questions on code condensing –
09-28-2004,03:19 AM
I'm using the example on Codemasters project.
003FBF73 00000003
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
003FBF77 00000003
003FBF78 00000003
003FBF79 00000003
003FBF7A 00000003
003FBF7B 00000003
003FBF7C 00000003
003FBF7D 00000003
003FBF7E 00000003
003FBF7F 00000003
003FBF80 00000003
003FBF81 00000003
003FBF82 00000003
003FBF83 00000003
003FBF84 00000003
003FBF85 00000003
003FBF86 00000003
would be condensed into
003FBF73 00000003
403FBF74 00050001
03030303 00000000
My question is how did 0005 (xxxx) come about, do I still count it as 20 lines or 19 since the condensed version is actually short of one line due to the 0,4,8,C restriction.
I would get 0005 if I take 20/4 but 19/4 would give me 0004 instead.
What about the 0001 (ZZZZ), according to the guide, I need to divide the step value by 4, for the code above, the step value is 1 and 1/4 = 0.
Thanks in advance.
-
09-28-2004,06:52 AM
This:
003FBF73 00000003
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
Is the same as this:
203FBF73 03030303
And 5 lines like that would be like 20 of the the first four. I wasn't sure if you were using MAX commands, but it's the same type of thing.
-
09-28-2004,09:36 PM
Vampmaster, I'm still trying to get a grip on how to perform code condensing using 32 byte condensing.
I'm not using MAX commands, just the normal raw/hex. I'm trying to learn to condense code just by looking at them since they kinda need to follow a predetermined pattern with fixed step value.
Thanks in advance.
-
09-29-2004,10:01 AM
This:
003FBF73 00000003
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
Is the same as this:
203FBF73 03030303 < - No, this isn't properly aligned.
Alv is correct, based on what he's posted. If there were one more line to the code (003FBF87 00000003), the condensed version posted would be correct. As it is, it should be:
003FBF73 00000003
403FBF74 00040001
03030303 00000000
103FBF84 00000303
003FBF86 00000003
The step value is based on the write width of the type 4 code (32-bits). It must always be >= 1, so you can't condense a set of codes that way unless they can be safely done with 32-bit writes.
-
09-30-2004,07:17 PM
003fbf73 00000003
003fbf74 00000003
003fbf75 00000003
003fbf76 00000003
003fbf73 00000003
203fbf74 00030303
-
09-30-2004,09:10 PM
Hmmm... does that mean the 0,4,8,C restriction also applies to 16 byte and 32 byte condesing at well since Pyriel mentioned that the code 203FBF73 03030303 isn't aligned properly?
Thanks in advance.
-
10-01-2004,08:42 AM

Originally Posted by
Pyriel
This:
003FBF73 00000003
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
Is the same as this:
203FBF73 03030303 < - No, this isn't properly aligned.
Wasn't thinking. I meant to say this:
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
003FBF77 00000003
Is the same as this:
203FBF74 03030303
And 5 lines like that would be like 20 of the the first four. I was trying to explain to Alv2 why 5 is used instead of 20.
-
10-01-2004,09:54 AM

Originally Posted by
GMO
003fbf73 00000003
003fbf74 00000003
003fbf75 00000003
003fbf76 00000003
003fbf73 00000003
203fbf74 00030303
Yeah, but that assumes that it's safe to overlay the byte at 0x3FBF77 with 0, which may not be true.
It's based on code type, Alv2. If the code writes/reads 32 bits (a full-word), then the address must conform to word alignment and word aligned addresses end in 0, 4, 8 or C. If the code writes/reads 16 bits (half-word), then it must conform to half-word alignment. Those are addresses ending in 0, 2, 4, 6, 8, A, C or E. The 8-bit write has no address restrictions.
When you're condensing, you have to look at the source codes and make sure that they can be made to conform to the rules of the target code types.
Here are a few examples:
1 -
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
003FBF77 00000003
Four codes, each writing 8 bits; the addresses are sequential and the first code in the list has an address that conforms to word alignment. The condensed code could be:
203FBF74 03030303
-------------------------
2 -
003FBF73 00000003
003FBF74 00000003
003FBF75 00000003
003FBF76 00000003
Four codes, each writing 8 bits; the addresses are sequential however the first code in the list does not have an address that conforms to word alignment. The condensed code could be:
003FBF73 00000003
103FBF74 00000303
003FBF76 00000003
The only lines that could be safely condensed were the lines ending in 4 and 5. 4 conforms to half-word alignment, so the two lines were made into a 16-bit write. 4 also conforms to word alignment, but the three 8-bit writes (the line in question and the two following it) weren't enough to fill a 32-bit write (2 command). Although, as GMO sort of mentioned, you could use the 32-bit command anyway and condense the last line as well:
003FBF73 00000003
203FBF74 00030303
If the extra data being written is used for something, the code may have unwanted effects.
--------------------------------
3 -
003FBF76 00000003
003FBF77 00000003
003FBF78 00000003
003FBF79 00000003
Four codes, each writing 8 bits; the addresses are sequential however the first code in the list does not have an address that conforms to word alignment. It does conform to half-word alignment though, as does the third line. The condensed code could be:
103FBF76 00000303
103FBF78 00000303
--------------------------------
4 -
003FBF76 00000003
003FBF77 00000003
003FBF80 00000003
003FBF81 00000003
Same as number three, however there's a jump in the addresses after the second line. Still, there are two pairs of sequential lines and the first of each starts on a half-word aligned address. This could be condensed like so:
103FBF76 00000303
103FBF80 00000303
--------------------------------
5 -
003FBF76 00000003
003FBF88 00000003
003FBF9C 00000003
003FBFAF 00000003
Four lines, each writing 8 bits. None of the addresses are in sequence though. This cannot be safely condensed at all, even though some of the addresses conform to alignment.
-
10-05-2004,03:53 AM
Thanks a lot Pyriel, the examples you've provided really explain a lot. It'll be a real nice addition to the code condensing guide at codemasters project.
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|