some Pico work
[picodrive.git] / Pico / Pico / Pico.c
CommitLineData
9037e45d 1#include "../PicoInt.h"
2
406c96c5 3// x: 0x03c - 0x19d
4// y: 0x1fc - 0x2f7
5// 0x2f8 - 0x3f3
d49b10c2 6picohw_state PicoPicohw;
7
8static int prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
9
10static void PicoLineHookPico(int count)
11{
12
13 PicoPicohw.line_counter += count;
14 if ((PicoPicohw.line_counter & 0xf) == 0 || count > 10)
15 {
16 if (PicoPicohw.fifo_bytes > 0)
17 PicoPicohw.fifo_bytes--;
18 }
19
20#if 0
21 if (PicoPicohw.line_counter - prev_line_cnt_irq3 > 200) {
22 prev_line_cnt_irq3 = PicoPicohw.line_counter;
23 // just a guess/hack, allows 101 Dalmantians to boot
24 elprintf(EL_ANOMALY, "irq3");
25 SekInterrupt(3);
26 }
27#endif
28
29#if 0
30 if (PicoPicohw.line_counter - prev_line_cnt_irq5 > 512) {
31 prev_line_cnt_irq5 = PicoPicohw.line_counter;
32 elprintf(EL_ANOMALY, "irq5");
33 SekInterrupt(5);
34 }
35#endif
36}
406c96c5 37
9037e45d 38PICO_INTERNAL int PicoInitPico(void)
39{
40 elprintf(EL_STATUS, "Pico detected");
d49b10c2 41 PicoLineHook = PicoLineHookPico;
42
9037e45d 43 PicoAHW = PAHW_PICO;
d49b10c2 44 memset(&PicoPicohw, 0, sizeof(PicoPicohw));
45 PicoPicohw.pen_pos[0] = 0x03c + 352/2;
46 PicoPicohw.pen_pos[1] = 0x200 + 252/2;
47 prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
9037e45d 48
49 return 0;
50}
51