Previous 15994 Revisions Next

r5928 Wednesday 30th September, 2009 at 20:51:40 UTC by Angelo Salese
[PC6001]: implemented audio timer irq and basic joystic controls, some games are now playable
[src/mess/drivers]pc6001.c

src/mess/drivers/pc6001.c
r5927r5928
9999static UINT8 irq_vector = 0x00;
100100static UINT8 cas_switch,sys_latch;
101101
102#define CAS_LENGTH 0x1655
102#define CAS_LENGTH 0x3d32
103103
104104static VIDEO_START( pc6001 )
105105{
r5927r5928
215215      cas_switch = 1;
216216
217217   sys_latch = data;
218   printf("%02x\n",data);
218219}
219220
220221#if 0
r5927r5928
302303
303304/* Input ports */
304305static INPUT_PORTS_START( pc6001 )
306   /* TODO: these two are unchecked */
307   PORT_START("P1")
308   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY
309   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY
310   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY
311   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY
312   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
313   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 )
314   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )
315   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
316
317   PORT_START("P2")
318   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
319   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
320   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
321   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
322   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
323   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)
324   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2)
325   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNKNOWN )
326
305327   PORT_START("key1") //0x00-0x1f
306328   PORT_BIT(0x00000001,IP_ACTIVE_HIGH,IPT_UNUSED) //0x00 null
307329   PORT_BIT(0x00000002,IP_ACTIVE_HIGH,IPT_UNUSED) //0x01 soh
r5927r5928
474496{
475497   AY8910_LEGACY_OUTPUT,
476498   AY8910_DEFAULT_LOADS,
499   DEVCB_INPUT_PORT("P1"),
500   DEVCB_INPUT_PORT("P2"),
501   DEVCB_NULL,
477502   DEVCB_NULL
478503};
479504
r5927r5928
522547   }
523548}
524549
550static TIMER_CALLBACK(audio_callback)
551{
552   if(cas_switch == 0)
553   {
554      irq_vector = 0x06;
555      cputag_set_input_line(machine,"maincpu", 0, ASSERT_LINE);
556   }
557}
558
525559static TIMER_CALLBACK(keyboard_callback)
526560{
527561   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
r5927r5928
550584   //pc6001_video_ram =  pc6001_ram;
551585
552586   cpu_set_irq_callback(cputag_get_cpu(machine, "maincpu"),pc6001_irq_callback);
553   timer_pulse(machine, ATTOTIME_IN_HZ(240), NULL, 0, keyboard_callback);
587   /* TODO: accurate timing on these (especially for the first one) */
588   timer_pulse(machine, ATTOTIME_IN_HZ(540), NULL, 0, audio_callback);
589   timer_pulse(machine, ATTOTIME_IN_HZ(250), NULL, 0, keyboard_callback);
554590   timer_pulse(machine, ATTOTIME_IN_HZ(160), NULL, 0, cassette_callback);
555591   cas_switch = 0;
556592}
r5927r5928
578614
579615static MACHINE_DRIVER_START( pc6001 )
580616   /* basic machine hardware */
581   MDRV_CPU_ADD("maincpu",Z80, 7987200 /2)
617   MDRV_CPU_ADD("maincpu",Z80, 7987200 / 4)
582618   MDRV_CPU_PROGRAM_MAP(pc6001_mem)
583619   MDRV_CPU_IO_MAP(pc6001_io)
584620   MDRV_CPU_VBLANK_INT("screen", pc6001_interrupt)
r5927r5928
628664
629665   ROM_REGION( 0x10000, "cas", ROMREGION_ERASEFF )
630666   /* Load here your tape for now (and change the cas length macro according to what MESS returns) */
631//   ROM_LOAD( "car.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) )
667//   ROM_LOAD( "magnetic field.cas", 0x0000, CAS_LENGTH, CRC(1) SHA1(1) )
632668ROM_END
633669
634670ROM_START( pc6001a )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team