|
|
How to measure time-span in assembly (c64)
Hi everyone,
I'm looking for a quite simple way for measuring
a time-span in assembly using any of the standard
kernal routines on my C64. I'd like to have something
like this:
Program will continue in X secs...
(I want to be able to do display some remaining time though).
I thought about directly using CIA-TOD but maybe
someone knows something shorter and more elegant.
(In any case an assembly example is very much
appreciated ! ;))
Regards,
Adrian
|
|
0
|
|
|
|
Reply
|
adrian82 (1)
|
5/19/2005 12:04:20 PM |
|
adrian82 wrote:
> Hi everyone,
>
> I'm looking for a quite simple way for
> measuring a time-span in assembly using any
of the standard kernal routines on my C64.
> I'd like to have something like this:
>
> I thought about directly using CIA-TOD but maybe
> someone knows something shorter and more elegant.
How much time do you want to measure?
I use either the CIA clock at $DC08 or the JIFFY
clock at $A0 for program pauses. I may describe my
techniques as simple but not elegant. I don't bother
with CIA alarms and such. For periods of less than a
second, I use the tenths of second CIA byte at $DC08.
Store a 1 in $DC08, wait until $DC08 ticks over to 0
to delay your program 9/10 of a second. For a 1/10
second delay, store a 9 in $DC08. Whole second
delays are more complicated because you have to set
$DC09 and then $DC08 (precisely in that order). For
periods of 1 or more whole seconds, store a $59 (89
decimal) or less in $DC09 and a 0 in $DC08. Delay
the program until $DC09 is 0. A delay of a minute
or an hour would require setting more bytes in the
CIA clock, but you only need to scan the high order
byte. I never needed to display times remaining.
This technique would require messy subtraction
for that purpose. The BCD nature of the CIA
clock reduces the headaches involved in converting
from internal to decimal representations.
|
|
0
|
|
|
|
Reply
|
r_u_sure
|
5/19/2005 4:39:24 PM
|
|
r_u_sure@mybluelight.com wrote:
> A delay of a minute or an hour would require
> setting more bytes in the CIA clock, but
> you only need to scan the high order byte.
THis scheme won't work fo delays of over an hour.
THe statements in the previous post are correct
for minutes, seconds, and tenths of seconds.
|
|
0
|
|
|
|
Reply
|
r_u_sure
|
5/19/2005 9:54:21 PM
|
|
Hi,
Thanks alot, I will try that.
Regards,
Adrian
r_u_sure@mybluelight.com schrieb:
> r_u_sure@mybluelight.com wrote:
>
> > A delay of a minute or an hour would require
> > setting more bytes in the CIA clock, but
> > you only need to scan the high order byte.
>
> THis scheme won't work fo delays of over an hour.
> THe statements in the previous post are correct
> for minutes, seconds, and tenths of seconds.
|
|
0
|
|
|
|
Reply
|
adrian82
|
5/23/2005 9:40:44 AM
|
|
|
3 Replies
127 Views
(page loaded in 0.179 seconds)
|
|
|
|
|
|
|
|
|