| | |
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.
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
- Conversion from C++ to MIPS Assembly (Assembly)
- Need help converting C++ code to MIPS Assembly (Assembly)
- MIPS Assembly Pointer help (Assembly)
- using float, double numbers in mips assembly language (Assembly)
- C++ code to MIPS code (assembly) (C++)
Other Threads in the Assembly Forum
- Previous Thread: MASM "HELP NEEDED"
- Next Thread: need assistance with tasm
| Thread Tools | Search this Thread |





