0

I am trying to write a function that gets an hexadecimal value and pointer of array and convert the hexadecimal letters into string and store the string inside an array
example:
if the function gets the value 0xAC45 the string will be 'AC45' and it will be stored inside the array

I started this code but I have no clue what I need to do from here because I dont know how to take each letter of the value
Please help if you know how can I do it

org 100h

jmp main
array       db "0000", 0Dh,0Ah, 24h
num1        dw 0xAC45

main:

push num1
push offset array

call convertToString

proc convertToString
    
    push bp
    mov bp, sp
    
    push bx
    push si
    
    mov bx, [bp+6] ; getting num1
    mov si, [bp+4] ; getting the address of the array
    ; how can I take each letter of the hexadecimal number          
    ret

endp convertToString
Peter Cordes
  • 286,368
  • 41
  • 520
  • 731

0 Answers0