954,490 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Mips Assembly porting from C

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.

kharri5
Junior Poster in Training
56 posts since Jan 2005
Reputation Points: 13
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You