Tuesday, March 11, 2014

ARRAY in ASSEMBLY LANGUAGE

.model small
.stack 64
.data
msg db 'enter first  numbers ','$'
msg1 db 'sum of two numbers  is: ','$'
msg2 db 'enter 2nd number ','$'
chars1 db 10 dup(?),'$'
chars2 db 10 dup(?),'$'
chars3 db 10 dup(0),'$'
.code
main proc near
mov ax,@data
mov ds,ax

mov ah,9h
lea dx,msg
int 21h

lea si,chars1
mov cx,4

pawan:
mov ah,1h
int 21h
mov [si],al
inc si
loop pawan

lea si,chars2
mov cx,4

mov ah,9h
lea dx,msg2
int 21h

pawan1:
mov ah,1h
int 21h

mov [si],al

inc si
loop pawan1

mov ah,9
lea dx,msg1
int 21h
mov cx,4

lea di,chars1+3
lea si,chars2+3
lea bx,chars3+4
mov cx,4

pawan2:
mov ax,[si]
adc al,[di]
aaa
mov [bx],al
dec si
dec di
dec bx
loop pawan2
mov [bx],ah
lea bx,chars3+4
mov cx,5

pawan3:
or byte ptr[bx],30h
dec bx
loop pawan3

mov ah,9
lea dx,chars3
int 21h

mov ax,4c00h
int 21h
main endp
end main

No comments:

Post a Comment

Contributors

Translate