Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- blt $s1, 0x80, Case1
- ble $s1, 0x7FF, Case2
- ble $s1, 0xFFFF, Case3
- ble $s1, 0x10FFFF, Case4
- li $s2, 0xFFFFFFFF # n = 0xFFFFFFFF
- j continue
- Case1:
- la $s2, 0x00000000 # n = 00000000
- or $s2, $s2, $s1 # n = n | j
- j continue
- Case2:
- and $t1, $s1, 0x3F # b = low 6 bits
- srl $t3, $s1, 6 # shift j right 6 bits
- and $t2, $t3, 0x3F # a = next 5 bits
- la $s2, 0xC080
- sll $t2, $t2, 8
- or $s2, $s2, $t2
- or $s2, $s2, $t1
- j continue
- Case3:
- and $t1, $s1, 0x3F # c = low 6 bits
- srl $t4, $s1, 6 # j >> 6
- and $t2, $t4, 0x3F # b = next 6 bits
- srl $t4, $s1, 12 # j >> 6
- and $t3, $t4, 0xF #a = next 4 bits
- la $s2, 0xE08080
- sll $t3, $t3, 16
- sll $t2, $t2, 8
- or $s2, $s2, $t1
- or $s2, $s2, $t2
- or $s2, $s2, $t3
- j continue
- Case4:
- and $t1, $s1, 0x3F
- srl $t5, $s1, 6
- and $t2, $t5, 0x3F
- srl $t5, $s1, 12
- and $t3, $t5, 0x3F
- srl $t5, $s1, 18
- and $t4, $t5, 0x7
- la $s2, 0xF0808080
- sll $t4, $t4, 24
- sll $t3, $t3, 16
- sll $t2, $t2, 8
- or $s2, $s2, $t1
- or $s2, $s2, $t2
- or $s2, $s2, $t3
- or $s2, $s2, $t4
- j continue
- continue:
- # Your part ends here
- # print i, j and n
- move $a0, $s0 # i
- jal Print_integer
- la $a0, sp # space
- jal Print_string
- move $a0, $s1 # j
- jal Print_hex
- la $a0, sp # space
- jal Print_string
- move $a0, $s2 # n
- jal Print_hex
- la $a0, sp # space
- jal Print_string
- move $a0, $s1 # j
- jal Print_bin
- la $a0, sp # space
- jal Print_string
- move $a0, $s2 # n
- jal Print_bin
- la $a0, nl # newline
- jal Print_string
- # for (i = 0; i <= 16; i++)
- addi $s0, $s0, 1 # i++
- addi $t0, $t0, 4 # address of testcase[i]
- ble $s0, 16, top # i <= 16
- bottom:
- la $a0, done # mark the end of the program
- jal Print_string
- jal Exit0 # end the program, default return status
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement