It is currently Sat May 30, 2020 5:43 am

 All times are UTC

 Page 1 of 1 [ 3 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Timer 0 to 10 MinutesPosted: Fri Dec 27, 2019 2:00 pm

Joined: Fri Dec 27, 2019 12:58 pm
Posts: 2
Hello,
I am busy trying to code a 0 to 10 minutes timer. The time will be displayed on the screen as mm:ss.tenths.
I have coded several subroutines so far. At the moment I am at the stage where the program will display the time in minutes, seconds and tenths of seconds.
At the start of the program I read the system time in 100ths of seconds and then divide by 10 and discard the remainder so my start time is in 10ths of seconds. I then enter an infinite loop. In the loop I read the current time and convert it to 10ths of seconds and store it in memory as current time. I use a subroutine to find the elapsed time (current time - base time). I use another subroutine to calculate the timer values in minutes, second and tenths. First I divide by 600 to give mins and store in memory. Next I use the remainder and divide by 10 to give seconds with the remainder in 10ths of seconds.
Then I use a subroutine to display the values on screen. This works OK and shows these values incrementing on the screen. My problem is that when the seconds reaches 59 seconds and then rolls over to 0 I still have the 9 on the screen next to the new seconds count. I have fixed the problem by overwriting the 9 with a space which works OK but it just seems like a fudge to make it right. So my question is there a better way to do this?

I have done some 8086 assembly in the past but the M68000 is all new territory for me but I have learned a lot so far with this program. Most of the programming I have done is in higher level languages C++, VB, Pascal, also currently trying to learn C. So my approach which may not be the best is to use mainly subroutines which helps me to organise my code so I can keep track of what I do.

Top

 Post subject: Re: Timer 0 to 10 MinutesPosted: Sun Dec 29, 2019 12:22 am

Joined: Thu Dec 16, 2004 6:42 pm
Posts: 1122
It sounds good to me.

_________________
Prof. Kelly

Top

 Post subject: Re: Timer 0 to 10 MinutesPosted: Thu Jan 02, 2020 7:36 am

Joined: Fri Dec 27, 2019 12:58 pm
Posts: 2
Thank you for your response. I have since found a better way to correct the problem with the seconds display.
I display a zero before the seconds using the CMP instruction from 0-9: 01,02,03...09. Above nine it counts in the normal way, 11, 12...59
and then rolls over to 00 which now works fine.

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 3 posts ]

 All times are UTC

#### Who is online

Users browsing this forum: Bing [Bot] and 13 guests

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

Search for:
 Jump to:  Select a forum ------------------ EASy68K Forum    FAQ    Latest Features    EASy68K Questions    68000 Programming Questions    Wish List    Wishes Granted    Undocumented Features    Documented Features    General Discussion    EASy68K Projects