How can I print a number larger than 32 bits in a mips assembly?

In my mips assembler, I used a multi-command to multiply 2 large numbers, since the result could not fit into one register. This means that the number is stored in special registers hi and lo. My problem is how to print the result of the multiplication. I can access hi and lo and put them in other registers (i.e. $ T0, $ t1), but I don’t know how to combine the two numbers to print the result. Thank.

+3
source share
2 answers

(This answer was kept intentionally high-level since I am sure that no one prints numbers in the mips assembly unless they do this for homework.)

If you do not mind getting it in hexadecimal, this is not a problem; just type one word in hexadecimal, and then the following. Remember to include leading zeros in the second word! (In fact, I think that the spim that I suppose you use can only print in base 10, so even this can be a little tricky).

10, , "--". " " ; C, - - - . , 10, . mips 64- ( ), .

+3

Source: https://habr.com/ru/post/1731645/


All Articles