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 

Mips & C++

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



Joined: 15 Aug 2007
Posts: 98

PostPosted: Sun Aug 19, 2007 4:29 pm    Post subject: Mips & C++ Reply with quote

Could someone tell me how to execute mips code within c++ applications?????

Thanks.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Mon Aug 20, 2007 4:07 am    Post subject: Reply with quote

Example using VFPU ASM
Code:

/** Point is to use gcc specific __asm__(//operations);
/* NOTE: volatile is optional when you know when you need it
 */
int someFunc(int arg1, int arg2) {
...

__asm__ volatile (
   "lv.q   C000, %0\n"   // 16 byte aligned assumed.
   "vdot.t   S010, C000, C000\n"   // squared magnitude of x,y,z
   "vrsq.s S010, S010\n"   // 1.0f/sqrtf(x*x+y*y+z*z)
   "vscl.q   C000, C000, S010\n"   // vector/=mag
   "sv.q   C000, %0\n"   // save it again
   : "+m" (*plane)
   );

...
}

_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP 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