Advertisement
LincolnArantes

Passa letras para maiúsculo

Oct 31st, 2018
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Passa letras para maiúsculo
  2.  
  3. ;Lincoln Cesar dos Reis Arantes
  4.  
  5. section .text
  6.  
  7. global _start
  8.  
  9. _start:
  10.  
  11.         mov ecx, msg
  12.         call maisc  ;chama a função
  13.         call tela  ;chma a função
  14.        
  15.        
  16.         ;fim
  17.         mov eax,1
  18.         mov ebx,0
  19.         int 80h
  20.  
  21. maisc:
  22.         mov al,[ecx]      ; ecx is the pointer, so [ecx] the current char
  23.         cmp al,0x0
  24.         je pronto
  25.         cmp al,'a'
  26.         jb proximo
  27.         cmp al,'z'
  28.         ja proximo
  29.         sub al,0x20       ; move a al para super upper case
  30.         mov [ecx],al      ; escreve e volta para a msg
  31.  
  32. proximo:
  33.         inc ecx           ; incrementa
  34.                          
  35.         jmp maisc         ; pula para a função maisc
  36. pronto:   ret
  37.  
  38.  
  39. ; função para printar os dados na tela
  40. tela:  mov ecx, msg    ;mensagem
  41.         mov edx, len       ; tamanho
  42.         mov ebx, 1
  43.         mov eax, 4
  44.         int 80h
  45.         ret
  46.  
  47. section .data
  48. msg: db "lincoln cesar",10,0
  49. len:    equ $-msg
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement