I was trying to create a simple assembly program that prints the ascii character whose binary code is in rax. I have the following code:
section .data
res db '', 0
global _start
_start:
mov rbx, 1000001
mov [res], rbx
mov rax, 1
mov rdi, 1
mov rsi, res
mov rdx, 1
syscall
mov rax, 60
xor rdi, rdi
syscall
When I execute, it outputs 'A', which is correct since 1000001 is the binary code for ascii A, but if I execute this:
section .data
res db '', 0
global _start
_start:
mov rbx, 1000010
mov [res], rbx
mov rax, 1
mov rdi, 1
mov rsi, res
mov rdx, 1
syscall
mov rax, 60
xor rdi, rdi
syscall
It outputs 'J', but according to the table I used 1000010 should output 'B'. What makes this even stranger for me is that if I use decimal instead of binary I get the right output. What am I doing wong?