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.
|