Jump to content
IGNORED

Wanted: Cycle correct Countdown Timer


Recommended Posts

Polishing up my game and I am running into small issues that some of you brains might be able to help with.

 

One, I am running out of time because of Christmas and Grand kids flopping about.

Two, I am running out of time because of Christmas and Grand kids flopping about.

 

With that I would ask if anyone in the community has an accurate count down timer like that featured in Donkey Kong, Blasto or your common core game with a count down timer.

 

I have two players competing for merchandise on the screen with a count down so the higher score wins after time out.

 

My routines work but they are iffy at best so if there is a professional formula that also shows a 3 digit display anywhere on screen

 

Please, code must be in Z80 assembly.

 

Tony Cruz gave me some insight on BCD and now I am thinking I was pretty dag on good with my coding, I have done some things you shall see, however this went over my head and just did not work the way I thought it would.

 

A simple 3 digit display timer that counts increments of 1's from 199 to 0.

 

 

TIA always.

Link to comment
Share on other sites

I may not know z80.  One simple way is to 3 variables to hold a single digit.  1 variable to count to 60.  To place number on screen, like put_char(3,2,48+digit1);put_char(4,2,48+digit2);put_char(5,2,48+digit3); Whenever a digit roll hit 255, then reset digit to 9, and deduct the 2nd or/and 3rd digits.  If (digit1==0 && digit2==0 && digit3==0){TimesUp();}. 

My other 3 digit uses MOD(%) and uses 1 variable.

a=SP/10;
b=SP%10;
if(SP<100){f=0;}
if(SP>=100){f=1;a-=10;}
if(SP>=200){f=2;a-=10;}
put_char(0,17,'S');
put_char(1,17,f+48);
put_char(2,17,a+48);
put_char(3,17,b+48);

Maybe this information could help you.  Sorry it's not in Z80. The x,y (3,17 can translate to 0x1800+3+17*32)

Link to comment
Share on other sites

What I can ultimately do is have a 0-9 print routine then print the ones, deduct the tens then print, deduct the hundreds then print.

It's convoluted so I thought there may be a standard someone was willing to share.

 

As far as the actual timer part, I am getting the feeling that close enough should be fine.  It's a game and not sending a man to the moon.

 

Thank you Kiwi for the input.

Link to comment
Share on other sites

Thanks to everyone, I went ahead and wrote it long hand then optimized it.

Not such a big deal, just check in multiples of ten.

 

However I want to go back to my call on a thread to have the most optimized Z80 routines for the Colecovision which anyone can grab for game development or even adapt them for other systems.

 

To be honest I have no idea why this has never been done.  At least where I could find.

Along with some Z80 classes I may just go ahead and start this endeavor as a new 2021 project.

I don't want to bite off more than I can chew because I am finding out there is more I can learn like BCD.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...