944,110 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 17829
  • Assembly RSS
You are currently viewing page 1 of this multi-page discussion thread
Dec 1st, 2007
0

Conversion from C++ to MIPS Assembly

Expand Post »
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.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

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.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,961 posts
since Aug 2005
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

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
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,961 posts
since Aug 2005
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

Ahh, I wouldn't have thought to look in the output files. Thank you so much!
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

>>is the assembly code outputted MIPS
No. Its Intell 80X88, you will have to translate it to MIPS.

You can get free eVC++ 4.0 which is for embedded WinCE and PocketPC devices which can produe MIPS assembly. Depending on your program that compiler may or may not be able to compile it.
Last edited by Ancient Dragon; Dec 2nd, 2007 at 1:10 am.
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Ancient Dragon is offline Offline
21,961 posts
since Aug 2005
Dec 2nd, 2007
0

Re: Conversion from C++ to MIPS Assembly

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.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion of C++ to Assembly

I was trying to install eVC++ earlier today and I got a funky error when I was doing so (on the install of the Platform Manager). I'll try that again, however, and see if I can find out more information about the error I was getting.
Last edited by therealsolitare; Dec 2nd, 2007 at 1:58 am.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
therealsolitare is offline Offline
8 posts
since Dec 2007
Dec 2nd, 2007
0

Re: Conversion from C++ to MIPS Assembly

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.
Featured Poster
Reputation Points: 1140
Solved Threads: 229
Postaholic
Duoas is offline Offline
2,039 posts
since Oct 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Assembly Forum Timeline: DIVISION in assembly? (NASM)
Next Thread in Assembly Forum Timeline: Assembly problems





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC