assembly - given hex input should be convert to decimal -


pretty new assembly !!

my assembly code takes hex input 0-9 , a-f other inputs result error, every character of input stored in array , every element in array taken print integer value, reason elements address printing. please see code below , give me solution problem. if need full code please let me know.

(the idea of below code take each element of hex number , print elements in decimal number)

        mov     ebx, array                next_loop:                              ;this loop convert character          mov     al, [ebx]         cmp     al, newline        ; here newline 10 defined         je      end_loop                    cmp     al, 97                     jge     subblock         jl      numsub  numsub:         sub     al, 48         mov     [ebx], al         jmp     next  subblock:         sub     al, 97         add     al, 10         mov     [ebx], al         jmp     next  next:         inc     ebx         loop    next_loop  ; below code print value stored in array   end_loop:         mov     ebx, array         mov     eax, message2         call    print_string  print_loop:         mov     al, [ebx]         inc     ebx         call    print_int      ; addresses of ebx printing not value         cmp     al, newline         jne     print_loop                  jmp     finalend 

please resolve problem. many thanks.

without knowing print_int procedure, i'd assume 1 problem. should involve adding couple of square brackets when pushing register has value, assuming using printf.


Comments

Popular posts from this blog

facebook - android ACTION_SEND to share with specific application only -

python - Creating a new virtualenv gives a permissions error -

javascript - cocos2d-js draw circle not instantly -