Ex 3.2 - l1:add ax[num1 bx add number to ax add bx 2 advance bx to next index cmp bx 20 are we beyond the last index jne l1 if not add next number

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Sheet1 Page 1 a program to add ten numbers without a separate counter [org 0x0100] jmp start unconditionally jump over data num1: dw 10, 20, 30, 40, 50, 10, 20, 30, 40, 50 total: dw 0 start: mov bx, 0 initialize array index to zero mov ax, 0 initialize sum to zero
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: l1:add ax, [num1+bx] add number to ax add bx, 2 advance bx to next index cmp bx, 20 are we beyond the last index jne l1 if not add next number mov [total], ax write back sum in memory mov ax, 0x4c00 terminate program int 0x21...
View Full Document

This note was uploaded on 11/06/2010 for the course UBIT 411 taught by Professor Saleemelahi during the Spring '10 term at University of Karachi.

Ask a homework question - tutors are online