# Assembly Programming Using MASM plze help =(



## Anan786 (Mar 25, 2007)

Khan, Anan
CSC210
March 22nd, 2007
Project # 3

Ok my problem is that the professor says the code can be written in a page????? how i have been working on it for days.. someone please help me.. he also said we do not need the conditions.. such as cmp.. etc. =(, its due tommorow..someone please help

" Our third project will be to convert numerical dates into human dates, and also give which day out of 365 the day represents. There seems to be no easy way to read more than one number per line, so dates should be put like:

12
28
07

the output produced by this line should be:

December 28, 2007; day 362 of the year.

As always, print a suitable title. All dates will be from 2000 to 2099; pretend that every year has just 365 days. "

Here is my code i've got it to work..but he wants it shortened..

INCLUDE Irvine32.inc
.data

months	BYTE "January",0,0,0
BYTE "February",0,0
BYTE "March",0,0,0,0,0
BYTE "April",0,0,0,0,0
BYTE "May",0,0,0,0,0,0,0
BYTE "June",0,0,0,0,0,0
BYTE "July",0,0,0,0,0,0
BYTE "August",0,0,0,0
BYTE "September",0
BYTE "October",0,0,0
BYTE "November",0,0
BYTE "December",0,0

days DWORD	0,31,59,90,120,151,181,212,243,273,304,334

month	DWORD	?
day DWORD	?
year DWORD	?

myMSG1	BYTE "** Project 3 | by: khan, Anan **",0
myMSG2	BYTE "*********************************************",0
myMSG3	BYTE "** This program converts any given date to **",0
myMSG4	BYTE "** human notation and also tells which day **",0
myMSG5	BYTE "** of the year it is. **",0

instruct	BYTE "* Enter zero(0) at anytime to Terminate **",0
monthQ	BYTE "Enter Your Month (1-12): ",0
dayQ BYTE "Enter Your Day (1-31): ",0
yearQ	BYTE "Enter Your Year (01-07): ",0
dayNum	BYTE "This is day # ",0
findayNum	BYTE " of the year ",0
sessEnd	BYTE "Program Has Been Terminated!",0
comma	BYTE ", ",0
period	BYTE ".",0

.code
main PROC

display:
call Clrscr
mov edx,OFFSET myMSG2
call WriteString
call Crlf
mov edx,OFFSET myMSG1
call WriteString
call Crlf
mov edx,OFFSET myMSG2
call WriteString
call Crlf
mov edx,OFFSET myMSG3
call WriteString
call Crlf
mov edx,OFFSET myMSG4
call WriteString
call Crlf
mov edx,OFFSET myMSG5
call WriteString
call Crlf
mov edx,OFFSET myMSG2
call WriteString
call Crlf
call Crlf

begining:
mov edx, OFFSET myMSG2
call WriteString
call Crlf
mov edx, OFFSET instruct
call WriteString
call Crlf
mov edx, OFFSET myMSG2
call WriteString
call Crlf

;INPUT FROM USER: Month

mov edx, OFFSET monthQ
call Crlf
call Crlf
call WriteString
call ReadInt

;CHECKING...
cmp eax, 0
jle quitting
cmp eax, 12
jg begining

;INPUT FROM USER: Day
dayLabel:
mov month, eax
mov edx, OFFSET dayQ
call Crlf
call WriteString
call ReadInt

;CHECKING...
cmp eax, 0
jle quitting 
cmp eax, 31
jg dayLabel

;INPUT FROM USER: Year
yearLabel:
mov day, eax
mov edx, OFFSET yearQ
call Crlf
call WriteString
call ReadInt
mov year, eax

;CHECKING...
cmp eax, 2000
jle quitting
cmp eax, 3000
jg yearLabel

;CALCULATING THE INFORMATION

mov eax, month
sub eax, 1
mov ebx, 10
imul ebx
add eax, OFFSET months
mov edx, eax
call WriteString
mov edx, OFFSET comma
call WriteString
mov eax, day
call WriteDec
call WriteString
mov eax, year
call WriteDec
call Crlf

;DAYS in the year

call Crlf
call Crlf
mov esi, OFFSET days
mov ebx, month
dec ebx
mov eax, 4
imul ebx
mov eax, [esi+eax]
add eax, day
mov edx, OFFSET dayNum
call WriteString
call WriteDec
mov edx, OFFSET findayNum
call WriteString
mov eax, year
call WriteDec
mov edx, OFFSET period
call WriteString
call Crlf

;Going Back - Performs a loop to the begining, 
; clearing the screen after the user presses any key
call WaitMsg 
call Clrscr 
jmp begining

quitting:
call Crlf
call Crlf
mov edx, OFFSET sessEnd
call WriteString
call Crlf

exit
main ENDP

END main


----------

