1
I made this code that reads a sentence and determines whether the first letter is uppercase or not, now I have to sweep the entire sentence by changing where it’s lowercase to uppercase, but I’m having a problem with how to do this.
segment .data
msn db "Entre com uma frase:",sl
tam equ $-msn
msn1 db "Sua frase comeca com letra maiuscula:", sl
tam1 equ $-msn1
msn2 db "Sua frase nao comeca com letra maiuscula:",sl
tam2 equ $-msn2
msn3 db " ",sl
tam3 equ $-msn3
sl equ 10
segment .bss
buf resb 100
buf2 resb 2
segment .text
global main
main:
;exibe string
mov edx,tam ;tamanho
mov ecx,msn ;ponteiro
call print_str
;ler strim
mov edx,100 ;tamanho da string
mov ecx,buf ;destino
mov ebx, 0 ;Teclado
mov eax, 3 ;read
int 0x80
mov al,[buf +0]
mov [buf2],al
cmp byte[buf2,0],65
jl minusculo
cmp byte[buf2,0],90
jg minusculo
mov edx,tam1
mov ecx, msn1
call print_str
jmp fim
minusculo:
mov edx,tam2
mov ecx, msn2
call print_str
fim:
mov edx,tam3
mov ecx,msn3
call print_str
; ----------------- AREA DOS PROCEDIMENTOS ------------------
print_str:
mov ebx, 1 ; Descritor (monitor = 1)
mov eax, 4 ; Servico (print)
int 0x80 ; Executa (exibe)
ret ; Devolve ao chamador