codice:
section .data
str db "Ciao non mi chiamo mario", 0
carattere db 'O'
index db ?
xor index, index
xor ax, ax
for:
mov ah, byte [str + index] ;; ah = *(str + index)
inc index ;; index++
cmp ah, 0 ;; ah == 0 ?
jz exitfor ;; if (ah == 0) goto exitfor
cmp ah, carattere ;; ah == carattere ?
jz toupper ;; if(ah == carattere) goto tolower
jump for
toupper:
and ax, 0x5F ;; ax &= 0x5F
mov byte [str + index - 1], ah ;;*(str + index - 1) = ah
jump for
exitfor:
;;...Codice...
EDIT: mi sono accorto che non è MIPS , la logica è comunque la stessa