# Calender

[b][red]This message was edited by mhmo at 2003-12-24 2:31:39[/red][/b][hr]
Hi all,

My friend asked me to help him in his work.
He need a program in assembly language using masm for X86 (DOS).

the program is :

Complete program using 80x86 assembly language to display a universal Gregorian calendar.

1.1 SPECIFICATIONS:
1. The program must be developed using MASM programming language.
2. The program is intended to run in DOS environment.
3. The program prompts a user to enter a month and a year and then it displays the Gregorian calendar of that month and year.
4. The program should run like the following example:

Example:
Enter a month (1 12): 11
Enter a year (>1580): 2001

November 2001

Sat Sun Mon Tue Wed Thu Fri
---------------------------
1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

The Algorithm:
a. The year X is a leap year (366 days: Feb=29 days) if the year X fulfills ((X % 4==0) && (X % 100 != 0)) || (X % 400 ==0).
b. January 1st, 1600 is On Saturday.
c. The calendar has a period of 400 years. It means that the calendar of year X is exactly the same with the calendar of year X+400.

Example:
Q: What day was February 13, 1601?
ICS-232 Computer Organization & Assembly Language (031) 1
ICS-232 Computer Organization & Assembly Language (031) 2A: Between January 1st, 1600 and January 1st, 1601 there were 366 days because year 1600 was a leap year. So, January 1st, 1601 was on (366 % 7) = 2 (Monday). Next, Between January 1st 1601 and February 13, 1601 inclusively there were (31 + 13 1) = 43 days. Thus, February 13, 1601 was on (2 + 43) % 7 = 3 (Tuesday).

So Can any body help him in doing this program?