I am new to assembly and am programming in linux 64 bit in AT&T syntax. If I store the number 1 in a register, how can I translate that to the ascii character "A"? For example:
movl $1, %ebx
addl $64, %ebx
Can I add 64 to 1 to make 65 (the decimal value of A), then somehow convert it to "A" and send this to the buffer using write system call?
EDIT 1: Posting my program code here.
.section .data
message:
.long 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
length:
.long 10
.section .text
.globl _start
_start:
xorq %rdi, %rdi
xorq %rax, %rax
xorq %rbx, %rbx
xorq %rcx, %rcx
xorq %rdx, %rdx
movl length, %edx
loop:
cmpl %ecx, %edx
je loop_end
movl message(,%rdi,4), %eax
addl $64, %eax
pushq %rax
incq %rdi
incq %rcx
jmp loop
loop_end:
cmpq $0, %rcx
je exit
popq %rbx
pushq %rcx
movq $1, %rax
movq $1, %rdi
movq %rbx, %rsi
movl length, %edx
syscall
popq %rcx
decq %rcx
jmp loop_end
exit:
movq $60, %rax
movq $0, %rdi
syscall