Relative Content

Tag Archive for assemblymips

How to print (W)in (L)oss or (T)ie, whether the first player wins, looses or ties?

Gen_byte is generating two random bits 00,01,10 (not 11) for a rock paper scissors game. 00 is rock, 01 is paper and 10 is scissors. This play_game function is checking if player 1 wins, looses or ties. The problem is that when I run the test the output goes like WLTWLTWLTWLT… and doesn’t stop. I’m not quite sure where the problem is.

How to use lw or lb to read a char stored in memory?

I am trying to convert a integer to two’s compliment binary. When I attempt to read a the ascii value from memory it says my address is out of range. I’m fairly new to MIPS and can’t find a way around this or where I am going wrong.

Trouble with Sqrt Function/Program in MIPS Assembly

I’m working on converting a C program that finds the sqrt via a binary search to MIPS assembly and I am struggling. I believe that my program essentially is iterating one less time through the while loop than it should. For example, for the sqrt(16), it returns 8 and for sqrt(4) it returns 4. Here is the original C code I am trying to convert: