Previous 15994 Revisions Next

r820 Monday 13th August, 2007 at 09:56:28 UTC by Curt Coder
[ATARIST] Connected mouse to the IKBD
[src/mess/drivers]atarist.c

src/mess/drivers/atarist.c
r819r820
2222
2323   - US keyboard layout
2424   - add serial communications to HD63701 cpu core
25   - connect mouse to ikbd
2625   - MFP interrupts
2726   - accurate screen timing
2827   - fdc.dma_int ?
r819r820
219218static UINT8 acia_ikbd_rx, acia_ikbd_tx;
220219static UINT8 ikbd_keymask;
221220static int ikbd_joyen;
221static UINT8 ikbd_mouse_x0, ikbd_mouse_y0;
222static UINT8 ikbd_mouse_x_phase, ikbd_mouse_y_phase, ikbd_mouse_phase_counter;
222223
224static int IKBD_MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
225static int IKBD_MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
226
227enum
228{
229   IKBD_MOUSE_PHASE_STATIC = 0,
230   IKBD_MOUSE_PHASE_POSITIVE,
231   IKBD_MOUSE_PHASE_NEGATIVE
232};
233
223234static WRITE8_HANDLER( ikbd_port1_w )
224235{
225236   ikbd_keymask = data;
r819r820
239250
240251   */
241252
242   return readinputportbytag("JOY1") | (acia_ikbd_tx << 3);
253   return (acia_ikbd_tx << 3) | (readinputportbytag("JOY1") & 0x06);
243254}
244255
245256static WRITE8_HANDLER( ikbd_port2_w )
r819r820
331342   {
332343      if (readinputportbytag("config") & 0x01)
333344      {
345         /*
346
347               Right   Left      Up      Down
348
349            XA   1100   0110   YA   1100   0110
350            XB   0110   1100   YB   0110   1100
351
352         */
353
334354         UINT8 data = readinputportbytag("JOY0") & 0xf0;
355         UINT8 x = readinputportbytag("MOUSEX");
356         UINT8 y = readinputportbytag("MOUSEY");
335357
358         if (x == ikbd_mouse_x0)
359         {
360            ikbd_mouse_x_phase = IKBD_MOUSE_PHASE_STATIC;
361         }
362         else if (x > ikbd_mouse_x0)
363         {
364            ikbd_mouse_x_phase = IKBD_MOUSE_PHASE_POSITIVE;
365         }
366         else if (x < ikbd_mouse_x0)
367         {
368            ikbd_mouse_x_phase = IKBD_MOUSE_PHASE_NEGATIVE;
369         }
370         
371         if (y == ikbd_mouse_y0)
372         {
373            ikbd_mouse_y_phase = IKBD_MOUSE_PHASE_STATIC;
374         }
375         else if (y > ikbd_mouse_y0)
376         {
377            ikbd_mouse_y_phase = IKBD_MOUSE_PHASE_POSITIVE;
378         }
379         else if (y < ikbd_mouse_y0)
380         {
381            ikbd_mouse_y_phase = IKBD_MOUSE_PHASE_NEGATIVE;
382         }
383
384         data |= IKBD_MOUSE_XYB[ikbd_mouse_x_phase][ikbd_mouse_phase_counter]; // XB
385         data |= IKBD_MOUSE_XYA[ikbd_mouse_x_phase][ikbd_mouse_phase_counter] << 1; // XA
386         data |= IKBD_MOUSE_XYA[ikbd_mouse_y_phase][ikbd_mouse_phase_counter] << 2; // YA
387         data |= IKBD_MOUSE_XYB[ikbd_mouse_y_phase][ikbd_mouse_phase_counter] << 3; // YB
388
389         ikbd_mouse_phase_counter++;
390
391         if (ikbd_mouse_phase_counter == 4)
392         {
393            ikbd_mouse_phase_counter = 0;
394         }
395
396         ikbd_mouse_x0 = x;
397         ikbd_mouse_y0 = y;
398
336399         return data;
337400      }
338401      else
r819r820
542605   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(1)
543606   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_PLAYER(2)
544607
545   PORT_START_TAG("MOUSE_X")
608   PORT_START_TAG("MOUSEX")
546609   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)   
547610
548   PORT_START_TAG("MOUSE_Y")
611   PORT_START_TAG("MOUSEY")
549612   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_SENSITIVITY(100) PORT_KEYDELTA(5) PORT_MINMAX(0, 255) PORT_PLAYER(1)   
550613INPUT_PORTS_END
551614
r819r820
785848
786849static MACHINE_START( megast )
787850{
788   machine_start_atarist(Machine);
851   machine_start_atarist(machine);
789852   rp5c15_init(&rtc_intf);
790853}
791854

Previous 15994 Revisions Next


© 1998-2018 The MESS Team