是这么一段代码,来自于《Intel汇编语言程序设计》(第四版)
;----------------------------------------------------------------------------
ArraySum PROC
;
; Calculates the sum of an array of 32-bit integers.
; Receives : ESI = the array offset
; ECX = number of elements in the array
; Returns : EAX = sum of the array elements
;----------------------------------------------------------------------------
push esi ; save ESI,ECX
push ecx
mov eax,0 ; set the sum to zero
L1:
add eax,[esi] ; add each integer to sum
add esi,4 ; point to next integer