format ELF executable 3 entry start segment readable writeable buf rb 1 segment readable executable start: mov eax, 3 ; syscall "read" mov ebx, 0 ; stdin mov ecx, buf ; buffer for read byte mov edx, 1 ; len (read one byte) int 80h cmp eax, 0 ; EOF? jz exit xor eax, eax ; load read char to eax mov al, [buf] cmp eax, "A" ; see if it is in ascii a-z or A-Z jl print cmp eax, "z" jg print cmp eax, "Z" jle rotup cmp eax, "a" jge rotlow jmp print rotup: sub eax, "A"-13 ; do rot 13 for A-Z cdq mov ebx, 26 div ebx add edx, "A" jmp rotend rotlow: sub eax, "a"-13 ; do rot 13 for a-z cdq mov ebx, 26 div ebx add edx, "a" rotend: mov [buf], dl print: mov eax, 4 ; syscall write mov ebx, 1 ; stdout mov ecx, buf ; *char mov edx, 1 ; string length int 80h jmp start exit: mov eax,1 ; syscall exit xor ebx,ebx ; exit code int 80h