View Single Post
Old 26 December 2012, 16:39   #6
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,481
Toni, some evidence for you that the Amiga timer.device supports 25Hz/30Hz CIA-A TOD as would be the case on an A500 with genlock connected...

Take a look at this code from timer.device in Kickstart 40.70. This is where it calculates the CIA-A TOD rate. The result gets put in ExecBase PowerSupplyFrequency. It counts timer B down from $FFFF for the period between CIA-A TOD counts. Timer B frequency is 0.709379MHz for PAL machines. The threshold values used are
Code:
$CCFC < val		60Hz, 16667us
$B5DA <= val < $CCFC	50Hz, 20000us
$99F8 <= val < $B5DA	30Hz, 33333us
val < $99F8		25Hz, 40000us
Code:
Get_CIAA_TOD_freq
	LEA	(_ciaa).L,A0
	LEA	(_ciaa).L,A1
	BCLR	#CIACRBB_ALARM,(ciacrb,A1)
	MOVE.B	#0,(ciatodhi,A1)
	MOVE.B	#0,(ciatodmid,A1)
	MOVE.B	#0,(ciatodlow,A1)
	MOVE.B	#CIACRBF_RUNMODE,(ciacrb,A0)
	MOVE.B	#$FF,(ciatblo,A0)
	MOVE.B	#$FF,(ciatbhi,A0)
	MOVE.B	(ciatodlow,A1),D0

.Wait_TOD_change
	TST.B	(ciatbhi,A0)
	BEQ.B	__Alert_Timer	;Alert() if timer B reaches 0

	CMP.B	(ciatodlow,A1),D0	;Wait until TOD low changes
	BEQ.B	.Wait_TOD_change

	MOVE.B	#(CIACRBF_START|CIACRBF_RUNMODE|CIACRBF_LOAD),(ciacrb,A0)	;Start timer B counting down
	MOVE.B	(ciatodlow,A1),D0

.Wait_TOD_change2
	TST.B	(ciatbhi,A0)
	BEQ.B	__Alert_Timer

	CMP.B	(ciatodlow,A1),D0
	BEQ.B	.Wait_TOD_change2

	MOVE.B	#CIACRBF_RUNMODE,(ciacrb,A0)	;One-shot mode
	MOVEQ	#0,D0
	MOVE.B	(ciatbhi,A0),D0
	LSL.L	#8,D0
	MOVE.B	(ciatblo,A0),D0

; So counted-down timer B value is in D0
	CMP.W	#$CCFC,D0
	BLO.B	.Not60

	MOVE.W	#60,D0
	MOVE.W	#16667,D1
	BRA.B	SetValsAndReturn

.Not60	CMP.W	#$B5DA,D0
	BLO.B	.Not50

	MOVE.W	#50,D0
	MOVE.W	#20000,D1
	BRA.B	SetValsAndReturn

.Not50	CMP.W	#$99F8,D0
	BLO.B	.Not30

	MOVE.W	#30,D0
	MOVE.W	#33333,D1
	BRA.B	SetValsAndReturn

.Not30	MOVE.W	#25,D0
	MOVE.W	#40000,D1

SetValsAndReturn
	MOVE.W	D0,($28,A2)
	MOVE.W	D1,($2A,A2)
	RTS

Last edited by mark_k; 26 December 2012 at 16:50.
mark_k is offline  
 
Page generated in 0.04732 seconds with 9 queries