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.