User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Assembly section within the Software Development category of DaniWeb, a massive community of 455,985 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,772 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Assembly advertiser: Programming Forums
Views: 4166 | Replies: 12
Reply
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Conversion from C++ to MIPS Assembly

  #1  
Dec 1st, 2007
Hey everyone,

I've been getting my rear end kicked by this homework assignment. We were given the task of writing up a command line version of Othello (Reversi) in a higher level language, which I chose C++ to do so in. My C++ version of the code is working great, however, I can't seem to get off the ground in MIPS. I was wondering if anyone knew a good way to convert the C++ code to MIPS. I'm currently on a Windows box, using Bloodshed IDE for my C++ code, but I also picked up Microsoft Visual C++ 2008 Express Edition today to give it a try and see if there was something in there to help convert the code. I've also got access to some Fedora Core 7 computers in the computer lab, with a lot of different things on there. Any help would be appreciated. I've also put a copy of this in the C++ forum, hopefully this is ok.
Last edited by therealsolitare : Dec 1st, 2007 at 11:21 pm.
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Re: Conversion from C++ to MIPS Assembly

  #2  
Dec 2nd, 2007
I got some hints on how to convert the program from C++ to the Intel 80X88 Assembly code, so if someone knows a good, fairly quick way of converting that into MIPS, that would also be great. I still think that C++ directly to MIPS would be a little faster, but whichever way gets the job done gets the job done.
Last edited by therealsolitare : Dec 2nd, 2007 at 1:59 am.
Reply With Quote  
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,878
Reputation: Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold Duoas is a splendid one to behold 
Rep Power: 13
Solved Threads: 193
Featured Poster
Duoas's Avatar
Duoas Duoas is offline Offline
Posting Virtuoso

Re: Conversion from C++ to MIPS Assembly

  #3  
Dec 2nd, 2007
If your assignment was to do it in a high level language then why play with assembly?

The fastest way to convert would be to tell the compiler to produces assembly source instead of a binary image. If you are using the GCC:
g++ -S -fverbose-asm foo.cpp
Other compilers will vary.

BTW. Good luck. C++ is pretty darn high level.
Reply With Quote  
Join Date: Oct 2008
Posts: 1
Reputation: ibaraku is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
ibaraku ibaraku is offline Offline
Newbie Poster

Re: Conversion from C++ to MIPS Assembly

  #4  
Oct 1st, 2008
Originally Posted by Duoas View Post
If your assignment was to do it in a high level language then why play with assembly?

The fastest way to convert would be to tell the compiler to produces assembly source instead of a binary image. If you are using the GCC:
g++ -S -fverbose-asm foo.cpp
Other compilers will vary.

BTW. Good luck. C++ is pretty darn high level.


This is not MIPS, I am just curious on what it is, thanks...
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Re: Conversion from C++ to MIPS Assembly

  #5  
Dec 2nd, 2007
I've got eVC++ 4.0 installed, along with the most recent service pack, however, (and I'm not sure if this is just isolated to my machine) it will not build any projects, as it says I need to select a platform, although there is no place on the project menu to select a platform.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Conversion of C++ to Assembly

  #6  
Dec 2nd, 2007
VC++ 2005 Express can produce the assembly code for you but it won't produce assembly code for the standard c and c++ library functions that your program calls. Unless your teacher lets you link with standard C or C++ libraries, which I doubt, you wil have to write those functions yourself.
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Re: Conversion of C++ to Assembly

  #7  
Dec 2nd, 2007
Where is that functionality located in Express? I poked around in different menus and was unable to find it, although the documentation that I was looking at was not very helpful.
Reply With Quote  
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 11,539
Reputation: Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of Ancient Dragon has much to be proud of 
Rep Power: 40
Solved Threads: 972
Moderator
Featured Poster
Ancient Dragon's Avatar
Ancient Dragon Ancient Dragon is offline Offline
Most Valuable Poster

Re: Conversion of C++ to Assembly

  #8  
Dec 2nd, 2007
Project --> Properties (the last item in the menu) --> Configuration Properties --> C/C++ -> Output Files --> then on the right side of the screen you will see Assembly Output
<<Freelance Programmer>> << Hobby Site>>
Signature links for sale. PM me for details
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Re: Conversion of C++ to Assembly

  #9  
Dec 2nd, 2007
Ahh, I wouldn't have thought to look in the output files. Thank you so much!
Reply With Quote  
Join Date: Dec 2007
Posts: 8
Reputation: therealsolitare is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
therealsolitare therealsolitare is offline Offline
Newbie Poster

Re: Conversion of C++ to Assembly

  #10  
Dec 2nd, 2007
One more quick question - is the assembly code outputted MIPS? I took a look at it, and it seemed to be quite a bit different, but it might be that it is using functions that I've not encountered yet.
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb Assembly Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the Assembly Forum

All times are GMT -4. The time now is 9:22 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC