Average of block of bytes in Assembly -masm 8086

Average of block of bytes in Assembly -masm 8086

org 100h
.model small
.data
ARR DB 10,9,8,7,6,5,4,3,2,1
arr_size = $ - offset ARR
sum db 0
avg db 0
.code
;Initilize Data Segment
mov ax,@DATA
mov DS,ax
;====find total sum of array
lea si,arr
mov cl,arr_size
mov ch,00h
L:
mov ah,sum
add ah,[si]
mov sum,ah
inc si
LOOP L
;=====find average==========
mov al,sum
mov ah,00h
mov bl,arr_size
div bl
mov avg,al
;to terminate program
mov ah,4ch
int 21h
ret

Advertisements

3 thoughts on “Average of block of bytes in Assembly -masm 8086

  1. You really make it appear so easy together with your presentation but I find this topic to be really something that I think I might by no means understand. It kind of feels too complicated and very huge for me. I am having a look ahead for your subsequent submit, I will attempt to get the cling of it!

    Like

  2. Fantastic site. Lots of helpful information here. I am sending it to a few friends ans additionally sharing in delicious. And of course, thank you for your sweat!

    Like

  3. hi!,I really like your writing very a lot! percentage we keep in touch extra approximately your post on AOL? I need an expert on this space to solve my problem. Maybe that’s you! Looking forward to look you.

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s