freqmax wrote:
It will wreck any timing within the software. Same goes with the user interaction.
Not sure.
You must keep the CIAs at 700 KHz and Paula at 3.54 MHz.
The rest will run faster: CPU at 8.867 MHz, Horizontal frequency at 19.5 KHz but still 227 cycles per horizontal line.
The timer.device will still auto-detect the Amiga as a PAL machine.
Here is the ROM code that does that:
SupplyFreqDetect
;We launch the timer B (frequence = 715,909Hz or 709,379Hz) and wait
;for 1 TOD tick. We guess the TOD's frequency with the number of
;decremented EClock ticks.
; +----- 65535 : Timer B start
; |
; |
; |
; +----- 53603 : 60 Hz tick (EClock = 715909 Hz) - ECS Amiga
; |
; +- 52476 : Threshold 50Hz ECS / 60Hz ECS
; |
; +----- 51347 : 50 Hz tick (EClock = 709379 Hz) - ECS Amiga
; |
; +- 46509 : Threshold 60Hz AGA / 50Hz ECS
; |
; +----- 41671 : 60 Hz tick (EClock = 1431818 Hz) - AGA Amiga
; |
; +- 39416 : Threshold 50Hz AGA / 60Hz AGA
; |
; +----- 37160 : 50 Hz tick (EClock = 1418758 Hz) - AGA Amiga
lea _ciaa,A0 ;Get base address of CIA A.
bclr #CIACRBB_ALARM,ciacrb(A0)
moveq #0,D0
move.b D0,todhi(A0)
move.b D0,todmid(A0)
move.b D0,todlow(A0) ;Clear the TOD clock
moveq #CIACRBF_RUNMODE,D0
move.b D0,ciacrb(A0) ;Activate one-shot mode for timer B
moveq #-1,D0
move.b D0,tblo(A0)
move.b D0,tbhi(A0) ;Load the timer B latch with $FFFF
move.b todlow(A0),D0
.WaitTick1
tst.b tbhi(A0) ;Does timer B work ?
beq.b .CiaAFail ;If not, Guru time !
cmp.b todlow(A0),D0
beq.b .WaitTick1 ;Wait for a TOD tick.
;The timer B starts decrementing from $FFFF.
move.b #CIACRAF_LOAD|CIACRAF_RUNMODE|CIACRAF_START,ciacrb(A0)
move.b todlow(A0),D0
.WaitTick2
tst.b tbhi(A0) ;Does timer B work ?
beq.b .CiaAFail ;If not, Guru time !
cmp.b todlow(A0),D0
beq.b .WaitTick2 ;Wait for another TOD tick.
moveq #CIACRBF_RUNMODE,D0
move.b D0,ciacrb(A0) ;Stop the timer B.
move.b tbhi(A0),D0
lsl.l #8,D0
move.b tblo(A0),D0 ;Read the timer B value.
cmpi.l #52476,D0 ;Timer B >= 52476 ?
bcs.b .Not60Hz ;No, skip the next two lines.
moveq #60,D0 ;Yes, we have a 60Hz tick.
bra.b .StoreTickInfo ;Store the information.
.Not60Hz
cmpi.l #46509,D0 ;Timer B >= 46509 ?
bcs.b .Not50Hz ;No, skip the next two lines.
moveq #50,D0 ;Yes, we have a 50Hz tick.
bra.b .StoreTickInfo ;Store the information.
.Not50Hz
cmpi.l #39416,D0 ;Timer B >= 39416 ?
bcs.b .Not30Hz ;No, skip the next two lines.
moveq #30,D0 ;Yes, we have a 60Hz tick.
bra.b .StoreTickInfo ;Store the information.
.Not30Hz
moveq #25,D0 ;Timer B < 39416 : 50Hz tick.
.StoreTickInfo
move.l #1000000,D1 ;1,000,000 µs
divu D0,D1 ;Divided by TOD freq = TOD period (in µs).
move.w D0,tdev_PSupplyFrqHz(A2) ;Store the frequency.
move.w D1,tdev_PSupplyPerMicroSec(A2) ;Store the period.
rts
.CiaAFail
move.l #$15000002,D0 ;Alert number (AN_TMBadSupply).
bra.w DisplayAlert ;Guru time.