How do you check if a letter in a string is upper or lower case in RISC-V assemby

268 Views Asked by At

I cannot manage to compare current character that I'm checking in a loop with ascii code, it pops up type error The initial task is to

Convert all lower case letters to *

Input string > Wind On The Hill

Conversion results> W*** O* T** H***
.data
input: .space 80
prompt: .asciz "\nInput   >   "
resultText: .asciz "Result   >   "
countText: .asciz "Count   >   "


.text
main:
    li a7,4
    la a0, prompt
    ecall
    
    li a7, 8
    la,a0, input
    li a1, 16
    ecall
    
    li t1, 0    # int counter = 0
    li t4, 141  # int minVal = 141
    li t5, 42   # int ascii * = 42
    la t2, input    # string* t2 = input
loop:
    lb t3, (t2) # t3 = t2 (pointer)
    beqz t3, loop_exit
    
    addi t2,t2,1    # t2++
    addi t1,t1,1    # count++
    
    
    bgeu t3, 42, modify  #------------comparision 
    j loop
modify:
    addi t3,t3,1
    j loop

I tried comparing the byte with char with integer of ascii symbols, but there was type error

0

There are 0 best solutions below