No encuentro información para convertir un número entero a caracter. Es lo que se denomina función "itoa" (integer to ascii) y a ver si aquí alguien me puede ayudar. Pongo un script de ejemplo, para los que ya saben de esto verán que se explica por sí mismo:
.macro print var, len movq $1, %rax movq $1, %rdi movq $\var, %rsi movq $\len , %rdx syscall.endm.data num: .quad 1234 len_num = . -num msg: .string "Show the number like an ASCII: " len_msg = . -msg nl: .string "\n" len_nl = . -nl.bss buffer: .skip 6.globl _start.text _start: movq num, %r8 # r8 = num pointer addq $0, %r9 # r9 = counter of digits .procedure: addq $48, %r8 # digit converted to ascii movq %r8, buffer # Insert the ascii value on buffer cmpq $len_num,%r9 # If counter = lenght of num je .final # exit from the loop, otherwise incq %r8 # it will point to the next value incq %r9 # & incrementing the r9 counter loop .procedure .final: print msg, len_msg print buffer, 6 print nl, 2 # Exit movq $60, %rax movq $0, %rdi syscall
Poned el foco en el bucle .procedure que creo que está ahí el problema. Quizás tiene que ver que no sé convertir un dato numérico a string y poderlo desmenuzar dígito a dígito y ser convertido a ASCII. Es una suposición.
Espero que alguien encuentra la solución. Gracias de antemano.