2 * (C) GraÅžvydas "notaz" Ignotas, 2011
4 * This work is licensed under the terms of any of these licenses
6 * - GNU GPL, version 2 or later.
7 * - GNU LGPL, version 2.1 or later.
8 * See the COPYING file in the top-level directory.
14 static unsigned char buf[8];
16 unsigned char PADpoll_guncon(unsigned char value)
21 return 0x63; // regardless of cmd
24 if (CurCmd != 0x42 || CurByte >= 8)
25 return 0xff; // verified
27 return buf[CurByte++];
30 unsigned char PADstartPoll_guncon(int pad)
32 int x, y, xn = 0, yn = 0, in = 0, xres = 256, yres = 240;
35 buf[2] = buf[3] = 0xff;
36 pl_update_gun(&xn, &yn, &xres, &yres, &in);
38 // while y = const + line counter, what is x?
39 // for 256 mode, hw dumped offsets x, y: 0x5a, 0x20
40 //x = 0x5a + (356 * xn >> 10);
41 x = 0x5a - (xres - 256) / 3 + (((xres - 256) / 3 + 356) * xn >> 10);
42 y = 0x20 + (yres * yn >> 10);
44 if (in & GUNIN_TRIGGER)
50 if (in & GUNIN_TRIGGER2) {
63 void guncon_init(void)
65 memset(buf, 0xff, sizeof(buf));