CS401 ASSIGNMENT 1 SOLUTION 2021 | CS401 ASSIGNMENT 1 FALL 2021 | CS401 ASSIGNMENT 1 2021 | COMPUTER ARCHITECTURE I VuTech
KINDLY, DON’T COPY PASTE
Visit Website For More Solutions
www.vutechofficial.blogspot.com
SOLUTION:
[org
0x0100]
;ordinary
jmp begin
VU_ID: dw 1,
8, 0,
2, 0,
0, 1,
1, 6
; array - consecutive memory
locations (2 bytes per index)
sum: dw
0
; variable
; mnemonic destination, source
begin:
mov ax,
0
; the result of addition will be stored in the AX register
mov bx,
VU_ID
; address will be stored in the BX register
mov cx,
9
; the count of nine digits will
be stored in the CX register
; 0 - 0 == 0
continue_Process: cmp word [bx],
0
; non-destructive subtraction in other words, the result of subtraction
does not store anywhere but this result
; is used to set the flags only
je check_Is_Entire_Array_Traversed
; if the value of index
is equal to zero then jump (conditional jump)
add ax,
[bx]
; add index's value to the AX register's value
check_Is_Entire_Array_Traversed:
add bx,
2
; move to the next index
(remember this is a address)
sub cx,
1
; decrement our count
jnz continue_Process
; continue process if the entire is not traversed
mov [sum],
ax
; total sum is stored in variable
terminate: mov ax,
0x4c00
; ending instructions
int 0x21
KINDLY, DON’T COPY PASTE
SUBSCRIBE, SHARE, LIKE AND COMMENTS FOR MORE UPDATES
SEND WHATSAPP OR E-MAIL FOR ANY QUERY
0325-6644800
kamranhameedvu@gmail.com
Visit Website For More Solutions
www.vutechofficial.blogspot.com