6502.org Forum  Projects  Code  Documents  Tools  Forum
It is currently Fri May 10, 2024 10:50 am

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: Thu Dec 11, 2003 1:00 am 
Offline

Joined: Wed Dec 10, 2003 12:23 pm
Posts: 4
Sorry for the inconvinience.I need to do this project till Thursay night.The project is the following

>>
Build a program in machine language 6502.
You put a date in a specific address (dd-mm-yy)(3 byte,the year
must be two digits and>2000)and one number of days as 16bit
number in a specific address and will calculate the date that
results in form(dd-mm-yy) if add in the first date the days that we
put.
Months have 30 days and years have 365 days.The result must be
put in specific addresses.
<<

I must build this project to a 6502 assembly emulator.
I need your help!!!It is very important for me and i believe that you have the knowledge to help me.
With respect

Toni


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 11, 2003 7:25 am 
Offline
User avatar

Joined: Fri Aug 30, 2002 1:09 am
Posts: 8433
Location: Southern California
To avoid clutter in the forum archives that will be referred back to for years, please don't start a new subject every time you want to post with more on the same subject. Thanks.

What Mike no doubt meant in his response to your first post was that we're happy to help, but we don't want to just do everyone's homework for them. Go ahead and start, and ask questions when you get stumped, showing what you have so far. If I understand you right, you want to take a date, add some number of days to it, and tell what the resulting date is.

As for helps to get you started-- There are several ways you could do this. Actually putting the right number of days in each month is not too big a deal either. But one way you might approach your assignment is to first convert the initial date to a number of days past 12/31/99. If you're not ready for multiplication and division routines yet, you could do it this way:
1. Set up a 16-bit variable and initialize it as 0.
2. Set up a loop to add 365 ($16D) for each year,
3. another loop to add 30 ($1E) days for each month past January,
4. and then add the day of the month to get the number.
5. Now add the number of days you want to advance it, to get another 16-bit number.
That result will need to be converted back to a date.
6. Set up another loop to count how many times you can subtract 365 without going negative. That's the year.
7. Set up another loop to count how many times you can subtract 30 from the retult without going negative. That, plus one, is the month.
8. Then the remainder, plus one, is the day of month.

You'll generally use the X register as a loop index.

We're glad to see that there are many schools teaching microprocessors and assembly language using the 6502. It has an excellent power-to-complexity ratio, and is going into modern products at the rate of about 200,000,000 per year-- far more than twenty years ago.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 11, 2003 8:05 am 
Offline

Joined: Tue Nov 18, 2003 8:41 pm
Posts: 250
and you might want to ask yourself what month does (for example) the
363 day of the year fall into.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Dec 11, 2003 4:35 pm 
Offline

Joined: Fri Jun 27, 2003 8:12 am
Posts: 618
Location: Meadowbrook
That approach works for the 30 days only per month rule. If it was for a real date calculator, I would have used index table for the monthly amounts, and a calculation for leap year...

_________________
"My biggest dream in life? Building black plywood Habitrails"


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: Google [Bot] and 4 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: