我是汇编语言的新手,我遇到了一个奇怪的错误。该程序应该显示用户输入的整数的 4 个最低有效位。它适用于大于 8 的数字,但对于小于或等于 8 的数字,它会输出应该在的数字。对于 8,它输出 8000 而不是 1000,对于 5,它输出 0401。我不明白为什么,谁能帮忙?
.data
inPrompt: .asciiz "Enter an integer: "
outLab: .asciiz "Least significant 4 bits of int entered are "
############################ code segment ################################
.text
.globl main
main:
li $v0, 4
la $a0, inPrompt
syscall # print input prompt
li $v0, 5
syscall # read input integer
move $t0, $v0
li $v0, 4
la $a0, outLab
syscall
li $v0, 1
andi $a0, $t0, 8
syscall
andi $a0, $t0, 4
syscall
andi $a0, $t0, 2
syscall
andi $a0, $t0, 1
syscall
##########################################################
li $v0, 10 # exit
syscall