I'm starting in Assembly development. Then recently i buy a book of Assembly, in it i have the table with the decimal numbers to hexamals and to binarys, like this:

Dec - Hex
1 - 01
2 - 02
3 - 03
4 - 04
10 - A
11 - B
12 - C
13 - D
14 - E
15 - F

And at thee appendix of the book i have the conversions of all the numbers and ASCII to hexamal and to binary, but i want to know what is the calc to convert decimal numbers in hexamal, like 63 = 3F , what is the calc that i have to do to tranform 63 in hexamal that is 3F, this is just to learn more.

Nathan Paulino Campos

All values stored in memory are represented in binary,
so I would assume that if you had a decimal value
it would be the ASCII representation of a decimal value,
as if it were entered in by the keyboard.
So the value 63 would be represented thus in ASCII:
36h='6' 33h='3'
All you would need to do is turn that ASCII representation
into a value in memory, then convert that to hexadecimal.
So 63=6*10+3*1, thats how you do it.
To turn a value in memory into the ASCII representation
of a hexadecimal value, bitshifting is employed:

mov al,63
mov bl,al
shr al,4
xor ah,ah
mov si,ax
mov dl,[hexdig+si]
call print
mov al,bl
shl al,4
shr al,4
xor ah,ah
mov si,ax
mov dl,[hexdig+si]
call print
int 20h
mov ah,02
int 21h
hexdig db '0123456789ABCDEF'

H = 15 , why the h after all the numbers that you have entered in the beginning of your answer?
Why 36 and 33?


And i want to know how to calculate this using a calculator.

Now i know, like 42, in hexamal it will be 2A and the calc is this: 42 = 16 * 2 + 10 , because 42 was divided by 16 with the quotient 2 and the remainder is 10, the it will be 2A.
Thanks for Jester01 in the ##asm channel of FreeNode that helped me with this!