Re: ML TOD routine help needed

From: Steve Judd (sjudd_at_ffd2.com)
Date: 2001-02-06 18:53:37

Hi Jeff,

There is a 'latch' mechanism for setting most of the CIA registers.  For
the TOD clock, the clock stops updating when you write to the hours
register, and doesn't start again until you write to the tenths register.
I don't have a 64 here to test this with, but my guess is that the value
is not actually latched in until the tenths register is written.

Another thing to check is that bit 7 of $DD0F is set correctly (but I
assume you already did this).

So with that in mind, I suggest writing your routine like:

GETKEY

> TIMER = $DD08 ; CIA2
> 
>              LDA #0                        ; set TOD to all 0's
>              STA TIMER+3
>              STA TIMER+2
>              STA  TIMER+1
>              STA TIMER+0
BACK
	JSR $FFE4
	BNE +
	JSR $FFD2
	BNE GETKEY

+	LDA TIMER+2
	BEQ BACK
	INC $D020
	RTS

(a little more compact)

-Steve

> 
> BACK   JSR $FFE4
>               STA TEMP
>              LDA TIMER+2             ; READ IN THE MINUTES
>              CMP #$01                     ; SEE IF IT = # OF MINUTES IN BCD
> FORMAT
>              BEQ +
>              LDA TEMP
>              BEQ BACK
> 
>              JSR $FFD2
>              LDA #0
>              STA TIMER+2            ; Set minutes to 0 again ??
>              JMP BACK
> 
> ; OK IT IDLED OUT, EXIT
> +           INC $D020
>              RTS
> 
> temp .by 0
> 

-
This message was sent through the cbm-hackers mailing list.
To unsubscribe: echo unsubscribe | mail cbm-hackers-request@dot.tml.hut.fi.

Archive generated by hypermail 2.1.1.