0

This is my MASM32 code:

include\masm32\include\masm32rt.inc
.data
    n dd 0
.code

convertBH proc num:dword, output:dword
    local temp:dword
    local index:dword
    local hex:dword
    local remainder:dword
    mov index, 1
    mov hex, 0
    
  laplai:
    mov edx, 0
    mov eax, num
    mov ebx, 10
    div ebx
    mov remainder, edx

    mov eax, remainder
    mul index
    lea eax, [eax + hex]
    mov hex, eax
    
    mov eax, index
    mov ebx, 2
    mul ebx
    mov index, eax

    mov eax, num
    mov ebx, 10
    div ebx
    mov num, eax
    cmp num, 0
    jne laplai
    je ketthuc
            
  ketthuc:
    print str$(hex)
    ret
convertBH endp

start:
    mov n, sval(input("Moi ban nhap so n: "))
    invoke convertBH,n
    exit
end start

If there is other code than mine, please give it to me, I'm writing in masm32.

3

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.