Untitled

Posted on March 6, 2010, 9:32 pm UTC anonymously (about 1 year ago)

Code (highlighted for ASM)

  1. atod:
  2.         mov bp,sp
  3.         mov bx,[bp+0x2]
  4.         push bx
  5.         call strlen
  6.         add bx,ax
  7.         ;xor di,di
  8.         mov al,1
  9.         xor cx,cx
  10.         atod_f1:
  11.                 mov dl,[bx]
  12.                 cmp dl,'0'
  13.                 jl      atod_exit
  14.                 cmp dl,'9'
  15.                 jg      atod_exit
  16.                
  17.                 push dx
  18.                 push ax
  19.                 sub     dl,0x30
  20.                 mul dl
  21.                
  22.                 add cx,ax
  23.                 pop ax
  24.                
  25.                 mov dl,10
  26.                 mul dl
  27.                 pop dx
  28.                
  29.                 dec bx
  30.                 cmp bx,[bp+0x2]
  31.                 jz atod_exit
  32.                 jmp atod_f1
  33.         atod_exit:
  34.                 mov ax,cx
  35.                 ret 2