MIPS 3000 assembly, load and print 32-bit unsigned integer


My program has to accept an input between between 0 and 2^32 or 4,294,967,295.

Which bit-wise 32 bytes should be able to do, but i'm overflowing into the negatives because i'm not sure how to make this an unsigned integer. I see that i have instructions that can do it via arithmetic, but what if i just want to load it into a register and print it? It always prints out the negative number right now.


Whether the int is signed or unsigned should not matter for how it exists in the register. Either way it is just a sequence of bits. 2^32 -1 = 0xFFFFFF. If you interpret this as an unsigned integer, this is 4,294,967,295 or 2^32-1. If you read it as a signed integer using two's complement, 0xFFFFFFFF is -1. I would guess the problem is in your print command. Try formatting your print output as unsigned.

By : A.E. Drew


Try service call 36. That prints an unsigned int.

By : Eric Dong

This video can help you solving your question :)
By: admin