In: Computer Science
Write an assembly language program to define an array of 5 double words initialized to 33,44,25,72,23,11 (all decimal). Add the first three numbers together and subtract the last two numbers from the sum. Store the sum in EAX register. Display the sum by using Irvine32 library procedures or by dumping registers to the display and taking a screenshot.
INCLUDE Irvine32.inc
main:
push rbp
mov rbp, rsp
movsd xmm0, QWORD PTR .LC0[rip]
movsd QWORD PTR [rbp-64], xmm0
movsd xmm0, QWORD PTR .LC1[rip]
movsd QWORD PTR [rbp-56], xmm0
movsd xmm0, QWORD PTR .LC2[rip]
movsd QWORD PTR [rbp-48], xmm0
movsd xmm0, QWORD PTR .LC3[rip]
movsd QWORD PTR [rbp-40], xmm0
movsd xmm0, QWORD PTR .LC4[rip]
movsd QWORD PTR [rbp-32], xmm0
movsd xmm0, QWORD PTR .LC5[rip]
movsd QWORD PTR [rbp-24], xmm0
movsd xmm1, QWORD PTR [rbp-64]
movsd xmm0, QWORD PTR [rbp-56]
addsd xmm1, xmm0
movsd xmm0, QWORD PTR [rbp-48]
addsd xmm0, xmm1
movsd QWORD PTR [rbp-8], xmm0
movsd xmm1, QWORD PTR [rbp-32]
movsd xmm0, QWORD PTR [rbp-8]
subsd xmm0, xmm1
movsd xmm1, QWORD PTR [rbp-24]
subsd xmm0, xmm1
movsd QWORD PTR [rbp-8], xmm0
mov eax, xmm0
call WriteInt
pop rbp
ret
.LC0:
.long 0
.long 1077968896
.LC1:
.long 0
.long 1078329344
.LC2:
.long 0
.long 1077477376
.LC3:
.long 0
.long 1079115776
.LC4:
.long 0
.long 1077346304
.LC5:
.long 0
.long 1076232192