em đã thử code bài tập như trên nhưng nó không so sánh được và báo lỗi mong mọi người giúp em
.data
enterCharacter: .asciiz "Nhap Vao 1 Ki Tu"
So: .asciiz "day La So"
ChuHoa: .asciiz "Day La Chu Hoa"
ChuThuong: .asciiz "Day La Chu Thuong"
.text
.globl main
main:
li $v0,4
la $a0,enterCharacter
syscall
li $v0,11
syscall
move $s1,$v0
slt $t0,$s1,'A' #if(s1 < 97)->$t0 = 1
beq $t0,$0,KiemTra
slt $t0,$s1,'a' #if(s1 < 65)->$t0 = 1
beq $t0,$0,KiemTra
slt $t0,$s1,'0' #if(s1 < 30)->$t0 = 1
beq $t0,$0,KiemTra
KiemTra:
slt $t0,$s1,'Z' #if(s1 < 122)->$t0 = 1
beq $t0,$1,isChuHoa
slt $t0,$s1,'z' #if(s1 < 90) ->$t0 = 1
beq $t0,$1,isChuThuong
slt $t0,$s1,'9' #if(s1 < 39) ->$t0 = 1
beq $t0,$0,isSo
j ketThuc
isChuHoa:
li $v0,4
la $a0,ChuHoa
syscall
j ketThuc
isChuThuong:
li $v0,4
la $a0,ChuThuong
syscall
j ketThuc
isSo:
li $v0,4
la $a0,So
syscall
j ketThuc
ketThuc:
em đã thử chuyển các kí tự so sánh ra mã ascii nhưng cũng không được nó ra lỗi như sau:
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 17 column 15: "65": operand is of incorrect type
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 20 column 15: "97": operand is of incorrect type
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 23 column 15: "48": operand is of incorrect type
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 26 column 15: "90": operand is of incorrect type
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 29 column 15: "122": operand is of incorrect type
Error in C:\Users\user\Downloads\kiemTraChuHoaThuongSo.asm line 32 column 15: "57": operand is of incorrect type
Assemble: operation completed with errors.