To find Sum and Average of Block of n-Bytes > Assembly Language
Microprocessor
To find Sum and Average of Block of n-Bytes > Assembly Language
ASSUME CS:CODE , DS:DATADATA SEGMENT
BLOCK DB 10H,20H,30H,40H,50H
AVG DB ?
DATA ENDS
CODE SEGMENT
START :
MOV BX,DATA
MOV DS,BX
LEA SI,BLOCK
MOV AX,0000H
MOV CX,0005H
TOP :
ADD AL,[SI]
ADC AH,00H
INC SI
LOOP TOP
MOV BL,05H
DIV BL
MOV AVG,AL
MOV AH,4CH
INT 21H
CODE ENDS
END START
= File Edit View Run Breakpoints Data Options Window Help READY
+-[¦]-CPU 80486-------------------------------------------------------1----[?]-+
¦ cs:0003 8EDB mov ds,bx ¦ ax 0030 ¦c=0¦
¦ cs:0005 BE0000 mov si,0000 ¦ bx 5B05 ¦z=0¦
¦ cs:0008 B80000 mov ax,0000 ¦ cx 0000 ¦s=0¦
¦ cs:000B B90500 mov cx,0005 ¦ dx 502C ¦o=0¦
¦ cs:000E 0204 add al,[si] ¦ si 0005 ¦p=1¦
¦ cs:0010 80D400 adc ah,00 ¦ di 2D28 ¦a=0¦
¦ cs:0013 46 inc si ¦ bp 0100 ¦i=1¦
¦ cs:0014 E2F8 loop 000E ¦ sp 0000 ¦d=0¦
¦ cs:0016 B305 mov bl,05 ¦ ds 5B19 ¦ ¦
¦ cs:0018 F6F3 div bl ¦ es 5B09 ¦ ¦
¦ cs:001A A20500 mov [0005],al ¦ ss 5B19 ¦ ¦
¦ cs:001D?B44C mov ah,4C ¦ cs 5B1A ¦ ¦
¦ cs:001F CD21 int 21 ¦ ip 001D ¦ ¦
¦ cs:0021 0000 add [bx+si],al ¦ ¦ ¦
¦ cs:0023 0000 add [bx+si],al ¦ ¦ ¦
¦-------------------------------------------------------------+----------------¦
¦ ds:0000 10 20 30 40 50 30 00 00 ? 0@P0 ? ss:0008 0000 ¦
¦ ds:0008 00 00 00 00 00 00 00 00 ¦ ss:0006 0000 ¦
¦ ds:0010 BB 19 5B 8E DB BE 00 00 +?[Ħ+ ¦ ss:0004 3050 ¦
¦ ds:0018 B8 00 00 B9 05 00 02 04 + ¦? ?? ¦ ss:0002 4030 ¦
¦ ds:0020 80 D4 00 46 E2 F8 B3 05 Ç+ FG°¦? ? ss:0000?2010 ¦
+?¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦?-----------------+
Comments
Post a Comment