Assembly program: Sums the values of an array with 10 elements and stores the result in a variable named Sum

Here is an example assembly program that sums the values of an array with 10 elements and stores the result in a variable named Sum:

```asm
section .data
array db 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
arraySize equ 10
Sum db 0

section .text
global _start

_start:
mov ecx, arraySize ; Counter to loop through array elements
mov esi, 0 ; Index of current array element
movzx ebx, byte[array + esi] ; Move first element of the array into ebx register
add [Sum], ebx ; Add current element to Sum

loop_start:
inc esi ; Increment the index of array elements
movzx ebx, byte[array + esi] ; Move next element of the array into ebx register
add [Sum], ebx ; Add current element to Sum

loop loop_start ; Repeat until ecx is zero

; Print the result
mov eax, 4
mov ebx, 1
mov ecx, Sum
mov edx, 1 ; the length of the string to be printed
int 0x80

; Exit the program
mov eax, 1
xor ebx, ebx
int 0x80
```

In this code, the array is defined using the `db` (define byte) directive in the `.data` section. The size of the array is defined with the `arraySize` constant, and the initial value of `Sum` is set to 0.

The program starts by loading the value of the first array element into the `ebx` register using the `movzx` (move with zero extend) instruction. It then adds this value to the memory location pointed by `Sum` using the `add` instruction.

A loop is then set up using the `ecx` register as a counter to iterate through the remaining elements of the array. Inside the loop, the index of the array elements is incremented using the `inc` (increment) instruction, the next element is loaded into `ebx`, and it is added to `Sum` using the `add` instruction. The `loop` instruction is used to repeat this process until the counter reaches zero.

After the loop, the program uses the `eax` register to set up the `write` system call, and the `int 0x80` instruction triggers the system call to write the value of `Sum` to the standard output.

Finally, the program exits using the `exit` system call by setting up the `eax` register with the appropriate value and triggering another system call with `int 0x80`.

Sure, here's a step-by-step assembly program to sum the values of an array with 10 elements and store the result in a variable named Sum. Let's assume the array is stored in memory starting from memory locations 0x1000 and the variable Sum is stored in memory location 0x2000.

Step 1: Initialize the loop counter and the sum
```
MOV CX, 10 ; Initialize the loop counter to 10 (number of elements in the array)
MOV BX, 0 ; Initialize the sum to 0
```

Step 2: Set up a loop to iterate over the array elements
```
MOV SI, 0x1000 ; Starting address of the array
```

Step 3: Loop through the array and add each element to the sum
```
LOOP_START:
MOV AX, [SI] ; Load the value of the current element into the AX register
ADD BX, AX ; Add the value of the current element to the sum in BX register

ADD SI, 2 ; Move the pointer to the next array element (assuming each element is 2 bytes)

LOOP LOOP_START ; Decrement the loop counter (CX) and continue looping until CX becomes zero
```

Step 4: Store the final sum in the Sum variable
```
MOV [0x2000], BX ; Store the final sum in memory location 0x2000 (Sum variable)
```

That's it! The program will sum the values of the array and store the result in the variable named Sum.