Hi. I need help to write one program in Assembly Mips.
<< read the characters typed by the user and store these characters a string. This string is later converted to an integer. If the user tries introducing non-valid characters (that is, other than the numerals 0 to 9) the program "complaining" and start all over.
again.>>
What's is wrong?
.data
text: .asciiz "\nEnter a number : "
text2: .asciiz "\nThe value entered was: "
text3: .asciiz "\nEntered an invalid character"
val: .space 160
.text
.globl main
main: li $v0, 4
la $a0, text
syscall
main2: li $v0, 12
syscall
sw $v0, val
if_1: lb $t2, val
blt $t2, 48, if_2
if_2: bgt $t2, 57, imp2
b main2
if_3: lb $t2, val
bge $t2, 48, if_4
if_4: ble $t2, 57, imp1
imp1: li $v0, 4
la $a0, text2
syscall
li $v0, 11
lw $a0, val
syscall
b end
imp2: li $v0, 4
la $a0, text3
syscall
b main
end:
li $v0, 10
syscall