Previous 15994 Revisions Next

r7931 Thursday 29th April, 2010 at 13:01:41 UTC by Curt Coder
[CGC7900] Added overlay cursor/character blink, and joystick/light pen input ports.
[src/emu/drivers]xtal.h
[src/mess/drivers]cgc7900.c
[src/mess/includes]cgc7900.h
[src/mess/video]cgc7900.c

src/emu/drivers/xtal.h
r7930r7931
142142   XTAL_27_2109MHz      = 27210900,      /* LA Girl */
143143   XTAL_28MHz        = 28000000,
144144   XTAL_28_37516MHz   = 28375160,      /* Amiga PAL systems */
145   XTAL_28_48MHz        = 28480000,      /* Chromatics CGC-7900 */
145146   XTAL_28_63636MHz   = 28636360,      /* Later Leland games and Atari GT, Amiga NTSC , Raiden2 h/w */
146147   XTAL_30MHz        = 30000000,      /* Impera Magic Card */
147148   XTAL_30_4761MHz    = 30476100,      /* Taito JC */
src/mess/video/cgc7900.c
r7930r7931
55    PARAMETERS
66***************************************************************************/
77
8#define OVERLAY_CUR      BIT(cell, 31)   /* places a cursor in the cell if SET */
9#define OVERLAY_BLK      BIT(cell, 30)   /* blinks the foreground character in the cell if SET */
10#define OVERLAY_VF      BIT(cell, 28)   /* makes the foreground visible if SET (else transparent) */
11#define OVERLAY_VB      BIT(cell, 27)   /* makes the background visible if SET (else transparent) */
12#define OVERLAY_PL      BIT(cell, 24)   /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */
13#define OVERLAY_BR      BIT(cell, 18)   /* turns on Red in background if SET */
14#define OVERLAY_BG      BIT(cell, 17)   /* turns on Green in background if SET */
15#define OVERLAY_BB      BIT(cell, 16)   /* turns on Blue in background if SET */
16#define OVERLAY_FR      BIT(cell, 10)   /* turns on Red in foreground if SET */
17#define OVERLAY_FG      BIT(cell, 9)   /* turns on Green in foreground if SET */
18#define OVERLAY_FB      BIT(cell, 8)   /* turns on Blue in background if SET */
19#define OVERLAY_DATA   (cell & 0xff)   /* ASCII or Plot Dot character */
8#define OVERLAY_CUR               BIT(cell, 31)   /* places a cursor in the cell if SET */
9#define OVERLAY_BLK               BIT(cell, 30)   /* blinks the foreground character in the cell if SET */
10#define OVERLAY_VF               BIT(cell, 28)   /* makes the foreground visible if SET (else transparent) */
11#define OVERLAY_VB               BIT(cell, 27)   /* makes the background visible if SET (else transparent) */
12#define OVERLAY_PL               BIT(cell, 24)   /* uses bits 0-7 as PLOT DOT descriptor if SET (else ASCII) */
13#define OVERLAY_BR               BIT(cell, 18)   /* turns on Red in background if SET */
14#define OVERLAY_BG               BIT(cell, 17)   /* turns on Green in background if SET */
15#define OVERLAY_BB               BIT(cell, 16)   /* turns on Blue in background if SET */
16#define OVERLAY_FR               BIT(cell, 10)   /* turns on Red in foreground if SET */
17#define OVERLAY_FG               BIT(cell, 9)   /* turns on Green in foreground if SET */
18#define OVERLAY_FB               BIT(cell, 8)   /* turns on Blue in background if SET */
19#define OVERLAY_DATA            (cell & 0xff)   /* ASCII or Plot Dot character */
2020
21#define IMAGE_SELECT            BIT(state->roll_overlay, 13)
22#define OVERLAY_CURSOR_BLINK      BIT(state->roll_overlay, 12)
23#define OVERLAY_CHARACTER_BLINK      BIT(state->roll_overlay, 11)
24
2125/***************************************************************************
2226    READ/WRITE HANDLERS
2327***************************************************************************/
r7930r7931
5357
5458READ16_HANDLER( cgc7900_sync_r )
5559{
56   return 0;
60   /*
61
62      bit      signal      description
63     
64       0      _VERT      vertical retrace (0=vblank)
65       1               interlace (1=first field, 0=second field)
66       2      _HG         horizontal retrace (0=hblank)
67       3      1
68       4      1
69       5      1
70       6      1
71       7      1
72       8      1
73       9      1
74      10      1
75      11      1
76      12      1
77      13      1
78      14      1
79      15      1
80
81   */
82
83   return 0xffff;
5784}
5885
5986/***************************************************************************
r7930r7931
7097
7198   for (int i = 0; i < 256; i++)
7299   {
73      UINT16 addr = i * 4;
100      UINT16 addr = i * 2;
74101      UINT32 data = (state->clut_ram[addr + 1] << 16) | state->clut_ram[addr];
75102      UINT8 b = data & 0xff;
76103      UINT8 g = (data >> 8) & 0xff;
r7930r7931
81108}
82109
83110/*-------------------------------------------------
84    draw_image - draw bitmap image
111    draw_bitmap - draw bitmap image
85112-------------------------------------------------*/
86113
87static void draw_image(running_device *screen, bitmap_t *bitmap)
114static void draw_bitmap(running_device *screen, bitmap_t *bitmap)
88115{
89116}
90117
r7930r7931
113140         {
114141            if (OVERLAY_CUR)
115142            {
116               *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = 7;
143               if (!OVERLAY_CURSOR_BLINK || state->blink)
144               {
145                  *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = 7;
146               }
117147            }
118148            else
119149            {
120               if (BIT(data, x))
150               if (BIT(data, x) && (!OVERLAY_CHARACTER_BLINK || state->blink))
121151               {
122152                  if (OVERLAY_VF) *BITMAP_ADDR16(bitmap, y, (sx * 8) + x) = fg;
123153               }
r7930r7931
132162}
133163
134164/*-------------------------------------------------
165    TIMER_DEVICE_CALLBACK( blink_tick )
166-------------------------------------------------*/
167
168static TIMER_DEVICE_CALLBACK( blink_tick )
169{
170   cgc7900_state *state = (cgc7900_state *)timer->machine->driver_data;
171
172   state->blink = !state->blink;
173}
174
175/*-------------------------------------------------
135176    PALETTE_INIT( cgc7900 )
136177-------------------------------------------------*/
137178
r7930r7931
166207static VIDEO_UPDATE( cgc7900 )
167208{
168209   update_clut(screen->machine);
169   draw_image(screen, bitmap);
210   draw_bitmap(screen, bitmap);
170211   draw_overlay(screen, bitmap);
171212
172213    return 0;
r7930r7931
218259
219260   MDRV_VIDEO_START(cgc7900)
220261    MDRV_VIDEO_UPDATE(cgc7900)
262
263   MDRV_TIMER_ADD_PERIODIC("blink", blink_tick, HZ(XTAL_28_48MHz/7500000))
221264MACHINE_DRIVER_END
src/mess/includes/cgc7900.h
r7930r7931
44#define __CGC7900__
55
66#define M68000_TAG      "uh8"
7#define I8035_TAG      "i8035"
87#define INS8251_0_TAG   "uc10"
98#define INS8251_1_TAG   "uc8"
109#define MM58167_TAG      "uc6"
1110#define AY8910_TAG      "uc4"
11#define K1135A_TAG      "uc11"
12#define I8035_TAG      "i8035"
1213#define SCREEN_TAG      "screen"
1314
1415class cgc7900_state
r7930r7931
3637   UINT16 color_status_fg;
3738   UINT16 color_status_bg;
3839   UINT16 roll_overlay;
40   int blink;
3941};
4042
4143/*----------- defined in video/cgc7900.c -----------*/
src/mess/drivers/cgc7900.c
r7930r7931
1111   TODO:
1212
1313   - does not boot
14   - mirror ROM to 000000
14   - interrupts
15   - vsync interrupt
16   - map ROM to 000000-000007 at boot
1517   - floppy
1618   - bitmap display
1719   - Z mode read/write
1820   - color status write
1921   - bitmap roll
2022   - overlay roll
21   - blinking
2223   - keyboard
2324   - joystick
2425   - light pen
r7930r7931
7778
7879static READ16_HANDLER( keyboard_r )
7980{
81   /*
82
83      bit      description
84     
85       0      key data bit 0
86       1      key data bit 1
87       2      key data bit 2
88       3      key data bit 3
89       4      key data bit 4
90       5      key data bit 5
91       6      key data bit 6
92       7      key data bit 7
93       8      SHIFT key
94       9      CTRL key
95      10      M1 key
96      11      M2 key
97      12     
98      13     
99      14     
100      15     
101
102   */
103
80104   return 0;
81105}
82106
r7930r7931
86110
87111static WRITE16_HANDLER( keyboard_w )
88112{
113   /*
114
115      bit      description
116     
117       0      LED select bit 0
118       1      LED select bit 1
119       2      LED select bit 2
120       3      LED select bit 3
121       4      LED select bit 4
122       5     
123       6     
124       7      LED switch (1=on, 0=off)
125       8     
126       9     
127      10     
128      11     
129      12     
130      13     
131      14     
132      15     
133
134   */
89135}
90136
91137/*-------------------------------------------------
r7930r7931
94140
95141static WRITE16_HANDLER( interrupt_mask_w )
96142{
143   /*
144
145      bit      description
146     
147       0      real time clock
148       1      RS-449 Tx ready
149       2      BINT 2
150       3      RS-232 Tx ready
151       4      disk
152       5      BINT 3
153       6      bezel keys
154       7      keyboard
155       8      RS-449 Rx ready
156       9      light pen
157      10      BINT 4
158      11      joystick
159      12      vertical retrace
160      13      BINT 5
161      14      BINT 1
162      15      RS-232 Rx ready
163
164   */
165
97166   cgc7900_state *state = (cgc7900_state *)space->machine->driver_data;
98167
99168   state->int_mask = data;
100169}
101170
171/*-------------------------------------------------
172    disk_data_r - disk data read
173-------------------------------------------------*/
174
175static READ16_HANDLER( disk_data_r )
176{
177   return 0;
178}
179
180/*-------------------------------------------------
181    disk_data_w - disk data write
182-------------------------------------------------*/
183
184static WRITE16_HANDLER( disk_data_w )
185{
186}
187/*-------------------------------------------------
188    disk_status_r - disk status read
189-------------------------------------------------*/
190
191static READ16_HANDLER( disk_status_r )
192{
193   /*
194
195      bit      signal      description
196     
197       0      _I/O      input/output
198       1      _REQ      request
199       2      _BSY      busy
200       3      C/_D      control/data
201       4      _MSG      message
202       5      _RDY      ready
203       6     
204       7     
205       8     
206       9     
207      10     
208      11     
209      12     
210      13     
211      14     
212      15     
213
214   */
215
216   return 0xffff - 0x04;
217}
218
219/*-------------------------------------------------
220    disk_command_w - disk command write
221-------------------------------------------------*/
222
223static WRITE16_HANDLER( disk_command_w )
224{
225}
226
102227/***************************************************************************
103228    MEMORY MAPS
104229***************************************************************************/
r7930r7931
108233-------------------------------------------------*/
109234
110235static ADDRESS_MAP_START( cgc7900_mem, ADDRESS_SPACE_PROGRAM, 16 )
111//   ADDRESS_MAP_UNMAP_HIGH
236   ADDRESS_MAP_UNMAP_HIGH
112237   AM_RANGE(0x000000, 0x7fffff) AM_RAM AM_BASE(&chrom_ram)
113238   AM_RANGE(0x800000, 0x80ffff) AM_ROM AM_REGION(M68000_TAG, 0)   
114239   AM_RANGE(0xa00000, 0xbfffff) AM_READWRITE(cgc7900_z_mode_r, cgc7900_z_mode_w)
r7930r7931
144269//   AM_RANGE(0xff80c6, 0xff80c7) Joystick X axis
145270//   AM_RANGE(0xff80ca, 0xff80cb) Joystick Y axis
146271//   AM_RANGE(0xff80cc, 0xff80cd) Joystick Z axis
147//   AM_RANGE(0xff8100, 0xff8101) Disk data port
148//   AM_RANGE(0xff8120, 0xff8121) Disk control/status port
149//   AM_RANGE(0xff8141, 0xff8141) Bezel switches
150//   AM_RANGE(0xff8181, 0xff8181) Baud rate generator
272   AM_RANGE(0xff8100, 0xff8101) AM_READWRITE(disk_data_r, disk_data_w)
273   AM_RANGE(0xff8120, 0xff8121) AM_READWRITE(disk_status_r, disk_command_w)
274   AM_RANGE(0xff8140, 0xff8141) AM_READ_PORT("BEZEL")
275//   AM_RANGE(0xff8180, 0xff8181) AM_DEVWRITE8(K1135A_TAG, k1135a_w, 0xff00) Baud rate generator
151276//   AM_RANGE(0xff81c0, 0xff81ff) AM_DEVREADWRITE8(MM58167_TAG, mm58167_r, mm58167_w, 0xff00)
152277   AM_RANGE(0xff8200, 0xff8201) AM_WRITE(interrupt_mask_w)
153278//   AM_RANGE(0xff8240, 0xff8241) Light Pen enable
r7930r7931
192317-------------------------------------------------*/
193318
194319static INPUT_PORTS_START( cgc7900 )
320   PORT_START("BEZEL")
321   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 7")
322   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 8")
323   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 5")
324   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 6")
325   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 3")
326   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 4")
327   PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 1")
328   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYPAD ) PORT_NAME("Bezel 2")
329
330   PORT_START("JOYSTICK_X")
331   PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_X ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50)
332
333   PORT_START("JOYSTICK_Y")
334   PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Y ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50)
335
336   PORT_START("JOYSTICK_Z")
337   PORT_BIT( 0x3ff, 0x200, IPT_AD_STICK_Z ) PORT_MINMAX(0x000, 0x3ff) PORT_SENSITIVITY(100) PORT_KEYDELTA(50)
338
339   PORT_START("LIGHT_PEN_X")
340   PORT_BIT( 0x1ff, 0x100, IPT_LIGHTGUN_X ) PORT_CROSSHAIR(X, 1.0, 0.0, 0) PORT_MINMAX(0, 511) PORT_SENSITIVITY(20) PORT_KEYDELTA(25)
341
342   PORT_START("LIGHT_PEN_Y")
343   PORT_BIT( 0x1ff, 0x0c0, IPT_LIGHTGUN_Y ) PORT_CROSSHAIR(Y, 1.0, 0.0, 0) PORT_MINMAX(0, 383) PORT_SENSITIVITY(20) PORT_KEYDELTA(25)
195344INPUT_PORTS_END
196345
197346/***************************************************************************
r7930r7931
275424   MDRV_DRIVER_DATA(cgc7900_state)
276425
277426   /* basic machine hardware */
278    MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_8MHz)
427    MDRV_CPU_ADD(M68000_TAG, M68000, XTAL_28_48MHz/4)
279428    MDRV_CPU_PROGRAM_MAP(cgc7900_mem)
280429
281   MDRV_CPU_ADD(I8035_TAG, I8035, 1000000)
430/*   MDRV_CPU_ADD(I8035_TAG, I8035, 1000000)
282431    MDRV_CPU_PROGRAM_MAP(keyboard_mem)
283   MDRV_CPU_IO_MAP(keyboard_io)
432   MDRV_CPU_IO_MAP(keyboard_io)*/
284433
285434   MDRV_MACHINE_START(cgc7900)
286435    MDRV_MACHINE_RESET(cgc7900)
r7930r7931
290439
291440   /* sound hardware */
292441   MDRV_SPEAKER_STANDARD_MONO("mono")
293   MDRV_SOUND_ADD(AY8910_TAG, AY8910, 3579545/2)
442   MDRV_SOUND_ADD(AY8910_TAG, AY8910, XTAL_28_48MHz/16)
294443   MDRV_SOUND_CONFIG(ay8910_intf)
295444   MDRV_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
296445

Previous 15994 Revisions Next


© 1998-2018 The MESS Team