Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

help with this nasm assembly problem pliz The rule for determining whether a yea

ID: 3729891 • Letter: H

Question

help with this nasm assembly problem pliz

The rule for determining whether a year is a leap year is that a year must be evenly divisible by 4, but not a multiple of 100, unless the year is a multiple of 400, which makes it a leap year anyway. 1. First write a set of instructions (algorithm) that can be used to determine whether a year is a leap year. You can use pseudo-code, but make sure you use only basic arithmetic/logic operations. Do not use any functions/Alibraries. 2. Now create an assembly source file called LeapYear.asm that, after being assembled, linked and executed, reads a single year (in the format 0001 to 9999) from user input, and outputs whether that year is a leap year or not, as per the following example: /Leap Year Enter a year: 2008 2008 is a leap year. /Leap Year Enter a year: 2007 2007 is not a leap year.

Explanation / Answer

Please find the MASM code below:

CODE

====================

assume ds:data1,cs:code1
data1 segment
msg db 0ah,0dh,'Enter a year: $'
number db 6,0,6 dup('$')
yes 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,axlea dx,msg
mov ah,09h
int 21hlea 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,yes
mov ah,09h
int 21h

down:
mov ah,4ch