I am pretty new to assembly and currently trying to write a programm that executes a caesar encryption with a user specified key and user specified content. The key and the content have to be a-z or A-Z and to verify that, I build a simple algorithm checking if the ascii value is in the corresponding range. The problem is that even when given normal characters a-z or A-Z, it still returns false.
This is a minimal reproducible example of my algorithm. Even though a is given to the algorithm, it still returns error. I have no idea why this is the case, I have checked the ascii table and everything.
section .text
global _start
_start:
cmp byte [char], 123
jg _error
cmp byte [char], 97
jg _success
cmp byte [char], 90
jg _error
cmp byte [char], 65
jg _success
jmp _error
_success:
mov rax, 1
mov rdi, 1
mov rsi, success
mov rdx, len_success
syscall
xor rbx, rbx
jmp _exit
_error:
mov rax, 1
mov rdi, 2
mov rsi, error
mov rdx, len_error
syscall
mov rbx, 1
jmp _exit
_exit:
mov rax, 60
mov rdi, rbx
syscall
section _data
char db 'a'
error db "Error"
len_error equ $ - error
success db "Success"
len_success equ $ - success