Computer Organization and Assembly. Sum of 2 arrays

Computer Organization and Assembly. Sum of 2 arrays

Computer Organization & Assembly

Final Project

Name: Hadi Ismail
ID: 12120720
Instructor: Abbas Tarhini


Title Sum of 2 arrays

Include irvine32.inc

.data
array1 dword 10 DUP (?)
array2 dword 10 DUP (?)
array3 dword 10 DUP (?)
msg1 byte "Fill the 1st array:",0
msg2 byte "Enter a number:",0
msg3 byte "Fill the 2nd array:",0
msg4 byte "3rd array will contain:",0

.code
main PROC
mov eax,0
mov edx,OFFSET msg1
call writeString
call crlf
call Fillarray
call sum

mov esi,0
mov ecx,LENGTHOF array3
mov edx,OFFSET msg4
call writeString
call crlf

L4:
mov eax,array3[esi]
call writeint
add esi,TYPE array3
call crlf
Loop L4
call waitmsg

main ENDP
Fillarray PROC

mov ecx,LENGTHOF array1
mov esi,0

L1:
mov edx,OFFSET msg2
call WriteString
call readInt
call crlf
mov array1[esi],eax
add esi,Type array1
LOOP L1

mov edx,OFFSET msg3
call writeString
call crlf

mov ecx,LENGTHOF array2
mov esi,0

L2:
mov edx,OFFSET msg2
call WriteString
call readInt
call crlf
mov array2[esi],eax
add esi,Type array2

LOOP L2

ret

Fillarray ENDP
sum PROC
MOV ecx,LENGTHOF array3
MOV esi,0
L3:
mov ebx,array2[esi]
add array1[esi],ebx
mov eax,array1[esi]
mov array3[esi],eax
add esi,TYPE array3

Loop L3
ret
sum ENDP
END main


Title Simple Calculator

include irvine32.inc

.data
m1 byte "what do u wanna calculate:"
operator byte ?
equal byte ?
num1 dword ?
num2 dword ?

.code
main PROC

mov edx,OFFSET...

Similar Essays