| 1 | #include "../PicoInt.h" |
| 2 | |
| 3 | // x: 0x03c - 0x19d |
| 4 | // y: 0x1fc - 0x2f7 |
| 5 | // 0x2f8 - 0x3f3 |
| 6 | picohw_state PicoPicohw; |
| 7 | |
| 8 | static int prev_line_cnt_irq3 = 0, prev_line_cnt_irq5 = 0; |
| 9 | |
| 10 | static 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 | } |
| 37 | |
| 38 | PICO_INTERNAL int PicoInitPico(void) |
| 39 | { |
| 40 | elprintf(EL_STATUS, "Pico detected"); |
| 41 | PicoLineHook = PicoLineHookPico; |
| 42 | |
| 43 | PicoAHW = PAHW_PICO; |
| 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; |
| 48 | |
| 49 | return 0; |
| 50 | } |
| 51 | |