An 8086 assembly language program that finds the sum of 10 consecutive byte values stored in an array in the memory. The result should be stored in AX register – IGNOU MCA Assignment 2017 – 18

By | December 19, 2017

MASTER OF COMPUTER APPLICATIONS

Course Code : MCSL-017
Course Title : C and Assembly Language Programming (Lab Course)
Assignment Number : MCA(1)/L-017/Assignment/17-18
Maximum Marks : 50
Weightage : 25%

Write and run (using appropriate calling program) a near procedure in 8086 assembly language that accepts an ASCII value as a parameter in AL register and displays this value on the output screen – IGNOU MCA Assignment 2017 – 18

Code:-

DATA SEGMENT
ARR DB 5,3,7,1,9,2,6,8,4,10
LEN DW $-ARR
SUM DW ?
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX

LEA SI,ARR
MOV AX,0
MOV CX,LEN
REPEAT:
MOV BL,ARR[SI]
MOV BH,0
ADD AX,BX

INC SI
LOOP REPEAT

MOV SUM,AX

MOV AH,4CH
INT 21H
CODE ENDS
END START

[codesyntax lang=”asm”]

DATA SEGMENT
ARR DB 5,3,7,1,9,2,6,8,4,10
LEN DW $-ARR
SUM DW ?
DATA ENDS

CODE SEGMENT
ASSUME DS:DATA CS:CODE
START:
MOV AX,DATA
MOV DS,AX

LEA SI,ARR
MOV AX,0
MOV CX,LEN
REPEAT:
MOV BL,ARR[SI]
MOV BH,0
ADD AX,BX

INC SI
LOOP REPEAT

MOV SUM,AX

MOV AH,4CH
INT 21H
CODE ENDS
END START

[/codesyntax]

Screen Shots :-

Asm_program_Sum_in_Array

Before Execution :-

Asm_program_Sum_in_Array_v1

After Execution :-

Asm_program_Sum_in_Array_v2

Note :- To see the variable and its value you have to click vars button in the emulator.