Mips Assembly porting from C

Reply

Join Date: Jan 2005
Posts: 56
Reputation: kharri5 is an unknown quantity at this point 
Solved Threads: 0
kharri5's Avatar
kharri5 kharri5 is offline Offline
Junior Poster in Training

Mips Assembly porting from C

 
0
  #1
Jan 17th, 2005
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC