944,161 Members | Top Members by Rank

Ad:
  • Assembly Discussion Thread
  • Unsolved
  • Views: 5984
  • Assembly RSS
Jan 17th, 2005
0

Mips Assembly porting from C

Expand Post »
I was curious if anyone knows how the shit I port this C code over to MIPS assembly.

first i take input from a user as a string. I want to parse the string into two chars and take those and plug em into a vaiable input: I don't know how to do that, and I don't know how to make this code below port over to MIPS assembly:

//the following is in C++

if(input[0] == 'x')
{
cout<< "Exiting...";
exit(0);
}

origNum1 = 0;
origNum2 = 0;

//for first character
if(input[0] == 'A' || input[0] == 'B' || input[0] == 'C'
|| input[0] == 'D' || input[0] == 'E' || input[0] == 'F')
{
origNum1 = (int)input[0] - 55;
}
else
{
origNum1 = (int)input[0] - 48;
}
//for second character
if(input[1] == 'A' || input[1] == 'B' || input[1] == 'C'
|| input[1] == 'D' || input[1] == 'E' || input[1] == 'F')
{
origNum2 = (int)input[1] - 55;
}
else
{
origNum2 = (int)input[1] - 48;
}

If anyone could help it would be much appreciated. Thanks.
Similar Threads
Reputation Points: 13
Solved Threads: 0
Junior Poster in Training
kharri5 is offline Offline
56 posts
since Jan 2005

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: MASM "HELP NEEDED"
Next Thread in Assembly Forum Timeline: need assistance with tasm





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


Follow us on Twitter


© 2011 DaniWeb® LLC