[Assembly x86-64]
Specifically, I am trying to convert 137,799 to a tetradecimal and then into an ASCII value, that should be "3830B" but I am getting "3830;", so my last digit is wrong for some reason. Here's my code:
; Part 1 - Successive division
mov eax, dword [iNum1] ; get the integer 137,799
mov rcx, 0 ; digitCount = 0
mov ebp, 14 ; set for dividing by 14
divideLoop:
mov edx, 0
div ebp ; divide by 14
push rdx ; push remainder
inc rcx
cmp eax, 0
jne divideLoop
; -----
; Part 2 - Convert remainders and store
mov rbx, num1String ; get addr of string
mov rsi, 0 ; index = 0
popLoop:
pop r8
add r8b, "0" ; converting to ASCII
mov byte [rbx+rsi], r8b
inc rsi
loop popLoop
mov byte [rbx+rsi], NULL
I don't see what I am doing wrong. Any help would be appreciated.