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

Help with homework In nasm 64-bit platform please The rule for determining wheth

ID: 3729993 • Letter: H

Question

Help with homework In nasm 64-bit platform please

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 any

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:

./LeapYear
Enter a year:
2008
2008 is a leap year.

./LeapYear
Enter a year:
2007
2007 is not a leap year.

Explanation / Answer

section .data msg db 'Enter a year ' , 10 msglen equ $-msg leapYear db ' is a leap year.', 10 leapYearLenght equ $-leapYear noLeapYear db ' is not a leap year.', 10 noLeapYearLenght equ $-noLeapYear section .bss year resd 1 section .text global main main: mov eax,4 mov ebx, 0 mov ecx, msg mov edx, msglen int 0x80 mov eax, 3 mov ebx, 0 mov ecx, year mov edx, 4 int 0x80 mov eax, 4 mov ebx, 1 int 0x80 mov edx, 0 mov eax, ecx mov ebx, 4h div ebx ; step 3 mov eax, edx cmp eax, 0 jne NoLeapYear je L1 L1: mov edx, 0 mov eax, ecx mov ebx, 64h div ebx ; step 2 mov eax, edx cmp eax, 0 je L2 jne LeapYear L2: mov edx, 0 mov eax, ecx mov ebx, 190h div ebx ;step 1 mov eax, edx cmp eax, 0 je LeapYear jne NoLeapYear LeapYear: ; step4 mov eax, 4 mov ebx, 1 mov ecx, leapYear mov edx, leapYearLenght int 0x80 jmp Exit NoLeapYear: ; step 5 mov eax, 4 mov ebx, 1 mov ecx, noLeapYear mov edx, noLeapYearLenght int 0x80 jmp Exit Exit: mov eax, 1 mov ebx, 0 int 0x80

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote