 |
forums.ps2dev.org Homebrew PS2, PSP & PS3 Development Discussions
|
| View previous topic :: View next topic |
| Author |
Message |
tumnes
Joined: 17 Sep 2004 Posts: 23
|
Posted: Sun Mar 19, 2006 4:31 am Post subject: Extracting nLoop field |
|
|
I want to extract the nloop field of a giftag on vu1 so that I know how many vertices I have to process. The nloop field is 15 bits, the 16th would be eop to indicate if this is the last gif packet. So if my giftag is located at address 0 in vu1mem, I do something like this:
iadd address, vi00, vi00
ilwr.w nLoop, (address)
iaddiu mask, vi00, 0x7FFF
iand nLoop, nLoop, mask
Now I think there is a problem here because the immediate field of iaddiu is only 11 bits and the value I am passing in is 15 bits. However vcl doesnt complain and neither does dvp-as. Am I correct to assume that it will just be cut off at the 11th bit and the results will not be as I desire? If so is there an easy way to go about this? I noticed there are other instructions with a 15bit immediate that are specifically for this sort of thing but are tied to a specific flag like status or clip.
[edit]
I guess a solution would be to just do:
iadd address, vi00, vi00
ilwr.w nLoop, (address)
if nLoop < 0 then
{
nLoop -= 1
}
for nLoop to 0, --nLoop
{
process element
}
Any input would be appreciated. |
|
| Back to top |
|
 |
b0rje
Joined: 12 May 2005 Posts: 7
|
Posted: Tue Mar 21, 2006 3:33 am Post subject: |
|
|
| iaddiu takes a 15bit arg (Imm15). your code seems correct. |
|
| Back to top |
|
 |
tumnes
Joined: 17 Sep 2004 Posts: 23
|
Posted: Tue Mar 21, 2006 6:31 am Post subject: |
|
|
| Ah, yes thank you. I missed the extra 4 bits to the in the diagram. |
|
| Back to top |
|
 |
|
|
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 vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|