0

I'm trying to write a long program that converts a decimal input to a hexadecimal input and octal and so on.

I pretty much did everything but I got a little bid stuck in the hexadecimal part. I know that I have to divide the number by 16 until the coefficient is 0; then the remainder is the hex numbers. However, hexadecimal numbers from 10 to 15 should be A, B, C, D, E and F.

I wasn't sure how to do this with push and pop.

Here is what I did so far for the hexadecimal part:

  hex:
  lable:
  mov  edx, 0
  mov ebx, 16
  div ebx


  push edx
  Inc count
  cmp eax, 0
  jne lable
  mov ecx, count
  lable2:
  pop eax
  call writedec
  loop lable2
  ret
  jmp stop

It gives me the right value, however, I need 14 for instance to be E, and so on

Any idea?

4

0 に答える 0