Question: Simple Assembly Language Programming: Leap Year NO PLAGIARISM, and dont answer if you don't know :) Please complete the following code. Only use of mov,
Simple Assembly Language Programming: Leap Year
NO PLAGIARISM, and dont answer if you don't know :)
Please complete the following code. Only use of mov, sub, mul, add, div and jmp are allowed, must be very simple, and call function for print_int only. All the code should be in main function, please dont add any new functions.
The input from the user should be string then we convert it to integer in then we can determine whether the year is leap or not.
Code:-----------------------
section .data
input1 db "Enter a year AD, for example 1997 : " len1 equ $ - input1
leap db " The year you entered is a leap" len2 db $ - leap
notLeap db "The year you entered is not a leap" len3 db $ - notLeap
eol db 0xA, 0xD eol_len equ $ - eol
section .bss year resb 2 intYear resb 2 ;RESERVE 1 BIT FOR DIGIT1
section .text global _start
;definging function print_int print_int: mov ebx, 1 ; file descriptor (stdout) mov eax, 4 ;system call number (sys_write) int 0x80 ;call kernel ret ; return back
_start: mov ecx, input1 ;disply the first messege to get the first digit mov edx, len1 ;BUFLEN call print_int
mov eax, 3 ;SYSCALL_READ mov ebx, 0 ;STDIN mov ecx,year int 0x80
mov edx, 1 call print_int mov ecx, eol mov edx, eol_len call print_int
mov eax, 1 int 0x80 ;system call number (sys_exit)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
