cs232mp1sol - # v1 = (v1 << 1) | (a0...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
## MP1 score: ## If your score is not 100%, please see lines marked ERROR below main: li $a0, 0xC232 # a0 = 0xC232 = 49714 in decimal #### DO NOT DELETE THIS LINE #### # Start of your code ($a0 = val) andi $v0, $a0, 0xFF00 # v0 = second-least significant byte srl $v0, $v0, 8 # shift to least significant byte andi $a0, $a0, 0xFF # a0 = least significant byte li $v1, 0 # v1 = y = 0 li $t0, 0 # t0 = number of bits processed so far loop: beq $t0, 8, done # while(t0 < 8) sll $v1, $v1, 1 andi $t1, $a0, 1 or $v1, $v1, $t1
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: # v1 = (v1 &lt;&lt; 1) | (a0 &amp; 1) srl $a0, $a0, 1 # a0 = a0 &gt;&gt; 1 addi $t0, $t0, 1 # t0++ j loop done: # End of your code ($v0 = x, $v1 = y) #### DO NOT DELETE THIS LINE #### # Print the value of $v0 move $a0, $v0 # $a0 = integer to print li $v0, 1 # code to print integer syscall # system call to actually print li $a0, 10 # 10 = ASCII code for new-line li $v0, 11 # code to print char syscall # Print the value of $v1 move $a0, $v1 li $v0, 1 syscall li $a0, 10 li $v0, 11 syscall jr $ra...
View Full Document

Ask a homework question - tutors are online