Previous 15994 Revisions Next

r3246 Friday 12th September, 2008 at 17:46:05 UTC by Fabio Priuli
[C16] Fixed crash in c16c, c116c & plus4c due to missing timer init
[C16] Fixed properly c16v, c116v & plus4v (but disk emulation is always missing)
[C16] Reverted 3239, it was correct before
[src/mess/drivers]c16.c
[src/mess/includes]c16.h
[src/mess/machine]c16.c cbmipt.c vc1541.c
[src/mess/video]ted7360.c

src/mess/video/ted7360.c
r3245r3246
360360
361361#include "includes/c16.h"
362362#include "includes/cbmserb.h"
363#include "includes/vc1541.h"
364363
365364#include "ted7360.h"
366365
src/mess/includes/c16.h
r3245r3246
4040extern int c16_read_keyboard (int databus);
4141extern void c16_interrupt (running_machine *machine, int);
4242
43extern void c16_driver_init(running_machine *machine);
43extern DRIVER_INIT( c16 );
44extern DRIVER_INIT( c16c );
45extern DRIVER_INIT( c16v );
4446extern MACHINE_RESET( c16 );
4547extern INTERRUPT_GEN( c16_frame_interrupt );
4648
src/mess/machine/vc1541.c
r3245r3246
634634
635635   logerror("floppy image %s loaded\n", image_filename(image));
636636
637   vc1541->timer = timer_alloc(vc1541_timer, NULL);
638637   return INIT_PASS;
639638}
640639
r3245r3246
642641{
643642   /* writeback of image data */
644643   vc1541->d64.data = NULL;
645   timer_reset(vc1541->timer, attotime_never);   /* FIXME - timers should only be allocated once */
646644}
647645
648646int vc1541_config (int id, int mode, VC1541_CONFIG *config)
r3245r3246
652650   vc1541->type=TypeVC1541;
653651   vc1541->cpunumber = config->cpunr;
654652   vc1541->drive.serial.deviceid = config->devicenr;
653   vc1541->timer = timer_alloc(vc1541_timer, NULL);
655654   return 0;
656655}
657656
r3245r3246
951950{
952951   vc1541->cpunumber = config->cpunr;
953952   vc1541->type=TypeC1551;
953   vc1541->timer = timer_alloc(vc1541_timer, NULL);
954954   tpi6525[0].c.read=c1551_port_c_r;
955955   tpi6525[0].b.read=c1551_port_b_r;
956956
src/mess/machine/c16.c
r3245r3246
6868static UINT8 *c16_memory_28000;
6969static UINT8 *c16_memory_2c000;
7070
71static UINT8 read_cfg0(running_machine *machine)
72{
73   UINT8 result;
74   switch(mame_get_phase(machine))
75   {
76      case MAME_PHASE_RESET:
77      case MAME_PHASE_RUNNING:
78         result = input_port_read(machine, "CFG0");
79         break;
71int has_c1551 = 0, has_vc1541 = 0, has_iec8 = 0, has_iec9 = 0; // Notice that iec8 & iec9 have never been implemented
8072
81      default:
82         result = 0x00;
83         break;
84   }
85   return result;
86}
87
8873static UINT8 read_cfg1(running_machine *machine)
8974{
9075   UINT8 result;
r3245r3246
444429
445430static void c16_common_driver_init (running_machine *machine)
446431{
447#ifdef VC1541
448432   VC1541_CONFIG vc1541= { 1, 8 };
449#endif
450433   C1551_CONFIG config= { 1 };
451434   UINT8 *rom;
452435
r3245r3246
457440   c16_select_roms (machine, 0, 0);
458441   c16_switch_to_rom (machine, 0, 0);
459442
460   if ((read_cfg0(machine) & 0xc0 ) == 0x40)      /* C1551 */
443   if (has_c1551)      /* C1551 */
461444    {
462445      tpi6525[2].a.read   = c1551x_0_read_data;
463446      tpi6525[2].a.output = c1551x_0_write_data;
r3245r3246
495478   memset(mess_ram + (0xfdc0 % mess_ram_size), 0xff, 0x40);
496479
497480   memset(mess_ram + (0xfd40 % mess_ram_size), 0xff, 0x20);
498
499   if ((read_cfg0(machine) & 0xc0 ) == 0x40)      /* C1551 */
481   
482   if (has_c1551)      /* C1551 */
500483      c1551_config (0, 0, &config);
501484
502#ifdef VC1541
503   if ((read_cfg0(machine) & 0xc0 ) == 0x80)      /* VC1541 */
485   if (has_vc1541)      /* VC1541 */
504486      vc1541_config (0, 0, &vc1541);
505#endif
506487}
507488
508489void c16_driver_init(running_machine *machine)
r3245r3246
512493   ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom);
513494}
514495
496
497DRIVER_INIT( c16 )
498{
499   c16_driver_init(machine);
500}
501
502DRIVER_INIT( c16c )
503{
504   has_c1551 = 1;
505   c16_driver_init(machine);
506}
507
508DRIVER_INIT( c16v )
509{
510   has_vc1541 = 1;
511   c16_driver_init(machine);
512}
513
514
515515MACHINE_RESET( c16 )
516516{
517517   tpi6525_2_reset();
r3245r3246
562562      ted7360_set_dma (ted7360_dma_read, ted7360_dma_read_rom);
563563   }
564564
565   if ((read_cfg0(machine) & 0x38 ) == 0x08 || (read_cfg0(machine) & 0xc0 ) == 0x40)  /* IEC8 on || C1551 */
565   if (has_c1551 || has_iec8)      /* IEC8 on || C1551 */
566566   {
567567      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,  0xfee0, 0xfeff, 0, 0, tpi6525_2_port_w);
568568      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, tpi6525_2_port_r);
r3245r3246
572572      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,  0xfee0, 0xfeff, 0, 0, SMH_NOP);
573573      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfee0, 0xfeff, 0, 0, SMH_NOP);
574574   }
575   if ((read_cfg0(machine) & 0x07 ) == 0x01)      /* IEC9 on */
575   if (has_iec9)               /* IEC9 on */
576576   {
577577      memory_install_write8_handler(machine, 0, ADDRESS_SPACE_PROGRAM,  0xfec0, 0xfedf, 0, 0, tpi6525_3_port_w);
578578      memory_install_read8_handler(machine, 0, ADDRESS_SPACE_PROGRAM, 0xfec0, 0xfedf, 0, 0, tpi6525_3_port_r);
r3245r3246
586586   cbm_drive_0_config (SERIAL, 8);
587587   cbm_drive_1_config (SERIAL, 9);
588588
589   if ((read_cfg0(machine) & 0xc0 ) == 0x40)      /* c1551 */
589   if (has_c1551)      /* c1551 */
590590      c1551_reset ();
591591
592#ifdef VC1541
593   if ((read_cfg0(machine) & 0xc0 ) == 0x80)      /* VC1541 */
592   if (has_vc1541)      /* VC1541 */
594593      vc1541_reset ();
595#endif
596594
597595   cbm_serial_reset_write (0);
598596}
r3245r3246
611609
612610      /* Shift Lock is mapped on Left/Right Shift */
613611      if ((i == 1) && (input_port_read(machine, "SPECIAL") & 0x80))
614         value |= 0x80;         
612         value &= ~0x80;         
615613
616614      keyline[i] = value;
617615   }
src/mess/machine/cbmipt.c
r3245r3246
359359   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )     
360360   PORT_DIPSETTING(   0x10, DEF_STR( On ) )     
361361
362   PORT_START("CFG0")
363   PORT_BIT( 0xc0, 0x00, IPT_UNUSED )                       
364   PORT_DIPNAME( 0x38, 0x08, "Device 8")                     
365   PORT_DIPSETTING(   0x00, DEF_STR( None ) )                 
366   PORT_DIPSETTING(   0x08, "C1551 Floppy Drive Simulation" )     
367   PORT_DIPSETTING(   0x18, "Serial Bus / VC1541 Floppy Drive Simulation" )
368   PORT_DIPNAME( 0x07, 0x01, "Device 9")                     
369   PORT_DIPSETTING(   0x00, DEF_STR( None ) )                 
370   PORT_DIPSETTING(   0x01, "C1551 Floppy Drive Simulation" )     
371   PORT_DIPSETTING(   0x03, "Serial Bus / VC1541 Floppy Drive Simulation" )
372
373362   PORT_START("CFG1")
374363   PORT_DIPNAME( 0x80, 0x80, "Sidcard")               
375364   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )           
src/mess/drivers/c16.c
r3245r3246
285285
286286   /* no real floppy */
287287
288   PORT_INCLUDE( c16_config )            /* DSW0, CFG0, CFG1 */
288   PORT_INCLUDE( c16_config )            /* DSW0, CFG1 */
289289INPUT_PORTS_END
290290
291291
292static INPUT_PORTS_START( c16c )
293   PORT_INCLUDE( c16 )
294
295   /* c1551 floppy */
296
297   PORT_MODIFY("CFG0")
298   PORT_BIT( 0x38, 0x10, IPT_UNUSED )
299   PORT_BIT( 0x07, 0x00, IPT_UNUSED )
300INPUT_PORTS_END
301
302
303static INPUT_PORTS_START( c16v )
304   PORT_INCLUDE( c16 )
305   
306   /* vc1541 floppy */
307   
308   PORT_MODIFY("CFG0")
309   PORT_BIT( 0x38, 0x10, IPT_UNUSED )
310   PORT_BIT( 0x07, 0x00, IPT_UNUSED )
311INPUT_PORTS_END
312
313
314292static INPUT_PORTS_START( plus4 )
315293   PORT_INCLUDE( c16 )
316294
r3245r3246
335313INPUT_PORTS_END
336314
337315
338static INPUT_PORTS_START (plus4c)
339   PORT_INCLUDE( plus4 )
340316
341   /* c1551 floppy */
342   
343   PORT_MODIFY("CFG0")
344   PORT_BIT( 0x38, 0x10, IPT_UNUSED )
345   PORT_BIT( 0x07, 0x00, IPT_UNUSED )
346   PORT_MODIFY("CFG1")
347   PORT_BIT( 0x10, 0x10, IPT_UNUSED )         /* ntsc */
348   PORT_BIT( 0x0c, 0x04, IPT_UNUSED )         /* plus4 */
349INPUT_PORTS_END
350
351
352static INPUT_PORTS_START (plus4v)
353   PORT_INCLUDE( plus4 )
354
355   /* vc1541 floppy */
356   
357   PORT_MODIFY("CFG0")
358   PORT_BIT( 0x38, 0x20, IPT_UNUSED )
359   PORT_BIT( 0x07, 0x00, IPT_UNUSED )
360   PORT_MODIFY("CFG1")
361   PORT_BIT( 0x10, 0x10, IPT_UNUSED )         /* ntsc */
362   PORT_BIT( 0x0c, 0x04, IPT_UNUSED )         /* plus4 */
363INPUT_PORTS_END
364
365
366317#if 0
367318static INPUT_PORTS_START (c364)
368319   PORT_INCLUDE( plus4 )
r3245r3246
455406
456407static MACHINE_DRIVER_START( c16v )
457408   MDRV_IMPORT_FROM( c16 )
458//   MDRV_IMPORT_FROM( cpu_vc1541 )
409   MDRV_IMPORT_FROM( cpu_vc1541 )
459410#ifdef CPU_SYNC
460411   MDRV_INTERLEAVE(1)
461412#else
r3245r3246
490441
491442static MACHINE_DRIVER_START( plus4v )
492443   MDRV_IMPORT_FROM( plus4 )
493//   MDRV_IMPORT_FROM( cpu_vc1541 )
444   MDRV_IMPORT_FROM( cpu_vc1541 )
494445
495446   MDRV_SCREEN_MODIFY("main")
496447   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
r3245r3246
630581ROM_END
631582
632583
633
634584/*************************************
635585 *
636 *  Generic driver initialization
637 *
638 *************************************/
639
640
641static DRIVER_INIT( c16 )
642{
643   c16_driver_init(machine);
644}
645
646static DRIVER_INIT( plus4 )   
647{
648   c16_driver_init(machine);
649}
650
651
652/*************************************
653 *
654586 *  System configuration(s)
655587 *
656588 *************************************/
r3245r3246
707639/*    YEAR  NAME  PARENT COMPAT MACHINE INPUT   INIT   CONFIG    COMPANY                             FULLNAME            FLAGS */
708640
709641COMP( 1984, c16,     0,     0,  c16,    c16,    c16,    c16,     "Commodore Business Machines Co.",  "Commodore 16 (PAL)", 0)
710COMP( 1984, c16c,    c16,   0,  c16c,   c16c,   c16,    c16c,    "Commodore Business Machines Co.",  "Commodore 16 (PAL, 1551)", 0 )
711COMP( 1984, c16v,    c16,   0,  c16v,   c16v,   c16,    c16v,    "Commodore Business Machines Co.",  "Commodore 16 (PAL, VC1541)", GAME_NOT_WORKING)
642COMP( 1984, c16c,    c16,   0,  c16c,   c16,    c16c,   c16c,    "Commodore Business Machines Co.",  "Commodore 16 (PAL, 1551)", 0 )
643COMP( 1984, c16v,    c16,   0,  c16v,   c16,    c16v,   c16v,    "Commodore Business Machines Co.",  "Commodore 16 (PAL, VC1541)", GAME_NOT_WORKING)
712644COMP( 1984, c16hun,  c16,   0,  c16,    c16,    c16,    c16,     "Commodore Business Machines Co.",  "Commodore 16 Novotrade (PAL, Hungary)", 0)
713645
714646COMP( 1984, c116,    c16,   0,  c16,    c16,    c16,    c16,     "Commodore Business Machines Co.",  "Commodore 116 (PAL)", 0)
715COMP( 1984, c116c,    c16,   0,  c16c,   c16c,   c16,    c16c,    "Commodore Business Machines Co.",  "Commodore 116 (PAL, 1551)", 0 )
716COMP( 1984, c116v,   c16,   0,  c16v,   c16v,   c16,    c16v,    "Commodore Business Machines Co.",  "Commodore 116 (PAL, VC1541)", GAME_NOT_WORKING)
647COMP( 1984, c116c,    c16,   0,  c16c,   c16,    c16c,   c16c,    "Commodore Business Machines Co.",  "Commodore 116 (PAL, 1551)", 0 )
648COMP( 1984, c116v,   c16,   0,  c16v,   c16,    c16v,   c16v,    "Commodore Business Machines Co.",  "Commodore 116 (PAL, VC1541)", GAME_NOT_WORKING)
717649
718COMP( 1984, plus4,   c16,   0,  plus4,  plus4,  plus4,  plus,    "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC)", 0)
719COMP( 1984, plus4c,  c16,   0,  plus4c, plus4c, plus4,  plusc,   "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC, 1551)", 0 )
720COMP( 1984, plus4v,  c16,   0,  plus4v, plus4v, plus4,  plusv,   "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC, VC1541)", GAME_NOT_WORKING)
650COMP( 1984, plus4,   c16,   0,  plus4,  plus4,  c16,    plus,    "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC)", 0)
651COMP( 1984, plus4c,  c16,   0,  plus4c, plus4,  c16c,   plusc,   "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC, 1551)", 0 )
652COMP( 1984, plus4v,  c16,   0,  plus4v, plus4,  c16v,   plusv,   "Commodore Business Machines Co.",  "Commodore Plus/4 (NTSC, VC1541)", GAME_NOT_WORKING)
721653
722654COMP( 1984, c232,    c16,   0,  c16,    c16,    c16,    c16,     "Commodore Business Machines Co.",  "Commodore 232 (Prototype)", 0)
723COMP( 1984, c264,    c16,   0,  c16,    plus4,  plus4,  plus,    "Commodore Business Machines Co.",  "Commodore 264 (Prototype)", 0)
724COMP( 1984, c364,    c16,   0,  c364,   plus4,  plus4,  plusv,   "Commodore Business Machines Co.",  "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND)
655COMP( 1984, c264,    c16,   0,  c16,    plus4,  c16,    plus,    "Commodore Business Machines Co.",  "Commodore 264 (Prototype)", 0)
656COMP( 1984, c364,    c16,   0,  c364,   plus4,  c16,    plusv,   "Commodore Business Machines Co.",  "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team