Previous 15994 Revisions Next

r7382 Tuesday 16th February, 2010 at 23:50:22 UTC by Fabio Priuli
[CBM] wip:
- converted t6721 to be a device and updated c364 to use the new code (no progresses on the actual speech, though)
- removed fake dips from c16 inputs and converted c16/plus4 to use Categories for Joystick enabling
- moved emulation of the C16 + SID card to separate drivers (c16sid, plus4sid)
[src/mess]messdriv.c
[src/mess/audio]t6721.c t6721.h*
[src/mess/drivers]c16.c
[src/mess/includes]c16.h
[src/mess/machine]c16.c cbmipt.c cbmipt.h

src/mess/audio/t6721.c
r7381r7382
1313
1414***************************************************************************/
1515
16#include <ctype.h>
17#include "emu.h"
18#include "cpu/m6502/m6502.h"
19
20#include "includes/c16.h"
21
22
23#define VERBOSE_LEVEL 0
24#define DBG_LOG(N,M,A) \
25   do { \
26      if(VERBOSE_LEVEL >= N) \
27      { \
28         if( M ) \
29            logerror("%11.6f: %-24s", attotime_to_double(timer_get_time(machine)), (char*) M ); \
30         logerror A; \
31      } \
32   } while (0)
33
34
35
3616/*
3717 c364 speech
3818 say 0 .. 10
r7381r7382
7252sound generator (?), CD40105BE (RCA H 432) and a 74LS222A logic chip.
7353
7454*/
75static struct {
55
56#include "emu.h"
57#include "audio/t6721.h"
58
59
60typedef struct _t6721_state  t6721_state;
61struct _t6721_state
62{
7663   emu_timer *timer;
7764
78   int busy, endOfSample;
65   int busy, end_of_sample;
7966   int playing;
8067   int rate;
81   struct {
82      UINT8 data;
83      int state;
84   } command;
85   struct {
86      UINT8 data[6],index;
87   } sample;
8868
69   UINT8 command_data;
70   int command_state;
71
72   UINT8 sample_data[6], sample_index;
73
8974   UINT8 state;
9075
91   int sampleindex;
76   int sample_timeindex;
9277   UINT8 readindex, writeindex;
9378   UINT64 data[0x10];
79};
9480
95} speech={ 0 };
81/*****************************************************************************
82    LOGGING
83*****************************************************************************/
9684
97static TIMER_CALLBACK(c364_speech_timer)
85#define VERBOSE_LEVEL 0
86#define DBG_LOG(N,M,A) \
87   do { \
88      if(VERBOSE_LEVEL >= N) \
89      { \
90         if( M ) \
91            logerror("%11.6f: %-24s", attotime_to_double(timer_get_time(device->machine)), (char*) M ); \
92         logerror A; \
93      } \
94   } while(0)
95
96
97/*****************************************************************************
98    INLINE FUNCTIONS
99*****************************************************************************/
100
101INLINE t6721_state *get_safe_token( running_device *device )
98102{
99   if (!speech.playing) return;
103   assert(device != NULL);
104   assert(device->token != NULL);
105   assert(device->type == T6721);
100106
101   if (speech.sampleindex<8000/50) {
102      speech.sampleindex++;
103   } else {
104      speech.endOfSample=
105            (memcmp(speech.sample.data,"\xff\xff\xff\xff\xff\xff",6)==0);
106      /*speech.endOfSample=TRUE; */
107      speech.busy=FALSE;
108   }
107   return (t6721_state *)device->token;
109108}
110109
111void c364_speech_init(running_machine *machine)
110/*****************************************************************************
111    IMPLEMENTATION
112*****************************************************************************/
113
114static TIMER_CALLBACK( t6721_speech_timer )
112115{
113   speech.timer = timer_alloc(machine, c364_speech_timer, NULL);
116   t6721_state *t6721 = (t6721_state *)ptr;
117
118   if (!t6721->playing)
119      return;
120
121   if (t6721->sample_timeindex < 8000 / 50)
122   {
123      t6721->sample_timeindex++;
124   }
125   else
126   {
127      t6721->end_of_sample = (memcmp(t6721->sample_data, "\xff\xff\xff\xff\xff\xff", 6) == 0);
128
129      /*t6721->end_of_sample = 1; */
130      t6721->busy = 0;
131   }
114132}
115133
116void c364_speech_reset(running_machine *machine)
134WRITE8_DEVICE_HANDLER( t6721_speech_w )
117135{
118   memset(&speech, 0, sizeof(speech));
119}
136   t6721_state *t6721 = get_safe_token(device);
120137
121WRITE8_HANDLER(c364_speech_w)
122{
123   running_machine *machine = space->machine;
124   DBG_LOG (2, "364", ("port write %.2x %.2x\n", offset, data));
125   switch (offset) {
138   DBG_LOG(2, "364", ("port write %.2x %.2x\n", offset, data));
139
140   switch (offset)
141   {
126142   case 0:
127      if (data&0x80) {
128         switch (speech.command.state) {
143      if (data & 0x80)
144      {
145         switch (t6721->command_state)
146         {
129147         case 0:
130            switch (speech.command.data) {
131            case 9:case 0xb:
132               speech.playing=FALSE;
148            switch (t6721->command_data)
149            {
150            case 9: case 0xb:
151               t6721->playing = 0;
133152               break;
134153            case 1: /* start */
135               timer_adjust_periodic(speech.timer, attotime_zero, 0, ATTOTIME_IN_HZ(8000));
136               speech.playing=TRUE;
137               speech.endOfSample=FALSE;
138               speech.sampleindex=0;
154               timer_adjust_periodic(t6721->timer, attotime_zero, 0, ATTOTIME_IN_HZ(8000));
155               t6721->playing = 1;
156               t6721->end_of_sample = 0;
157               t6721->sample_timeindex = 0;
139158               break;
140159            case 2:
141               speech.endOfSample=FALSE;
142               /*speech.busy=FALSE; */
143               timer_reset(speech.timer, attotime_never);
144               speech.playing=FALSE;
160               t6721->end_of_sample = 0;
161               /*t6721->busy = 0; */
162               timer_reset(t6721->timer, attotime_never);
163               t6721->playing = 0;
145164               break;
146165            case 5: /* set rate (in next nibble) */
147               speech.command.state=1;
166               t6721->command_state = 1;
148167               break;
149168            case 6: /* condition */
150               speech.command.state=2;
169               t6721->command_state = 2;
151170               break;
152171            }
153172            break;
154173         case 1:
155            speech.command.state=0;
156            speech.rate=speech.command.data;
174            t6721->command_state = 0;
175            t6721->rate = t6721->command_data;
157176            break;
158177         case 2:
159            speech.command.state=0;
178            t6721->command_state = 0;
160179            break;
161180         }
162      } else {
163         speech.command.data=data;
181      }
182      else
183      {
184         t6721->command_data = data;
164185      }
165186      break;
166187   case 1:
167      speech.state=(speech.state&~0x3f)|data;
188      t6721->state = (t6721->state & ~0x3f) | data;
168189      break;
169190   case 2:
170      speech.sample.data[speech.sample.index++]=data;
171      if (speech.sample.index==sizeof(speech.sample.data)) {
191      t6721->sample_data[t6721->sample_index++] = data;
192      if (t6721->sample_index == sizeof(t6721->sample_data))
193      {
172194         DBG_LOG(1,"t6721",("%.2x%.2x%.2x%.2x%.2x%.2x\n",
173                        speech.sample.data[0],
174                        speech.sample.data[1],
175                        speech.sample.data[2],
176                        speech.sample.data[3],
177                        speech.sample.data[4],
178                        speech.sample.data[5]));
179         speech.sample.index=0;
180         /*speech.endOfSample=false; */
181         speech.busy=TRUE;
182         speech.state=0;
195                        t6721->sample_data[0],
196                        t6721->sample_data[1],
197                        t6721->sample_data[2],
198                        t6721->sample_data[3],
199                        t6721->sample_data[4],
200                        t6721->sample_data[5]));
201         t6721->sample_index = 0;
202         /*t6721->end_of_sample = false; */
203         t6721->busy = 1;
204         t6721->state = 0;
183205      }
184206      break;
185207   }
186208}
187209
188READ8_HANDLER(c364_speech_r)
210READ8_DEVICE_HANDLER( t6721_speech_r )
189211{
190   running_machine *machine = space->machine;
191   int data=0xff;
192   switch (offset) {
212   t6721_state *t6721 = get_safe_token(device);
213
214   int data = 0xff;
215   switch (offset)
216   {
193217   case 1:
194      data=speech.state;
195      data=1;
196      if (!speech.endOfSample) {
197            data|=0x41;
198            if (!speech.busy) data |=0x81;
218      data = t6721->state;
219      data = 1;
220      if (!t6721->end_of_sample)
221      {
222            data |= 0x41;
223            if (!t6721->busy)
224               data |= 0x81;
199225      }
200226      break;
201227   }
202   DBG_LOG (2, "364", ("port read %.2x %.2x\n", offset, data));
228   DBG_LOG(2, "364", ("port read %.2x %.2x\n", offset, data));
229
203230   return data;
204231}
205232
233/*****************************************************************************
234    DEVICE INTERFACE
235*****************************************************************************/
206236
237static DEVICE_START( t6721 )
238{
239   t6721_state *t6721 = get_safe_token(device);
240
241   t6721->timer = timer_alloc(device->machine, t6721_speech_timer, t6721);
242
243   state_save_register_device_item_array(device, 0, t6721->sample_data);
244   state_save_register_device_item_array(device, 0, t6721->data);
245
246   state_save_register_device_item(device, 0, t6721->sample_index);
247   state_save_register_device_item(device, 0, t6721->busy);
248
249   state_save_register_device_item(device, 0, t6721->end_of_sample);
250   state_save_register_device_item(device, 0, t6721->playing);
251   state_save_register_device_item(device, 0, t6721->rate);
252
253   state_save_register_device_item(device, 0, t6721->command_data);
254   state_save_register_device_item(device, 0, t6721->command_state);
255   state_save_register_device_item(device, 0, t6721->state);
256
257   state_save_register_device_item(device, 0, t6721->sample_timeindex);
258
259   state_save_register_device_item(device, 0, t6721->readindex);
260   state_save_register_device_item(device, 0, t6721->writeindex);
261}
262
263
264static DEVICE_RESET( t6721 )
265{
266   t6721_state *t6721 = get_safe_token(device);
267
268   memset(t6721->sample_data, 0, ARRAY_LENGTH(t6721->sample_data));
269   memset(t6721->data, 0, ARRAY_LENGTH(t6721->data));
270
271   t6721->sample_index = 0;
272   t6721->busy = 0;
273
274   t6721->end_of_sample = 0;
275   t6721->playing = 0;
276   t6721->rate = 0;
277
278   t6721->command_data = 0;
279   t6721->command_state = 0;
280   t6721->state = 0;
281
282   t6721->sample_timeindex = 0;
283
284   t6721->readindex = 0;
285   t6721->writeindex = 0;
286}
287
288
289/*-------------------------------------------------
290    device definition
291-------------------------------------------------*/
292
293static const char DEVTEMPLATE_SOURCE[] = __FILE__;
294
295#define DEVTEMPLATE_ID(p,s)            p##t6721##s
296#define DEVTEMPLATE_FEATURES         DT_HAS_START | DT_HAS_RESET
297#define DEVTEMPLATE_NAME            "Toshiba 6721A"
298#define DEVTEMPLATE_FAMILY            "Toshiba 6721A"
299#include "devtempl.h"
src/mess/audio/t6721.h
r0r7382
1/*****************************************************************************
2 *
3 * audio/t6721.h
4 *
5 ****************************************************************************/
6
7#ifndef __T6721_H__
8#define __T6721_H__
9
10#include "devcb.h"
11
12
13/***************************************************************************
14    FUNCTION PROTOTYPES
15***************************************************************************/
16
17DEVICE_GET_INFO( t6721 );
18
19/***************************************************************************
20    DEVICE CONFIGURATION MACROS
21***************************************************************************/
22
23#define T6721 DEVICE_GET_INFO_NAME( t6721 )
24
25#define MDRV_T6721_ADD(_tag) \
26   MDRV_DEVICE_ADD(_tag, T6721, 0) \
27
28
29/*----------- defined in audio/t6721.c -----------*/
30
31WRITE8_DEVICE_HANDLER(t6721_speech_w);
32READ8_DEVICE_HANDLER(t6721_speech_r);
33
34
35#endif /* __TED7360_H__ */
src/mess/includes/c16.h
r7381r7382
77#ifndef __C16_H__
88#define __C16_H__
99
10#include "devices/cartslot.h"
11
1210/*----------- defined in machine/c16.c -----------*/
1311
1412UINT8 c16_m7501_port_read(running_device *device, UINT8 direction);
1513void c16_m7501_port_write(running_device *device, UINT8 direction, UINT8 data);
1614
1715extern WRITE8_HANDLER(c16_6551_port_w);
18extern READ8_HANDLER(c16_6551_port_r);
16extern READ8_HANDLER(c16_6551_port_r);
1917
20extern READ8_HANDLER(c16_fd1x_r);
18extern READ8_HANDLER(c16_fd1x_r);
2119extern WRITE8_HANDLER(plus4_6529_port_w);
22extern READ8_HANDLER(plus4_6529_port_r);
20extern READ8_HANDLER(plus4_6529_port_r);
2321
2422extern WRITE8_HANDLER(c16_6529_port_w);
25extern READ8_HANDLER(c16_6529_port_r);
23extern READ8_HANDLER(c16_6529_port_r);
2624
2725extern WRITE8_HANDLER(c16_select_roms);
2826extern WRITE8_HANDLER(c16_switch_to_rom);
r7381r7382
3533extern int c16_dma_read_rom(running_machine *machine, int offset);
3634
3735extern DRIVER_INIT( c16 );
36extern DRIVER_INIT( plus4 );
37extern DRIVER_INIT( c16sid );
38extern DRIVER_INIT( plus4sid );
3839extern MACHINE_RESET( c16 );
39extern MACHINE_START( c16 );
4040extern INTERRUPT_GEN( c16_frame_interrupt );
4141
4242MACHINE_DRIVER_EXTERN( c16_cartslot );
4343
44
45/*----------- defined in audio/t6721.c -----------*/
46
47extern WRITE8_HANDLER(c364_speech_w);
48extern READ8_HANDLER(c364_speech_r);
49
50extern void c364_speech_init(running_machine *machine);
51extern void c364_speech_reset(running_machine *machine);
52
53
5444#endif /* __C16_H__ */
src/mess/messdriv.c
r7381r7382
524524   DRIVER( c232 )     /* Commodore 232 - Prototype  */
525525   DRIVER( c264 )     /* Commodore 264 - Prototype  */
526526   DRIVER( c364 )     /* Commodore V364 - Prototype    */
527   DRIVER( c16sid )      /* Commodore 16  sid card  */
528   DRIVER( plus4sid )    /* Commodore +4  sid card  */
527529
528530   DRIVER( c128 )     /* Commodore 128 - NTSC    */
529531   DRIVER( c128cr )   /* Commodore 128CR - NTSC (proto?)    */
src/mess/machine/c16.c
r7381r7382
5252 * 7 ack input edge ready for next datum
5353 */
5454
55static int c16_has_sid, c16_pal;
56
5557static UINT8 port6529;
5658
5759static int lowrom, highrom;
r7381r7382
6567static UINT8 *c16_memory_28000;
6668static UINT8 *c16_memory_2c000;
6769
68static UINT8 read_cfg1( running_machine *machine )
69{
70   UINT8 result;
71   switch (mame_get_phase(machine))
72   {
73      case MAME_PHASE_RESET:
74      case MAME_PHASE_RUNNING:
75         result = input_port_read(machine, "CFG1");
76         break;
77
78      default:
79         result = 0x00;
80         break;
81   }
82   return result;
83}
84
8570/*
8671  ddr bit 1 port line is output
8772  port bit 1 port line is high
r7381r7382
461446DRIVER_INIT( c16 )
462447{
463448   c16_common_driver_init(machine);
449
450   c16_has_sid = 0;
451   c16_pal = 1;
464452}
465453
466MACHINE_START( c16 )
454DRIVER_INIT( plus4 )
467455{
468   c364_speech_init(machine);
456   c16_common_driver_init(machine);
457
458   c16_has_sid = 0;
459   c16_pal = 0;
469460}
470461
462DRIVER_INIT( c16sid )
463{
464   c16_common_driver_init(machine);
465
466   c16_has_sid = 1;
467   c16_pal = 1;
468}
469
470DRIVER_INIT( plus4sid )
471{
472   c16_common_driver_init(machine);
473
474   c16_has_sid = 1;
475   c16_pal = 0;
476}
477
471478MACHINE_RESET( c16 )
472479{
473480   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
474   running_device *sid = devtag_get_device(space->machine, "sid");
475481
476   c364_speech_reset(machine);
477
478   if (read_cfg1(machine) & 0x80)  /* SID card present */
482   if (c16_pal)
479483   {
480      memory_install_read8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_r);
481      memory_install_write8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_w);
482      memory_install_read8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_r);
483      memory_install_write8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_w);
484   }
485   else
486   {
487      memory_nop_readwrite(space, 0xfd40, 0xfd5f, 0, 0);
488      memory_nop_readwrite(space, 0xfe80, 0xfe9f, 0, 0);
489   }
490
491#if 0
492   c16_switch_to_rom (0, 0);
493   c16_select_roms (0, 0);
494#endif
495   if ((read_cfg1(machine) & 0x0c) == 0x00)      /* is it C16? */
496   {
497484      memory_set_bankptr(machine, "bank1", messram_get_ptr(devtag_get_device(machine, "messram")) + (0x4000 % messram_get_size(devtag_get_device(machine, "messram"))));
498485
499486      memory_set_bankptr(machine, "bank5", messram_get_ptr(devtag_get_device(machine, "messram")) + (0x4000 % messram_get_size(devtag_get_device(machine, "messram"))));
r7381r7382
512499   }
513500}
514501
502#if 0
503// FIXME
504// in very old MESS versions, we had these handlers to enable SID writes to 0xd400.
505// would a real SID Card allow for this? If not, this should be removed completely
506static WRITE8_HANDLER( c16_sidcart_16k )
507{
508   running_device *sid = devtag_get_device(space->machine, "sid");
515509
510   messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x1400 + offset] = data;
511   messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x5400 + offset] = data;
512   messram_get_ptr(devtag_get_device(space->machine, "messram"))[0x9400 + offset] = data;
513   messram_get_ptr(devtag_get_device(space->machine, "messram"))[0xd400 + offset] = data;
514
515   sid6581_w(sid, offset, data);
516}
517
518static WRITE8_HANDLER( c16_sidcart_64k )
519{
520   running_device *sid = devtag_get_device(space->machine, "sid");
521
522   messram_get_ptr(devtag_get_device(space->machine, "messram"))[0xd400 + offset] = data;
523
524   sid6581_w(sid, offset, data);
525}
526
527static TIMER_CALLBACK( c16_sidhack_tick )
528{
529   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
530
531   if (input_port_read_safe(machine, "SID", 0x00) & 0x02)
532   {
533      if (c16_pal)
534         memory_install_write8_handler(space, 0xd400, 0xd41f, 0, 0, c16_sidcart_16k);
535      else
536         memory_install_write8_handler(space, 0xd400, 0xd41f, 0, 0, c16_sidcart_64k);
537   }
538   else
539   {
540      memory_unmap_write(space, 0xd400, 0xd41f, 0, 0);
541   }
542}
543#endif
544
545static TIMER_CALLBACK( c16_sidcard_tick )
546{
547   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
548   running_device *sid = devtag_get_device(machine, "sid");
549
550   if (input_port_read_safe(machine, "SID", 0x00) & 0x01)
551   {
552      memory_install_readwrite8_device_handler(space, sid, 0xfe80, 0xfe9f, 0, 0, sid6581_r, sid6581_w);
553   }
554   else
555   {
556      memory_install_readwrite8_device_handler(space, sid, 0xfd40, 0xfd5f, 0, 0, sid6581_r, sid6581_w);
557   }
558}
559
516560INTERRUPT_GEN( c16_frame_interrupt )
517561{
518562   running_device *ted7360 = devtag_get_device(device->machine, "ted7360");
r7381r7382
532576      keyline[i] = value;
533577   }
534578
535   if (input_port_read(device->machine, "DSW0") & 0x80)
579   if (input_port_read(device->machine, "CTRLSEL") & 0x01)
536580   {
537581      value = 0xff;
538582      if (input_port_read(device->machine, "JOY0") & 0x10)         /* Joypad1_Button */
r7381r7382
551595         keyline[8] = value;
552596   }
553597
554   if (input_port_read(device->machine, "DSW0") & 0x40)
598   if (input_port_read(device->machine, "CTRLSEL") & 0x10)
555599   {
556600      value = 0xff;
557601      if (input_port_read(device->machine, "JOY1") & 0x10)         /* Joypad2_Button */
r7381r7382
572616
573617   ted7360_frame_interrupt_gen(ted7360);
574618
619   if (c16_has_sid)
620   {
621      /* if we are emulating the SID card, check which memory area should be accessed */
622      timer_set(device->machine, attotime_zero, NULL, 0, c16_sidcard_tick);
623#if 0
624      /* if we are emulating the SID card, check if writes to 0xd400 have been enabled */
625      timer_set(device->machine, attotime_zero, NULL, 0, c16_sidhack_tick);
626#endif
627   }
628
575629   set_led_status(device->machine, 1, input_port_read(device->machine, "SPECIAL") & 0x80 ? 1 : 0);      /* Shift Lock */
576630   set_led_status(device->machine, 0, input_port_read(device->machine, "SPECIAL") & 0x40 ? 1 : 0);      /* Joystick Swap */
577631}
r7381r7382
590644   const char *filetype;
591645   int address = 0;
592646
593    /* magic lowrom at offset 7: $43 $42 $4d */
647   /* magic lowrom at offset 7: $43 $42 $4d */
594648   /* if at offset 6 stands 1 it will immediatly jumped to offset 0 (0x8000) */
595649   static const unsigned char magic[] = {0x43, 0x42, 0x4d};
596650   unsigned char buffer[sizeof (magic)];
src/mess/machine/cbmipt.c
r7381r7382
250250 *  - C16 shares Keyboard with C64 (only few changes, see c16.c)
251251 *  - c16_special: input port for the Shift Lock Switch
252252 *  - c16_controls: control inputs
253 *  - c16_config: control and devices configurations
254253 *
255254 **********************************************************************************/
256255
r7381r7382
333332
334333
335334INPUT_PORTS_START( c16_controls )
335   PORT_START("CTRLSEL")   /* Controller selection */
336   PORT_CATEGORY_CLASS( 0x01, 0x00, "Gameport 1" )
337   PORT_CATEGORY_ITEM( 0x00, DEF_STR( Joystick ), 10 )
338   PORT_CATEGORY_ITEM( 0x01, "No Device Connected", 11 )
339   PORT_CATEGORY_CLASS( 0x10, 0x00, "Gameport 2" )
340   PORT_CATEGORY_ITEM( 0x00, DEF_STR( Joystick ), 20 )
341   PORT_CATEGORY_ITEM( 0x10, "No Device Connected", 21 )
342
336343   PORT_START("JOY0")
337   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)   PORT_8WAY
338   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)   PORT_8WAY
339   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)   PORT_8WAY
340   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_8WAY
341   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)
344   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("P1 Up") PORT_8WAY PORT_CATEGORY(10)
345   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("P1 Down") PORT_8WAY PORT_CATEGORY(10)
346   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("P1 Left") PORT_8WAY PORT_CATEGORY(10)
347   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("P1 Right") PORT_8WAY PORT_CATEGORY(10)
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P1 Button") PORT_CATEGORY(10)
342349
343350   PORT_START("JOY1")
344   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP)   PORT_NAME("P2 Up") PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_8WAY PORT_PLAYER(2)
345   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN)   PORT_NAME("P2 Down") PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_8WAY PORT_PLAYER(2)
346   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT)   PORT_NAME("P2 Left") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH ) PORT_8WAY PORT_PLAYER(2)
347   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT)   PORT_NAME("P2 Right") PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH ) PORT_8WAY PORT_PLAYER(2)
348   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1)      PORT_NAME("P2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON1 ) PORT_PLAYER(2)
351   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_JOYSTICK_UP) PORT_NAME("P2 Up") PORT_CODE(KEYCODE_HOME) PORT_CODE(JOYCODE_Y_UP_SWITCH) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20)
352   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_JOYSTICK_DOWN) PORT_NAME("P2 Down") PORT_CODE(KEYCODE_END) PORT_CODE(JOYCODE_Y_DOWN_SWITCH) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20)
353   PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_JOYSTICK_LEFT) PORT_NAME("P2 Left") PORT_CODE(KEYCODE_DEL) PORT_CODE(JOYCODE_X_LEFT_SWITCH) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20)
354   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_JOYSTICK_RIGHT) PORT_NAME("P2 Right") PORT_CODE(KEYCODE_PGDN) PORT_CODE(JOYCODE_X_RIGHT_SWITCH) PORT_8WAY PORT_PLAYER(2) PORT_CATEGORY(20)
355   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("P2 Button") PORT_CODE(KEYCODE_LALT) PORT_CODE(JOYCODE_BUTTON1) PORT_PLAYER(2) PORT_CATEGORY(20)
349356INPUT_PORTS_END
350357
351358
352INPUT_PORTS_START( c16_config )
353   PORT_START("DSW0")
354   PORT_DIPNAME( 0x80, 0x80, "Joystick 1")
355   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
356   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
357   PORT_DIPNAME( 0x40, 0x40, "Joystick 2")
358   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
359   PORT_DIPSETTING(   0x40, DEF_STR( On ) )
360   PORT_DIPNAME( 0x20, 0x20, "Tape Drive / Device 1")
361   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
362   PORT_DIPSETTING(   0x20, DEF_STR( On ) )
363   PORT_DIPNAME( 0x10, 0x00, "Tape Sound")
364   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
365   PORT_DIPSETTING(   0x10, DEF_STR( On ) )
366
367   PORT_START("CFG1")
368   PORT_DIPNAME( 0x80, 0x80, "Sidcard")
369   PORT_DIPSETTING(   0x00, DEF_STR( Off ) )
370   PORT_DIPSETTING(   0x80, DEF_STR( On ) )
371   PORT_BIT( 0x40, 0x00, IPT_UNUSED )         /* 2008-05 FP: removed the SID card hack cfg */
372   PORT_BIT( 0x10, 0x00, IPT_UNUSED )         /* pal */
373   PORT_BIT( 0x0c, 0x00, IPT_UNUSED )         /* c16 */
374INPUT_PORTS_END
375
376
377359/***************************** Commodore 128 ***************************************
378360 *
379361 *  - C128 shares Controls and Keyboard with C64 (+ a keypad, see c128.c)
src/mess/machine/cbmipt.h
r7381r7382
1313
1414INPUT_PORTS_EXTERN( c16_special );
1515INPUT_PORTS_EXTERN( c16_controls );
16INPUT_PORTS_EXTERN( c16_config );
1716
1817
1918/* Commodore 65 */
src/mess/drivers/c16.c
r7381r7382
116116#include "cpu/m6502/m6502.h"
117117#include "sound/sid6581.h"
118118
119#include "audio/ted7360.h"
120#include "audio/t6721.h"
119121#include "machine/cbmipt.h"
120#include "audio/ted7360.h"
121122#include "devices/messram.h"
122123#include "machine/c1541.h"
123124#include "machine/c1551.h"
r7381r7382
135136 *************************************/
136137
137138
138
139139/*
140140 * commodore c16/c116/plus 4
141141 * 16 KByte (C16/C116) or 32 KByte or 64 KByte (plus4) RAM
r7381r7382
184184   AM_RANGE(0xff20, 0xffff) AM_READ_BANK("bank8")
185185   AM_RANGE(0xff3e, 0xff3e) AM_WRITE(c16_switch_to_rom)
186186   AM_RANGE(0xff3f, 0xff3f) AM_WRITE(c16_switch_to_ram)
187#if 0
188   AM_RANGE(0x4000, 0x7fff) AM_WRITE( c16_write_4000)  /*configured in c16_common_init */
189   AM_RANGE(0x8000, 0xbfff) AM_WRITE( c16_write_8000)  /*configured in c16_common_init */
190   AM_RANGE(0xc000, 0xfcff) AM_WRITE( c16_write_c000)  /*configured in c16_common_init */
191   AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)   /* sidcard, eoroidpro ... */
192   AM_RANGE(0xff20, 0xff3d) AM_WRITE( c16_write_ff20)  /*configure in c16_common_init */
193   AM_RANGE(0xff40, 0xffff) AM_WRITE( c16_write_ff40)  /*configure in c16_common_init */
194#endif
195187ADDRESS_MAP_END
196188
197189static ADDRESS_MAP_START(plus4_map, ADDRESS_SPACE_PROGRAM, 8)
r7381r7382
204196   AM_RANGE(0xfd10, 0xfd1f) AM_READWRITE(plus4_6529_port_r, plus4_6529_port_w)
205197   AM_RANGE(0xfd30, 0xfd3f) AM_READWRITE(c16_6529_port_r, c16_6529_port_w) /* 6529 keyboard matrix */
206198   AM_RANGE(0xfdd0, 0xfddf) AM_WRITE( c16_select_roms) /* rom chips selection */
207#if 0
208   AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)   /* sidcard, eoroidpro ... */
209#endif
210199   AM_RANGE(0xff00, 0xff1f) AM_DEVREADWRITE("ted7360", ted7360_port_r, ted7360_port_w)
211200   AM_RANGE(0xff20, 0xffff) AM_READ_BANK("bank8")
212201   AM_RANGE(0xff20, 0xff3d) AM_WRITEONLY
r7381r7382
223212   AM_RANGE(0x0000, 0xfcff) AM_WRITE_BANK("bank9")
224213   AM_RANGE(0xfd00, 0xfd0f) AM_READWRITE(c16_6551_port_r, c16_6551_port_w)
225214   AM_RANGE(0xfd10, 0xfd1f) AM_READWRITE(plus4_6529_port_r, plus4_6529_port_w)
226   AM_RANGE(0xfd20, 0xfd2f) AM_READWRITE(c364_speech_r, c364_speech_w)
215   AM_RANGE(0xfd20, 0xfd2f) AM_DEVREADWRITE("t6721", t6721_speech_r, t6721_speech_w)
227216   AM_RANGE(0xfd30, 0xfd3f) AM_READWRITE(c16_6529_port_r, c16_6529_port_w) /* 6529 keyboard matrix */
228   AM_RANGE(0xfdd0, 0xfddf) AM_WRITE( c16_select_roms) /* rom chips selection */
229#if 0
230   AM_RANGE(0xfd40, 0xfd5f) AM_DEVREADWRITE("sid6581", sid6581_r, sid6581_w)   /* sidcard, eoroidpro ... */
231#endif
217   AM_RANGE(0xfdd0, 0xfddf) AM_WRITE(c16_select_roms) /* rom chips selection */
232218   AM_RANGE(0xff00, 0xff1f) AM_DEVREADWRITE("ted7360", ted7360_port_r, ted7360_port_w)
233219   AM_RANGE(0xff20, 0xffff) AM_READ_BANK("bank8")
234220   AM_RANGE(0xff20, 0xff3d) AM_WRITEONLY
r7381r7382
280266
281267   PORT_INCLUDE( c16_special )            /* SPECIAL */
282268
283   PORT_INCLUDE( c16_controls )         /* JOY0, JOY1 */
284
285   PORT_INCLUDE( c16_config )            /* DSW0, CFG1 */
269   PORT_INCLUDE( c16_controls )         /* CTRLSEL, JOY0, JOY1 */
286270INPUT_PORTS_END
287271
288272
r7381r7382
301285   PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_RIGHT)                     PORT_CHAR(UCHAR_MAMEKEY(RIGHT))
302286   PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_INSERT)                  PORT_CHAR('*')
303287   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_LEFT)                     PORT_CHAR(UCHAR_MAMEKEY(LEFT))
288INPUT_PORTS_END
304289
305   PORT_MODIFY("CFG1")
306   PORT_BIT( 0x10, 0x10, IPT_UNUSED )         /* ntsc */
307   PORT_BIT( 0x0c, 0x04, IPT_UNUSED )         /* plus4 */
290static INPUT_PORTS_START( c16sid )
291   PORT_INCLUDE( c16 )
292
293   PORT_START("SID")
294   PORT_CONFNAME( 0x01, 0x00, "SID Card Address")
295   PORT_CONFSETTING(   0x00, "0xfd40" )
296   PORT_CONFSETTING(   0x01, "0xfe80" )
297#if 0   
298   PORT_CONFNAME( 0x02, 0x00, "Enable SID writes to 0xd400")
299   PORT_CONFSETTING(   0x00, DEF_STR( No ) )
300   PORT_CONFSETTING(   0x02, DEF_STR( Yes ) )
301#endif
308302INPUT_PORTS_END
309303
310304
311
312#if 0
313static INPUT_PORTS_START (c364)
305static INPUT_PORTS_START( plus4sid )
314306   PORT_INCLUDE( plus4 )
315307
316   PORT_MODIFY("CFG1")
317   PORT_BIT( 0x10, 0x10, IPT_UNUSED )         /* ntsc */
318   PORT_BIT( 0x0c, 0x08, IPT_UNUSED )         /* 364 */
319   /* numeric block - hardware wired to other keys? */
320   /* check cbmipt.c for layout */
308   PORT_START("SID")
309   PORT_CONFNAME( 0x01, 0x00, "SID Card Address")
310   PORT_CONFSETTING(   0x00, "0xfd40" )
311   PORT_CONFSETTING(   0x01, "0xfe80" )
312#if 0   
313   PORT_CONFNAME( 0x02, 0x00, "Enable SID writes to 0xd400")
314   PORT_CONFSETTING(   0x00, DEF_STR( No ) )
315   PORT_CONFSETTING(   0x02, DEF_STR( Yes ) )
316#endif
321317INPUT_PORTS_END
322#endif
323318
324319
325320/*************************************
r7381r7382
478473   MDRV_SPEAKER_STANDARD_MONO("mono")
479474   MDRV_TED7360_ADD("ted7360", c16_ted7360_intf)
480475   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
481   MDRV_SOUND_ADD("sid", SID8580, TED7360PAL_CLOCK/4)
482   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
483476
484477   /* devices */
485478   MDRV_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
r7381r7382
532525   MDRV_CPU_REPLACE( "maincpu", M7501, XTAL_14_31818MHz/16)
533526   MDRV_CPU_PROGRAM_MAP(plus4_map)
534527   MDRV_CPU_CONFIG( c16_m7501_interface )
528
535529   MDRV_SCREEN_MODIFY("screen")
536530   MDRV_SCREEN_REFRESH_RATE(TED7360NTSC_VRETRACERATE)
537531
538   MDRV_SOUND_REPLACE("sid", SID8580, TED7360NTSC_CLOCK/4)
539
540532   MDRV_DEVICE_REMOVE("ted7360")
541533   MDRV_TED7360_ADD("ted7360", plus4_ted7360_intf)
542534   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
r7381r7382
586578   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
587579   MDRV_CPU_MODIFY( "maincpu" )
588580   MDRV_CPU_PROGRAM_MAP(c364_map)
581
582   MDRV_T6721_ADD("t6721")
589583MACHINE_DRIVER_END
590584
591585static MACHINE_DRIVER_START( c264 )
r7381r7382
595589   MDRV_RAM_DEFAULT_SIZE("64K")
596590MACHINE_DRIVER_END
597591
592static MACHINE_DRIVER_START( c16sid )
593   MDRV_IMPORT_FROM( c16 )
598594
595   MDRV_SOUND_ADD("sid", SID8580, TED7360PAL_CLOCK/4)
596   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
597MACHINE_DRIVER_END
598
599static MACHINE_DRIVER_START( plus4sid )
600   MDRV_IMPORT_FROM( plus4 )
601
602   MDRV_SOUND_ADD("sid", SID8580, TED7360NTSC_CLOCK/4)
603   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
604MACHINE_DRIVER_END
605
606
599607/*************************************
600608 *
601609 *  ROM definition(s)
r7381r7382
695703   ROM_LOAD( "317054-01.bin", 0x1c000, 0x4000, CRC(109de2fc) SHA1(0ad7ac2db7da692d972e586ca0dfd747d82c7693) )
696704ROM_END
697705
706#define rom_c16sid      rom_c16
707#define rom_plus4sid      rom_plus4
708
698709/***************************************************************************
699710
700711  Game driver(s)
701712
702713***************************************************************************/
703714
704/*    YEAR  NAME  PARENT COMPAT MACHINE INPUT   INIT      COMPANY                             FULLNAME            FLAGS */
715/*    YEAR  NAME  PARENT COMPAT MACHINE     INPUT      INIT      COMPANY                         FULLNAME            FLAGS */
705716
706COMP( 1984, c16,     0,     0,  c16,    c16,    c16,   "Commodore Business Machines",  "Commodore 16 (PAL)", 0)
707COMP( 1984, c16c,    c16,   0,  c16c,   c16,    c16,   "Commodore Business Machines",  "Commodore 16 (PAL, 1551)", 0 )
708COMP( 1984, c16v,    c16,   0,  c16v,   c16,    c16,   "Commodore Business Machines",  "Commodore 16 (PAL, VC1541)", 0)
709COMP( 1984, c16hun,  c16,   0,  c16,    c16,    c16,   "Commodore Business Machines",  "Commodore 16 Novotrade (PAL, Hungary)", 0)
717COMP( 1984, c16,      0,     0,  c16,       c16,       c16,      "Commodore Business Machines",  "Commodore 16 (PAL)", 0)
718COMP( 1984, c16c,     c16,   0,  c16c,      c16,       c16,      "Commodore Business Machines",  "Commodore 16 (PAL, 1551)", 0 )
719COMP( 1984, c16v,     c16,   0,  c16v,      c16,       c16,      "Commodore Business Machines",  "Commodore 16 (PAL, VC1541)", 0)
720COMP( 1984, c16hun,   c16,   0,  c16,       c16,       c16,      "Commodore Business Machines",  "Commodore 16 Novotrade (PAL, Hungary)", 0)
710721
711COMP( 1984, c116,    c16,   0,  c16,    c16,    c16,   "Commodore Business Machines",  "Commodore 116 (PAL)", 0)
712COMP( 1984, c116c,   c16,   0,  c16c,   c16,    c16,   "Commodore Business Machines",  "Commodore 116 (PAL, 1551)", 0 )
713COMP( 1984, c116v,   c16,   0,  c16v,   c16,    c16,   "Commodore Business Machines",  "Commodore 116 (PAL, VC1541)", 0 )
722COMP( 1984, c116,     c16,   0,  c16,       c16,       c16,      "Commodore Business Machines",  "Commodore 116 (PAL)", 0)
723COMP( 1984, c116c,    c16,   0,  c16c,      c16,       c16,      "Commodore Business Machines",  "Commodore 116 (PAL, 1551)", 0 )
724COMP( 1984, c116v,    c16,   0,  c16v,      c16,       c16,      "Commodore Business Machines",  "Commodore 116 (PAL, VC1541)", 0 )
714725
715COMP( 1984, plus4,   c16,   0,  plus4,  plus4,  c16,   "Commodore Business Machines",  "Commodore Plus/4 (NTSC)", 0)
716COMP( 1984, plus4c,  c16,   0,  plus4c, plus4,  c16,   "Commodore Business Machines",  "Commodore Plus/4 (NTSC, 1551)", 0 )
717COMP( 1984, plus4v,  c16,   0,  plus4v, plus4,  c16,   "Commodore Business Machines",  "Commodore Plus/4 (NTSC, VC1541)", 0)
726COMP( 1984, plus4,    c16,   0,  plus4,     plus4,     plus4,    "Commodore Business Machines",  "Commodore Plus/4 (NTSC)", 0)
727COMP( 1984, plus4c,   c16,   0,  plus4c,    plus4,     plus4,    "Commodore Business Machines",  "Commodore Plus/4 (NTSC, 1551)", 0 )
728COMP( 1984, plus4v,   c16,   0,  plus4v,    plus4,     plus4,    "Commodore Business Machines",  "Commodore Plus/4 (NTSC, VC1541)", 0)
718729
719COMP( 1984, c232,    c16,   0,  c16,    c16,    c16,   "Commodore Business Machines",  "Commodore 232 (Prototype)", 0)
720COMP( 1984, c264,    c16,   0,  c264,   plus4,  c16,   "Commodore Business Machines",  "Commodore 264 (Prototype)", 0)
721COMP( 1984, c364,    c16,   0,  c364,   plus4,  c16,   "Commodore Business Machines",  "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND)
730COMP( 1984, c232,     c16,   0,  c16,       c16,       c16,      "Commodore Business Machines",  "Commodore 232 (Prototype)", 0)
731COMP( 1984, c264,     c16,   0,  c264,      plus4,     plus4,    "Commodore Business Machines",  "Commodore 264 (Prototype)", 0)
732COMP( 1984, c364,     c16,   0,  c364,      plus4,     plus4,    "Commodore Business Machines",  "Commodore V364 (Prototype)", GAME_IMPERFECT_SOUND)
733
734COMP( 1984, c16sid,   c16,   0,  c16sid,    c16sid,    c16sid,   "Commodore Business Machines",  "Commodore 16 (PAL, SID Card)", GAME_UNOFFICIAL | GAME_IMPERFECT_SOUND)
735COMP( 1984, plus4sid, c16,   0,  plus4sid,  plus4sid,  plus4sid, "Commodore Business Machines",  "Commodore Plus/4 (NTSC, SID Card)", GAME_UNOFFICIAL | GAME_IMPERFECT_SOUND)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team