mips十进制转二进制程序
.text
la $s1, 0x80000000 # mask
li $v0, 5 # read int
syscall
move $s0, $v0 # n
li $t0, 0 # i
loop:
bge $t0, 32, end
and $t1, $s0, $s1 # t1 = n&mask
beqz $t1, print0
li $a0, '1'
j next
print0:
li $a0, '0'
next:
li $v0, 11
syscall
sll $s0, $s0, 1 # n<<=1
addi $t0, $t0, 1 # i++
j loop
end:
li $v0, 10 # exit
syscall