Hello everyone I just have a problem with my code. I just wrote a program that prints the sum of all even numbers (1 to 100) using macros in assembly language but it does not work can any one help me? I am using EMU8086 editor software.

.MODEL SMALL
.STACK
.DATA
X DB 1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100
MSG DB "SUM IS: $"
.CODE
PRIN MACRO
AAM
ADD AX,100H
mov bl,48 

MOV DH,AL
MOV DL,AH
MOV AH,02H
INT 21H

MOV DL,DH
MOV AH,02H
INT 21H
ENDM
MAIN PROC
MOV AX,@DATA
MOV DS,AX

MOV DX,OFFSET MSG
MOV AH,09H
INT 21H

mov si,0
mov bl,0
top:mov ax,0
mov al,x[si]

mov cl,2
div cl
cmp ah,0
jne l1
add bl,x[si]
l1: inc si
cmp si,10
jnz top

mov ax,0
mov al,bl
PRIN

mov ah,4ch
int 21h
main endp
end main
MAIN ENDP
END MAIN

Sorry but you made the assumption I remember what INT 21H does. This code is missing all comments plus what lines you think are in error. I've written assembly code for dozens of microprocessors and even a GE-210. Get that code commented fast.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.