Advertisement
Guest User

Untitled

a guest
Oct 29th, 2016
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MPASM 0.53 KB | None | 0 0
  1. Include Irvine32.inc
  2. .data
  3.     total byte "result : ", 0dh, 0ah, 0
  4.     intarray dword 1, 2, 3, 4
  5.     sum dword 0
  6. .code
  7.     main proc
  8.     mov esi, offset intarray        ; ESI = address of intarray
  9.     mov ecx, lengthof intarray      ; length of intarray
  10.     mov eax, 0
  11.     mov ebx, 0
  12.     L1:
  13.     add eax, [esi]                  ; add an array index
  14.     add esi, type intarray          ; point to next element
  15.     add sum, eax
  16.     call writeint
  17.     call crlf
  18.     Loop L1                         ; repeat until ecx == 0
  19.     mov edx, offset total
  20.     call writestring
  21.     mov ebx, sum
  22.     call writeint
  23.     exit
  24.     main endp
  25.     end main
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement