Previous 15994 Revisions Next

r2901 Thursday 26th June, 2008 at 19:15:52 UTC by Curt Coder
[CZZ50] Added Chuang Zao Zhe 50/Dina/Personal Arcade driver (SG-1000 mode is not supported yet)
[src/mess]mess.mak messdriv.c
[src/mess/drivers]coleco.c
[src/mess/includes]coleco.h
[src/mess/machine]coleco.c

src/mess/includes/coleco.h
r2900r2901
1/*****************************************************************************
2 *
3 * includes/coleco.h
4 *
5 ****************************************************************************/
6
7#ifndef COLECO_H_
8#define COLECO_H_
9
10
11/*----------- defined in machine/coleco.c -----------*/
12
13extern int JoyStat[2];
14
15int coleco_cart_verify(const UINT8 *buf, size_t size);
16
17 READ8_HANDLER  ( coleco_paddle_r );
18WRITE8_HANDLER ( coleco_paddle_toggle_off );
19WRITE8_HANDLER ( coleco_paddle_toggle_on );
20
21
22/*----------- defined in drivers/coleco.c -----------*/
23
24 READ8_HANDLER ( coleco_video_r );
25WRITE8_HANDLER ( coleco_video_w );
26
27
28#endif /* COLECO_H_ */
src/mess/messdriv.c
r2900r2901
9797   DRIVER( sg1000 )   /* Sega SG-1000 (Japan)                        */
9898   DRIVER( sg1000m2 )   /* Sega SG-1000 Mark II (Japan)                  */
9999   DRIVER( sc3000 )   /* Sega SC-3000 (Japan)                        */
100   DRIVER( sc3000h )   /* Sega SC-3000H (Japan)                     */
100101   DRIVER( sf7000 )   /* Sega SC-3000 w/ SF-7000 (Japan)               */
101102
102103   DRIVER( gamegear )   /* Sega GameGear                           */
src/mess/machine/coleco.c
r2900r2901
1/***************************************************************************
2
3  coleco.c
4
5  Machine file to handle emulation of the Colecovision.
6
7  TODO:
8   - Extra controller support
9***************************************************************************/
10
11#include "driver.h"
12#include "video/tms9928a.h"
13#include "includes/coleco.h"
14#include "devices/cartslot.h"
15
16
17static int JoyMode=0;
18int JoyStat[2];
19
20int coleco_cart_verify(const UINT8 *cartdata, size_t size)
21{
22   int retval = IMAGE_VERIFY_FAIL;
23
24   /* Verify the file is in Colecovision format */
25   if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */
26      retval = IMAGE_VERIFY_PASS;
27   if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */
28      retval = IMAGE_VERIFY_PASS;
29
30   return retval;
31}
32
33READ8_HANDLER ( coleco_paddle_r )
34{
35   /* Player 1 */
36   if ((offset & 0x02)==0)
37   {
38      /* Keypad and fire 1 (SAC Yellow Button) */
39      if (JoyMode==0)
40      {
41         int inport0,inport1,inport6,data;
42
43         inport0 = input_port_read(machine, "IN0");
44         inport1 = input_port_read(machine, "IN1");
45         inport6 = input_port_read(machine, "IN6");
46
47         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
48         than one, a real ColecoVision think that it is a third button, so we are going to emulate
49         the right behaviour */
50
51         data = 0x0F;   /* No key pressed by default */
52         if (!(inport6&0x01)) /* If Driving Controller enabled -> no keypad 1*/
53         {
54             if (!(inport0 & 0x01)) data &= 0x0A; /* 0 */
55             if (!(inport0 & 0x02)) data &= 0x0D; /* 1 */
56             if (!(inport0 & 0x04)) data &= 0x07; /* 2 */
57             if (!(inport0 & 0x08)) data &= 0x0C; /* 3 */
58             if (!(inport0 & 0x10)) data &= 0x02; /* 4 */
59             if (!(inport0 & 0x20)) data &= 0x03; /* 5 */
60             if (!(inport0 & 0x40)) data &= 0x0E; /* 6 */
61             if (!(inport0 & 0x80)) data &= 0x05; /* 7 */
62             if (!(inport1 & 0x01)) data &= 0x01; /* 8 */
63             if (!(inport1 & 0x02)) data &= 0x0B; /* 9 */
64             if (!(inport1 & 0x04)) data &= 0x06; /* # */
65             if (!(inport1 & 0x08)) data &= 0x09; /* . */
66         }
67         return (inport1 & 0x70) | (data);
68      }
69      /* Joystick and fire 2 (SAC Red Button) */
70      else
71      {
72         int data = input_port_read(machine, "IN2") & 0xCF;
73         int inport6 = input_port_read(machine, "IN6");
74
75         if (inport6&0x07) /* If Extra Contollers enabled */
76         {
77             if (JoyStat[0]==0) data|=0x30; /* Spinner Move Left*/
78             else if (JoyStat[0]==1) data|=0x20; /* Spinner Move Right */
79         }
80         return data | 0x80;
81      }
82   }
83   /* Player 2 */
84   else
85   {
86      /* Keypad and fire 1 */
87      if (JoyMode==0)
88      {
89         int inport3,inport4,data;
90
91         inport3 = input_port_read(machine, "IN3");
92         inport4 = input_port_read(machine, "IN4");
93
94         /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
95         than one, a real ColecoVision think that it is a third button, so we are going to emulate
96         the right behaviour */
97
98         data = 0x0F;   /* No key pressed by default */
99         if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */
100         if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */
101         if (!(inport3 & 0x04)) data &= 0x07; /* 2 */
102         if (!(inport3 & 0x08)) data &= 0x0C; /* 3 */
103         if (!(inport3 & 0x10)) data &= 0x02; /* 4 */
104         if (!(inport3 & 0x20)) data &= 0x03; /* 5 */
105         if (!(inport3 & 0x40)) data &= 0x0E; /* 6 */
106         if (!(inport3 & 0x80)) data &= 0x05; /* 7 */
107         if (!(inport4 & 0x01)) data &= 0x01; /* 8 */
108         if (!(inport4 & 0x02)) data &= 0x0B; /* 9 */
109         if (!(inport4 & 0x04)) data &= 0x06; /* # */
110         if (!(inport4 & 0x08)) data &= 0x09; /* . */
111
112         return (inport4 & 0x70) | (data);
113      }
114      /* Joystick and fire 2*/
115      else
116      {
117         int data = input_port_read(machine, "IN5") & 0xCF;
118         int inport6 = input_port_read(machine, "IN6");
119
120         if (inport6&0x02) /* If Roller Controller enabled */
121         {
122             if (JoyStat[1]==0) data|=0x30;
123             else if (JoyStat[1]==1) data|=0x20;
124         }
125
126         return data | 0x80;
127      }
128   }
129
130}
131
132
133WRITE8_HANDLER ( coleco_paddle_toggle_off )
134{
135   JoyMode=0;
136    return;
137}
138
139WRITE8_HANDLER ( coleco_paddle_toggle_on )
140{
141   JoyMode=1;
142    return;
143}
144
src/mess/mess.mak
r2900r2901
514514   $(EMU_MACHINE)/pd4990a.o      \
515515
516516$(MESSOBJ)/coleco.a:   \
517   $(MESS_MACHINE)/coleco.o   \
518517   $(MESS_DRIVERS)/coleco.o   \
519518   $(MESS_MACHINE)/adam.o      \
520519   $(MESS_DRIVERS)/adam.o      \
src/mess/drivers/coleco.c
r2900r2901
5454
5555***************************************************************************/
5656
57/*
58
59   TODO:
60
61   - Dina SG-1000 mode
62
63*/
64
5765#include "driver.h"
5866#include "sound/sn76496.h"
5967#include "video/tms9928a.h"
60#include "includes/coleco.h"
6168#include "devices/cartslot.h"
6269
63READ8_HANDLER(coleco_video_r)
70static int joy_mode;
71static int joy_status[2];
72
73/* Read/Write Handlers */
74
75static READ8_HANDLER( paddle_1_r )
6476{
65    return ((offset & 0x01) ? TMS9928A_register_r(machine, 1) : TMS9928A_vram_r(machine, 0));
77   UINT8 inport6 = input_port_read_safe(machine, "IN6", 0);
78
79   /* Keypad and fire 1 (SAC Yellow Button) */
80   if (joy_mode==0)
81   {
82      UINT8 inport0 = input_port_read(machine, "IN0");
83      UINT8 inport1 = input_port_read(machine, "IN1");
84
85      /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
86      than one, a real ColecoVision think that it is a third button, so we are going to emulate
87      the right behaviour */
88
89      UINT8 data = 0x0F;   /* No key pressed by default */
90
91      if (!(inport6 & 0x01)) /* If Driving Controller enabled -> no keypad 1*/
92      {
93          if (!(inport0 & 0x01)) data &= 0x0A; /* 0 */
94          if (!(inport0 & 0x02)) data &= 0x0D; /* 1 */
95          if (!(inport0 & 0x04)) data &= 0x07; /* 2 */
96          if (!(inport0 & 0x08)) data &= 0x0C; /* 3 */
97          if (!(inport0 & 0x10)) data &= 0x02; /* 4 */
98          if (!(inport0 & 0x20)) data &= 0x03; /* 5 */
99          if (!(inport0 & 0x40)) data &= 0x0E; /* 6 */
100          if (!(inport0 & 0x80)) data &= 0x05; /* 7 */
101          if (!(inport1 & 0x01)) data &= 0x01; /* 8 */
102          if (!(inport1 & 0x02)) data &= 0x0B; /* 9 */
103          if (!(inport1 & 0x04)) data &= 0x06; /* # */
104          if (!(inport1 & 0x08)) data &= 0x09; /* . */
105      }
106      return (inport1 & 0x70) | (data);
107   }
108   /* Joystick and fire 2 (SAC Red Button) */
109   else
110   {
111      UINT8 data = input_port_read(machine, "IN2") & 0xCF;
112
113      if (inport6 & 0x07) /* If Extra Contollers enabled */
114      {
115          if (joy_status[0] == 0) data |= 0x30; /* Spinner Move Left*/
116          else if (joy_status[0] == 1) data |= 0x20; /* Spinner Move Right */
117      }
118
119      return data | 0x80;
120   }
66121}
67122
68WRITE8_HANDLER(coleco_video_w)
123static READ8_HANDLER( paddle_2_r )
69124{
70    (offset & 0x01) ? TMS9928A_register_w(machine, 1, data) : TMS9928A_vram_w(machine, 0, data);
125   /* Keypad and fire 1 */
126   if (joy_mode == 0)
127   {
128      UINT8 inport3 = input_port_read(machine, "IN3");
129      UINT8 inport4 = input_port_read(machine, "IN4");
130
131      /* Numeric pad buttons are not independent on a real ColecoVision, if you push more
132      than one, a real ColecoVision think that it is a third button, so we are going to emulate
133      the right behaviour */
134
135      UINT8 data = 0x0F;   /* No key pressed by default */
136
137      if (!(inport3 & 0x01)) data &= 0x0A; /* 0 */
138      if (!(inport3 & 0x02)) data &= 0x0D; /* 1 */
139      if (!(inport3 & 0x04)) data &= 0x07; /* 2 */
140      if (!(inport3 & 0x08)) data &= 0x0C; /* 3 */
141      if (!(inport3 & 0x10)) data &= 0x02; /* 4 */
142      if (!(inport3 & 0x20)) data &= 0x03; /* 5 */
143      if (!(inport3 & 0x40)) data &= 0x0E; /* 6 */
144      if (!(inport3 & 0x80)) data &= 0x05; /* 7 */
145      if (!(inport4 & 0x01)) data &= 0x01; /* 8 */
146      if (!(inport4 & 0x02)) data &= 0x0B; /* 9 */
147      if (!(inport4 & 0x04)) data &= 0x06; /* # */
148      if (!(inport4 & 0x08)) data &= 0x09; /* . */
149
150      return (inport4 & 0x70) | (data);
151   }
152   /* Joystick and fire 2*/
153   else
154   {
155      UINT8 data = input_port_read(machine, "IN5") & 0xCF;
156      UINT8 inport6 = input_port_read_safe(machine, "IN6", 0);
157
158      if (inport6 & 0x02) /* If Roller Controller enabled */
159      {
160          if (joy_status[1] == 0) data |= 0x30;
161          else if (joy_status[1] == 1) data |= 0x20;
162      }
163
164      return data | 0x80;
165   }
71166}
72167
168static WRITE8_HANDLER( paddle_off_w )
169{
170   joy_mode = 0;
171}
172
173static WRITE8_HANDLER( paddle_on_w )
174{
175   joy_mode = 1;
176}
177
178/* Memory Maps */
179
73180static ADDRESS_MAP_START( coleco_map, ADDRESS_SPACE_PROGRAM, 8 )
74181   AM_RANGE(0x0000, 0x1fff) AM_ROM
75   AM_RANGE(0x2000, 0x5fff) AM_NOP
76182   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00)
77183   AM_RANGE(0x8000, 0xffff) AM_ROM
78184ADDRESS_MAP_END
79185
80186static ADDRESS_MAP_START( coleco_io_map, ADDRESS_SPACE_IO, 8 )
81187   ADDRESS_MAP_GLOBAL_MASK(0xff)
82   AM_RANGE(0x80, 0x9f) AM_WRITE(coleco_paddle_toggle_off)
83   AM_RANGE(0xa0, 0xbf) AM_READWRITE(coleco_video_r, coleco_video_w)
84   AM_RANGE(0xc0, 0xdf) AM_WRITE(coleco_paddle_toggle_on)
85   AM_RANGE(0xe0, 0xff) AM_READWRITE(coleco_paddle_r, SN76496_0_w)
188   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w)
189   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
190   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
191   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w)
192   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_WRITE(SN76496_0_w)
193   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r)
194   AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x1d) AM_READ(paddle_2_r)
86195ADDRESS_MAP_END
87196
197static ADDRESS_MAP_START( czz50_map, ADDRESS_SPACE_PROGRAM, 8 )
198   AM_RANGE(0x0000, 0x3fff) AM_ROM
199   AM_RANGE(0x6000, 0x63ff) AM_RAM AM_MIRROR(0x1c00)
200   AM_RANGE(0x8000, 0xffff) AM_ROM
201ADDRESS_MAP_END
202
203static ADDRESS_MAP_START( czz50_io_map, ADDRESS_SPACE_IO, 8 )
204   ADDRESS_MAP_GLOBAL_MASK(0xff)
205   AM_RANGE(0x80, 0x80) AM_MIRROR(0x1f) AM_WRITE(paddle_off_w)
206   AM_RANGE(0xa0, 0xa0) AM_MIRROR(0x1e) AM_READWRITE(TMS9928A_vram_r, TMS9928A_vram_w)
207   AM_RANGE(0xa1, 0xa1) AM_MIRROR(0x1e) AM_READWRITE(TMS9928A_register_r, TMS9928A_register_w)
208   AM_RANGE(0xc0, 0xc0) AM_MIRROR(0x1f) AM_WRITE(paddle_on_w)
209   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1f) AM_WRITE(SN76496_0_w)
210   AM_RANGE(0xe0, 0xe0) AM_MIRROR(0x1d) AM_READ(paddle_1_r)
211   AM_RANGE(0xe2, 0xe2) AM_MIRROR(0x1d) AM_READ(paddle_2_r)
212ADDRESS_MAP_END
213
214/* Input Ports */
215
88216static INPUT_PORTS_START( coleco )
89217    PORT_START_TAG("IN0")
90218    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0 (pad 1)") PORT_CODE(KEYCODE_0)
r2900r2901
156284    PORT_BIT( 0x0f, 0x00, IPT_TRACKBALL_Y ) PORT_SENSITIVITY(20) PORT_KEYDELTA(10) PORT_CODE_DEC(KEYCODE_I) PORT_CODE_INC(KEYCODE_K) PORT_RESET PORT_PLAYER(2)
157285INPUT_PORTS_END
158286
287static INPUT_PORTS_START( czz50 )
288    PORT_START_TAG("IN0")
289    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("0") PORT_CODE(KEYCODE_0) PORT_CHAR('0')
290    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
291    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("2") PORT_CODE(KEYCODE_2) PORT_CHAR('2')
292    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("3") PORT_CODE(KEYCODE_3) PORT_CHAR('3')
293    PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("4") PORT_CODE(KEYCODE_4) PORT_CHAR('4')
294    PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("5") PORT_CODE(KEYCODE_5) PORT_CHAR('5')
295    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("6") PORT_CODE(KEYCODE_6) PORT_CHAR('6')
296    PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("7") PORT_CODE(KEYCODE_7) PORT_CHAR('7')
159297
298    PORT_START_TAG("IN1")
299    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("8") PORT_CODE(KEYCODE_8) PORT_CHAR('8')
300    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("9") PORT_CODE(KEYCODE_9) PORT_CHAR('9')
301   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("#") PORT_CODE(KEYCODE_MINUS) PORT_CHAR('#')
302    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME(".") PORT_CODE(KEYCODE_EQUALS) PORT_CHAR('.')
303    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )      PORT_PLAYER(1)
304    PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN )
160305
306    PORT_START_TAG("IN2")
307    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(1)
308    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(1)
309    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(1)
310    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(1)
311    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )      PORT_PLAYER(1)
312    PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN )
313
314    PORT_START_TAG("IN3")
315    PORT_BIT( 0xff, IP_ACTIVE_LOW, IPT_UNUSED )
316
317    PORT_START_TAG("IN4")
318    PORT_BIT( 0x0f, IP_ACTIVE_LOW, IPT_UNUSED )
319    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON2 )      PORT_PLAYER(2)
320    PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN )
321
322    PORT_START_TAG("IN5")
323    PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )   PORT_PLAYER(2)
324    PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT )   PORT_PLAYER(2)
325    PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )   PORT_PLAYER(2)
326    PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )   PORT_PLAYER(2)
327    PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_BUTTON1 )      PORT_PLAYER(2)
328    PORT_BIT( 0xb0, IP_ACTIVE_LOW, IPT_UNKNOWN )
329INPUT_PORTS_END
330
161331/***************************************************************************
162332
163333  The interrupts come from the vdp. The vdp (tms9928a) interrupt can go up
r2900r2901
177347    TMS9928A_interrupt(machine);
178348}
179349
180static void coleco_vdp_interrupt (running_machine *machine, int state)
350static void coleco_vdp_interrupt(running_machine *machine, int state)
181351{
182352   static int last_state = 0;
183353
r2900r2901
186356   last_state = state;
187357}
188358
189static TIMER_CALLBACK(paddle_callback)
359static TIMER_CALLBACK( paddle_callback )
190360{
191    int port7 = input_port_read(machine, "IN7");
192    int port8 = input_port_read(machine, "IN8");
361    int port7 = input_port_read_safe(machine, "IN7", 0);
362    int port8 = input_port_read_safe(machine, "IN8", 0);
193363
194364    if (port7 == 0)
195      JoyStat[0] = 0;
365      joy_status[0] = 0;
196366    else if (port7 & 0x08)
197      JoyStat[0] = -1;
367      joy_status[0] = -1;
198368    else
199      JoyStat[0] = 1;
369      joy_status[0] = 1;
200370
201371    if (port8 == 0)
202      JoyStat[1] = 0;
372      joy_status[1] = 0;
203373    else if (port8 & 0x08)
204      JoyStat[1] = -1;
374      joy_status[1] = -1;
205375    else
206      JoyStat[1] = 1;
376      joy_status[1] = 1;
207377
208    if (JoyStat[0] || JoyStat[1])
209      cpunum_set_input_line(machine, 0, 0, HOLD_LINE);
378    if (joy_status[0] || joy_status[1])
379      cpunum_set_input_line(machine, 0, INPUT_LINE_IRQ0, HOLD_LINE);
210380}
211381
382/* Machine Initialization */
383
212384static const TMS9928a_interface tms9928a_interface =
213385{
214386   TMS99x8A,
r2900r2901
222394   TMS9928A_configure(&tms9928a_interface);
223395}
224396
225static MACHINE_RESET(coleco)
397static MACHINE_RESET( coleco )
226398{
227    cpunum_set_input_line_vector(0, 0, 0xff);
399    cpunum_set_input_line_vector(0, INPUT_LINE_IRQ0, 0xff);
228400   memset(&memory_region(REGION_CPU1)[0x6000], 0xff, 0x400);   // initialize RAM
229401    timer_pulse(ATTOTIME_IN_MSEC(20), NULL, 0, paddle_callback);
230402}
231403
404/* Machine Drivers */
405
232406static MACHINE_DRIVER_START( coleco )
233407   // basic machine hardware
234   MDRV_CPU_ADD(Z80, 7159090/2)   // 3.579545 MHz
408   MDRV_CPU_ADD(Z80, XTAL_7_15909MHz/2)   // 3.579545 MHz
235409   MDRV_CPU_PROGRAM_MAP(coleco_map, 0)
236410   MDRV_CPU_IO_MAP(coleco_io_map, 0)
237411   MDRV_CPU_VBLANK_INT("main", coleco_interrupt)
r2900r2901
242416    // video hardware
243417   MDRV_IMPORT_FROM(tms9928a)
244418   MDRV_SCREEN_MODIFY("main")
245   MDRV_SCREEN_REFRESH_RATE(60)
419   MDRV_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
246420   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
247421
248422   // sound hardware
249423   MDRV_SPEAKER_STANDARD_MONO("mono")
250   MDRV_SOUND_ADD(SN76489A, 7159090/2)   /* 3.579545 MHz */
424   MDRV_SOUND_ADD(SN76489A, XTAL_7_15909MHz/2)   /* 3.579545 MHz */
251425   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
252426MACHINE_DRIVER_END
253427
428static MACHINE_DRIVER_START( czz50 )
429   // basic machine hardware
430   MDRV_CPU_ADD(Z80, XTAL_7_15909MHz/2)   // ???
431   MDRV_CPU_PROGRAM_MAP(czz50_map, 0)
432   MDRV_CPU_IO_MAP(czz50_io_map, 0)
433   MDRV_CPU_VBLANK_INT("main", coleco_interrupt)
434
435   MDRV_MACHINE_START(coleco)
436   MDRV_MACHINE_RESET(coleco)
437
438    // video hardware
439   MDRV_IMPORT_FROM(tms9928a)
440   MDRV_SCREEN_MODIFY("main")
441   MDRV_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/262)
442   MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */
443
444   // sound hardware
445   MDRV_SPEAKER_STANDARD_MONO("mono")
446   MDRV_SOUND_ADD(SN76489A, XTAL_7_15909MHz/2)   // ???
447   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
448MACHINE_DRIVER_END
449
450static MACHINE_DRIVER_START( dina )
451   MDRV_IMPORT_FROM(czz50)
452   MDRV_SCREEN_MODIFY("main")
453   MDRV_SCREEN_REFRESH_RATE((float)XTAL_10_738635MHz/2/342/313)
454MACHINE_DRIVER_END
455
456/* ROMs */
457
254458ROM_START (coleco)
255459    ROM_REGION( 0x10000, REGION_CPU1, 0 )
256460    ROM_LOAD( "coleco.rom", 0x0000, 0x2000, CRC(3aa93ef3) SHA1(45bedc4cbdeac66c7df59e9e599195c778d86a92) )
r2900r2901
270474   ROM_CART_LOAD(0, "rom,col,bin", 0x8000, 0x8000, ROM_NOMIRROR | ROM_OPTIONAL)
271475ROM_END
272476
477ROM_START( czz50 )
478    ROM_REGION( 0x10000, REGION_CPU1, 0 )
479    ROM_LOAD( "czz50.rom", 0x0000, 0x2000, CRC(4999abc6) SHA1(96aecec3712c94517103d894405bc98a7dafa440) )
480    ROM_CONTINUE(        0x8000, 0x2000 )
481ROM_END
482
483#define rom_dina rom_czz50
484#define rom_prsarcde rom_czz50
485
486/* System Configuration */
487
488static int coleco_cart_verify(const UINT8 *cartdata, size_t size)
489{
490   int retval = IMAGE_VERIFY_FAIL;
491
492   /* Verify the file is in Colecovision format */
493   if ((cartdata[0] == 0xAA) && (cartdata[1] == 0x55)) /* Production Cartridge */
494      retval = IMAGE_VERIFY_PASS;
495   if ((cartdata[0] == 0x55) && (cartdata[1] == 0xAA)) /* "Test" Cartridge. Some games use this method to skip ColecoVision title screen and delay */
496      retval = IMAGE_VERIFY_PASS;
497
498   return retval;
499}
500
273501static void coleco_cartslot_getinfo(const mess_device_class *devclass, UINT32 state, union devinfo *info)
274502{
275503   /* cartslot */
276504   switch(state)
277505   {
278506      /* --- the following bits of info are returned as pointers to data or functions --- */
279      case MESS_DEVINFO_PTR_VERIFY:                  info->imgverify = coleco_cart_verify; break;
507      case MESS_DEVINFO_PTR_VERIFY:               info->imgverify = coleco_cart_verify; break;
280508
281509      default:                              cartslot_device_getinfo(devclass, state, info); break;
282510   }
283511}
284512
285static SYSTEM_CONFIG_START(coleco)
513static SYSTEM_CONFIG_START( coleco )
286514   CONFIG_DEVICE(coleco_cartslot_getinfo)
287515SYSTEM_CONFIG_END
288516
289//    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG  COMPANY   FULLNAME
290CONS( 1982, coleco,   0,      0,   coleco,   coleco,   0,      coleco,   "Coleco", "ColecoVision" , 0)
291CONS( 1982, colecoa,  coleco,   0,      coleco,   coleco,   0,      coleco,   "Coleco", "ColecoVision (Thick Characters)" , 0)
292CONS( 1983, colecob,  coleco,   0,      coleco,   coleco,   0,      coleco,   "Spectravideo", "SVI-603 Coleco Game Adapter" , 0)
517static DEVICE_IMAGE_LOAD( czz50_cart )
518{
519   int size = image_length(image);
520   UINT8 *ptr = memory_region(REGION_CPU1) + 0x8000;
521
522   if (image_fread(image, ptr, size ) != size)
523   {
524      return INIT_FAIL;
525   }
526
527   return INIT_PASS;
528}
529
530static void czz50_cartslot_getinfo( const mess_device_class *devclass, UINT32 state, union devinfo *info )
531{
532   switch( state )
533   {
534      case MESS_DEVINFO_INT_COUNT:               info->i = 1; break;
535      case MESS_DEVINFO_PTR_LOAD:                  info->load = DEVICE_IMAGE_LOAD_NAME(czz50_cart); break;
536      case MESS_DEVINFO_STR_FILE_EXTENSIONS:         strcpy(info->s = device_temp_str(), "rom,col,bin"); break;
537
538      default:                              cartslot_device_getinfo( devclass, state, info ); break;
539   }
540}
541
542static SYSTEM_CONFIG_START( czz50 )
543   CONFIG_DEVICE(czz50_cartslot_getinfo)
544SYSTEM_CONFIG_END
545
546/* System Drivers */
547
548//    YEAR  NAME      PARENT    COMPAT  MACHINE   INPUT     INIT    CONFIG  COMPANY            FULLNAME                     FLAGS
549CONS( 1982, coleco,   0,      0,      coleco,   coleco,   0,      coleco,   "Coleco",         "ColecoVision",                  0 )
550CONS( 1982, colecoa,  coleco,   0,      coleco,   coleco,   0,      coleco,   "Coleco",         "ColecoVision (Thick Characters)",   0 )
551CONS( 1983, colecob,  coleco,   0,      coleco,   coleco,   0,      coleco,   "Spectravideo",      "SVI-603 Coleco Game Adapter",      0 )
552CONS( 1986, czz50,     0,      0,      czz50,     czz50,   0,      czz50,   "Bit Corporation",   "Chuang Zao Zhe 50",            0 )
553CONS( 1988, dina,     czz50,   0,      dina,     czz50,   0,      czz50,   "Telegames",      "Dina",                        0 )
554CONS( 1988, prsarcde, czz50,   0,      czz50,     czz50,   0,      czz50,   "Telegames",      "Personal Arcade",               0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team