base convert

hi expertise,
how to convert decimal to hexa.
i did like this.

mov ax,12d ;ax=12 decimal
mov ah, 6 ; for output
mov dl, ax ;dl=ax
int 21h

but not work

please help me with example


  • Simply to convert the binary value in memory,
    into the printable ascii values,
    one has but to
    bit shift the operand by 4 to the right and left
    for the low half-byte operand << 4 : operand >> 4,
    and to the right 4 bits to get the high half-byte.
    It is then used as and index into a string of printable

    Here is an example using runtime code modification:
    jmp whocares
    therewego db '0123456789ABCDEF'
    ; get low half-byte....
    mov ah,101 ; move the decimal value 101 into AH
    mov cx,2
    rtcm db 088h,0E0h ; optionally move ah into al
    ; and vice versa
    ; using runtime code modification
    xor byte [rtcm],2 ; Change destination bit
    cmp cx,2
    je skip_bits_dot
    shl ah,4 ; bitshift left by 4
    shr ah,4 ; bitshift right by 4
    mov dx,0
    mov dl,ah
    mov si,dx ; put into index register
    mov bx,offset therewego
    mov dl,[bx+si]
    push ax
    mov al,dl
    int 29h
    pop ax
    dec cx
    jcxz leaving_please
    jmp doagain
    mov ax,4c00h
    int 21h

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


In this Discussion