.data
lowerCaseChar: .asciiz "Lower case character"
upperCaseChar: .asciiz "Upper case character"
notAlphabeticChar: .asciiz "Not alphabetic character "
char : .byte 'b' # type a character what you want
.text
.globl main
main:
jal isCapital
exit:
li $v0, 10
syscall
isCapital:
addi $sp,$sp,-4
sw $ra,0($sp)
lbu $s0,char
sge $t1,$s0,65
sle $t2,$s0,90
and $t3,$t1,$t2
beq $t3,1,upperCase
sge $t1,$s0,97
sle $t2,$s0,122
and $t3,$t1,$t2
beq $t3,1,lowerCase
j notAlphabetic
end:
li $v0,4
syscall
lw $ra,0($sp)
addi $sp,$sp,4
jr $ra
lowerCase:
la $a0,lowerCaseChar # system call 4 for print lower case
j end
upperCase:
la $a0,upperCaseChar # system call 4 for print upper case
j end
notAlphabetic:
la $a0,notAlphabeticChar
j end