forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Why does this crash?

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development
View previous topic :: View next topic  
Author Message
Peyote



Joined: 04 Aug 2005
Posts: 6
Location: Holland

PostPosted: Sun Aug 07, 2005 9:49 pm    Post subject: Why does this crash? Reply with quote

Hi, does anyone know why the following code causes a fatal crash? I have modified the cube example a bit so it copies the GIFTag directly to VU1 mem (using the 0x1100c000 address). However, executing the XGKICK crashes instantly. Anyone knows why? Thanks in advance!

// Reset the packet.
packet_reset(&packet);

// Create the cube GIFTag (A+D mode)
for (loop0=0;loop0<12;loop0++) {
packet_append_64(&packet, GIF_SET_TAG(6, 1, 1, GIF_SET_PRIM(3, 1, 0, 0, 0, 0, 0, 0, 0), GIF_TAG_PACKED, 1));
packet_append_64(&packet, 0x0E);
packet_append_64(&packet, colours[loop0 >> 2]);
packet_append_64(&packet, GIF_REG_RGBAQ);
packet_append_64(&packet, GIF_SET_XYZ(pointsi[triangles[loop0][0]].x, pointsi[triangles[loop0][0]].y, pointsi[triangles[loop0][0]].z));
packet_append_64(&packet, GIF_REG_XYZ2);
packet_append_64(&packet, colours[loop0 >> 2]);
packet_append_64(&packet, GIF_REG_RGBAQ);
packet_append_64(&packet, GIF_SET_XYZ(pointsi[triangles[loop0][1]].x, pointsi[triangles[loop0][1]].y, pointsi[triangles[loop0][1]].z));
packet_append_64(&packet, GIF_REG_XYZ2);
packet_append_64(&packet, colours[loop0 >> 2]);
packet_append_64(&packet, GIF_REG_RGBAQ);
packet_append_64(&packet, GIF_SET_XYZ(pointsi[triangles[loop0][2]].x, pointsi[triangles[loop0][2]].y, pointsi[triangles[loop0][2]].z));
packet_append_64(&packet, GIF_REG_XYZ2);
}

// Copy the Cube GIFTag byte by byte to 0x1100c000
for (loop0=0;loop0<packet.count;loop0++) {
vu1ptr[loop0]=packet.data[loop0];
}

// Create a VIFTag and send it (VI05 is 0, then XGKICK VI05)
vucodeptr = (int32*)&vucodebegin;
vuprogramsize=(&vucodeend-&vucodebegin); //calculate program size

packet_reset(&packet);
packet_append_32(&packet,vif_nop);
packet_append_32(&packet,vif_nop);
packet_append_32(&packet,(vif_mpg)+((vuprogramsize/2)<<16));

for (loop0=0;loop0<vuprogramsize;loop0++) {
packet_append_32(&packet,vucodeptr[loop0]);
}
packet_append_32(&packet,vif_flush);
packet_append_32(&packet,vif_mscal+(VIF_ADDR0));
packet_send(&packet, DMA_CHANNEL_VIF1, DMA_FLAG_NORMAL);
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
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