+static void RunEventsPico(unsigned int events, unsigned int keys)
+{
+ emu_RunEventsPico(events);
+
+ if (pico_inp_mode != 0)
+ {
+ PicoPad[0] &= ~0x0f; // release UDLR
+ if (keys & PBTN_UP) { pico_pen_y--; if (pico_pen_y < 8) pico_pen_y = 8; }
+ if (keys & PBTN_DOWN) { pico_pen_y++; if (pico_pen_y > 224-PICO_PEN_ADJUST_Y) pico_pen_y = 224-PICO_PEN_ADJUST_Y; }
+ if (keys & PBTN_LEFT) { pico_pen_x--; if (pico_pen_x < 0) pico_pen_x = 0; }
+ if (keys & PBTN_RIGHT) {
+ int lim = (Pico.video.reg[12]&1) ? 319 : 255;
+ pico_pen_x++;
+ if (pico_pen_x > lim-PICO_PEN_ADJUST_X)
+ pico_pen_x = lim-PICO_PEN_ADJUST_X;
+ }
+ PicoPicohw.pen_pos[0] = pico_pen_x;
+ if (!(Pico.video.reg[12]&1)) PicoPicohw.pen_pos[0] += pico_pen_x/4;
+ PicoPicohw.pen_pos[0] += 0x3c;
+ PicoPicohw.pen_pos[1] = pico_inp_mode == 1 ? (0x2f8 + pico_pen_y) : (0x1fc + pico_pen_y);
+ }
+}
+