EDIT:
(Sorry decimal to hexadecimal my bad)
I have been trying to make a decimal to hexadecimal converter and I need to use conditional jumps to test if the number is 10 or over so I can print a letter instead of a number here is my code so far
toHex:
;[reg+k*ind]
push rbx;preserve value of rbx
mov rbx, 16
xor rcx, rcx;clear out rcx to use as counter
mov r9, Array;mov in the address of the array
dec rcx
mov qword [r9+8*rcx], 0;pre zero it
inc rcx
.top:
xor rdx, rdx;clear out rdx for division
div rbx;divide rax by 16
mov qword [r9+8*rcx], rdx;move the remainder into the array
inc rcx;increase the counter
cmp rax,0;if rax is not 0 then keep going
jne .top
.nextDgt:
dec rcx;get ready for the next
cmp qword [r9+8*rcx], 10;if greater than or equal to 10 then jump to printChar
jae printChar
lea r8, [r9+8*rcx];get the address of the next remainder to pass into itoa
mov r10, rcx;preserve the counter
call itoa;print the remainder
mov rcx, r10;restore the counter
printChar:
call PrintSTR
cmp qword [r9+8*rcx], 0;if 0 then done .
jne .nextDgt
pop rbx;restore value of rbx
.done:
ret
PrintSTR:
cmp qword [r9+8*rcx], 10
je n10
cmp qword [r9+8*rcx], 11
je n11
cmp qword [r9+8*rcx], 12
je n12
cmp qword [r9+8*rcx], 13
je n13
cmp qword [r9+8*rcx], 14
je n14
cmp qword [r9+8*rcx], 15
je n15
n10:
mov rdx, 8 ;length
mov rsi, 'A';variable
mov rdi,1
mov rax, 1
syscall
jmp .Return
n11:
mov rdx, 8 ;length
mov rsi, 'B';variable
mov rdi,1
mov rax, 1
syscall
jmp .Return
n12:
mov rdx, 8
mov rsi, 'C'
mov rdi,1
mov rax, 1
syscall
jmp .Return
n13:
mov rdx, 8
mov rsi, 'D'
mov rdi,1
mov rax, 1
syscall
jmp .Return
n14:
mov rdx, 8 ;length
mov rsi, 'E';variable
mov rdi,1
mov rax, 1
syscall
jmp .Return
n15:
mov rdx, 8 ;length
mov rsi, 'F';variable
mov rdi,1
mov rax, 1
syscall
.Return:
ret
but it is giving me these errors :
Convert.asm:79: error: symbol `printChar.nextDgt' undefined
Convert.asm:105: error: symbol `n10.Return' undefined
Convert.asm:114: error: symbol `n11.Return' undefined
Convert.asm:123: error: symbol `n12.Return' undefined
Convert.asm:132: error: symbol `n13.Return' undefined
Convert.asm:141: error: symbol `n14.Return' undefined