Instructions
Objective
Write a program that allows users to multiply 2 arrays using Yasm assembly language.
Requirements and Specifications
The task in the main section is to explicitly follow the equation and iteratively add -3 to the indexed value in array a, subtract the indexed value in array b by 14 and finally addthese two parts and store the resulting value in memory location result.
You are allowed to use a maximum of three general purpose registers in this lab. You are not allowed to change any values in the memory locations of a and b. Some of the opcodes of use in this lab are:
- mov - moving data from register-register, register-variable etc
- lea - loading the effective address of a variable to a register.
- add - adding two values in registers or in variables.
- sub - subtract two values in registers or in variables
Screenshots of output

Source Code
segment .data
a dw -4, 22, 144 ; array of 3 values
b db -3, -16, 12 ; array of 3 values
result dq 0 ; memory to result
segment .text
global main
main:
mov rcx, 0 ; rcx will be i in the loop, initialize to 0
sumloop:
movsx rax, word[a + rcx*2] ; load word value a[i]
add rax, -3 ; add -3 to get (-3 + a[i])
movsx rbx, byte[b + rcx] ; load byte value b[i]
sub rbx, 14 ; subtract 14 to get (b[i]-14)
add rax, rbx ; add (-3 + a[i]) + (b[i]-14)
add [result], rax ; add this result to total result
inc rcx ; increment i
cmp rcx, 3 ; compare i with 3
jl sumloop ; repeat while i < 3
xor rax, rax ; zero out rax
xor rbx, rbx ; zero out rbx
xor rcx, rcx ; zero out rcx
ret