section .bss
Buff resb 1
section .data
section .text
global _start
_start:
nop ; this no op keeps the debugger happy
Read: mov eax, 3 ; mov 3 to eax which is read syscall no
mov ebx, 0 ; fd 0 stdin
mov ecx, Buff ; mov address of Buff to ecx
mov edx, 1 ; mov read length to edx
int 80h ; call syscall
cmp eax, 0 ; compare eax with 0 eax is return value of syscall
je Exit ; jump if prev instruction is equal
cmp byte [Buff], 61h ; compare Buff with 'a' [Buff] is the value Buff point to
jb Write ; jump to Write label if com below 'a'
cmp byte [Buff], 7Ah ; compare Buff with 'z'
ja Write ; if above 'z' not lowercase 'z' at this point, we have a lowercase
sub byte [Buff], 20h ; subtract 20h from buff
Write: mov eax, 4 ; write syscall
mov ebx, 1 ; stdout fd
mov ecx, Buff ; address of buff to ecx
mov edx, 1 ; number of chars to write
int 80h ; interupet syscall
jmp Read ; jump back to Read label
Exit: mov eax, 1 ; exit syscall
mov ebx, 0 ; exit number 0
int 80h ; make syscall