2 Copyright © 1995-2011, The AROS Development Team. All rights reserved.
4 Desc: Detect custom chipset revisions and PAL/NTSC state
10 #include <aros/debug.h>
11 #include <aros/symbolsets.h>
12 #include <graphics/gfxbase.h>
13 #include <hardware/custom.h>
14 #include <hardware/cia.h>
16 #include <timer_platform.h>
18 static UWORD
getline(void)
20 volatile struct Custom
*custom
= (struct Custom
*)0xdff000;
24 vposb
= custom
->vhposr
>> 8;
25 while (vposb
== (custom
->vhposr
>> 8));
26 vpos
= ((custom
->vposr
& 7) << 8) | (custom
->vhposr
>> 8);
30 static UWORD
gethighestline(UWORD linecnt
)
32 volatile struct Custom
*custom
= (struct Custom
*)0xdff000;
37 while (linecnt
-- != 0) {
38 vposb
= custom
->vhposr
>> 8;
39 while (vposb
== (custom
->vhposr
>> 8));
41 vpos
= ((custom
->vposr
& 7) << 8) | vposb
;
48 void InitCustom(struct GfxBase
*gfx
)
50 volatile struct Custom
*custom
= (struct Custom
*)0xdff000;
57 custom
->vposw
= 0x8000;
58 custom
->bplcon0
= 0x0200;
60 while(getline() != 0);
61 pos
= gethighestline(400);
67 vposr
= custom
->vposr
& 0x7f00;
68 if (!(vposr
& 0x1000))
74 if (vposr
>= 0x2200) {
75 gfx
->MemType
= BUS_32
| DBL_CAS
;
78 gfx
->DisplayFlags
= flags
;
80 SysBase
->VBlankFrequency
= (flags
& PAL
) ? 50 : 60;