Advertisement
Guest User

Probl6

a guest
Nov 22nd, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. bits 32
  2. global start        
  3.  
  4. extern exit, printf, scanf
  5. import exit msvcrt.dll
  6. import printf msvcrt.dll
  7. import scanf msvcrt.dll
  8.  
  9. segment data use32 class=data
  10.     ; ...
  11.     sir dw 12345, 20778, 4596
  12.     lSir equ ($-sir)/2
  13.     dest times lSir*8 db 0
  14.     nrCifre db 0
  15.     nrZece db 0ah
  16.  
  17. ; segmentul de cod
  18. segment code use32 class=code
  19.     start:
  20.         ; ...
  21.         mov eax, 0
  22.         mov esi, sir
  23.         mov edi, dest
  24.         mov ecx, lSir
  25.         repetaIaNumar:
  26.             mov [nrCifre], byte 0
  27.             lodsw
  28.             mov ebx, eax
  29.             push ecx
  30.             repeta:
  31.                 cwd
  32.                 idiv word[nrZece]
  33.                 mov bx, ax
  34.                 mov ax, dx
  35.                 cwde
  36.                 push eax
  37.                 inc byte[nrCifre]
  38.                 mov ax, bx
  39.                 cmp ax, 0
  40.             jnz repeta
  41.             mov ecx, 0
  42.             mov cl, byte [nrCifre]
  43.             repetaPuneInDest:
  44.                 pop eax
  45.                 stosb
  46.             loop repetaPuneInDest
  47.             pop ecx
  48.         loop repetaIaNumar
  49.         ; exit(0)
  50.         push    dword 0      ; push the parameter for exit onto the stack
  51.         call    [exit]       ; call exit to terminate the program
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement