1 #include "../PicoInt.h"
6 picohw_state PicoPicohw;
8 static int prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
10 static void PicoLineHookPico(int count)
12 PicoPicohw.line_counter += count;
15 if ((PicoPicohw.r12 & 0x4003) && PicoPicohw.line_counter - prev_line_cnt_irq3 > 200) {
16 prev_line_cnt_irq3 = PicoPicohw.line_counter;
17 // just a guess/hack, allows 101 Dalmantians to boot
18 elprintf(EL_ANOMALY, "irq3");
23 if (PicoPicohw.fifo_bytes == 16) {
24 prev_line_cnt_irq3 = PicoPicohw.line_counter;
25 elprintf(EL_ANOMALY, "irq3, fb=%i", PicoPicohw.fifo_bytes);
27 PicoPicohw.fifo_bytes--;
32 if ((PicoPicohw.line_counter & 3) == 0 || count > 10)
34 if (PicoPicohw.fifo_bytes > 0)
35 PicoPicohw.fifo_bytes--;
39 if (PicoPicohw.line_counter - prev_line_cnt_irq5 > 512) {
40 prev_line_cnt_irq5 = PicoPicohw.line_counter;
41 elprintf(EL_ANOMALY, "irq5");
47 PICO_INTERNAL int PicoInitPico(void)
49 elprintf(EL_STATUS, "Pico detected");
50 PicoLineHook = PicoLineHookPico;
53 memset(&PicoPicohw, 0, sizeof(PicoPicohw));
54 PicoPicohw.pen_pos[0] = 0x03c + 352/2;
55 PicoPicohw.pen_pos[1] = 0x200 + 252/2;
56 prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0;
58 // map version register
60 elprintf(EL_STATUS, "a %x", Pico.m.hardware);
61 switch (Pico.m.hardware >> 6) {
62 case 0: PicoPicohw.r1 = 0x00; break;
63 case 1: PicoPicohw.r1 = 0x00; break;
64 case 2: PicoPicohw.r1 = 0x40; break;
65 case 3: PicoPicohw.r1 = 0x20; break;