Saturday, December 5, 2009

8086 MASM PROGRAM TO FIND OUT WHETHER THE GIVEN YEAR IS A LEAP YEAR OR NOT

assume ds:data1,cs:code1
data1 segment
msg db 0ah,0dh,'enter the year$'
number db 6,0,6 dup('$')
ys db 0ah,0dh,'yes,it is a leap year$'
n db 0ah,0dh,'no,it is not a leap year$'
data1 ends
code1 segment
start:mov ax,seg data1
mov ds,ax
lea dx,msg

mov ah,09h
int 21h

lea dx,number
mov ah,0ah
int 21h
lea bx,number+4
mov ah,[bx]
mov al,[bx+1]
aad
mov bl,04h
div bl
and ah,0ffh
jz yes
lea dx,n
mov ah,09h
int 21h
jmp down
yes:lea dx,ys
mov ah,09h
int 21h
down: mov ah,4ch
int 21h
code1 ends
end start

2 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. lea dx,number
    mov ah,0ah
    int 21h
    lea bx,number+4
    mov ah,[bx]
    mov al,[bx+1]

    i want to know how these instructions works

    ReplyDelete