I have to write a little program in assembly for the MIPS architecture. To be more specific it should be a procedure which takes a register and prints the value of it. It is allowed to use everything excepted a call of print_int. My procedure does: 1. Split up the given register into digits 2. Convert them into ascii 3. Store them on the stack I now have values like 52 or 53 on the stack and I want to print them with print_string but how can I achieve this? Thanks for your help.
Asked
Active
Viewed 306 times
-1
-
1Once you have the text representation on the stack, make sure you have a terminating zero byte then just pass the start address to `print_string`. – Jester Nov 13 '14 at 22:44
-
[7fffeaec] 0000000049, [7fffeaf0] 0000000050 0000000051 0000000052 0000000000 i have this values on my stack. But it only prints the 1 what is worng? – Asker Nov 13 '14 at 23:03
-
1You've pushed each digit as a _word_. They need to be _bytes_. – Michael Nov 14 '14 at 06:20
1 Answers
1
You write 3. Store them on the stack. Since you are allowed to use everything excepted a call of print_int why don't you store them in succesive memory bytes before using print_string to ouput the result.

Sep Roland
- 33,889
- 7
- 43
- 76