Previous 15994 Revisions Next

r14268 Monday 30th January, 2012 at 13:13:03 UTC by Curt Coder
Refactored vic6567.c to use devcb. (nw)
[src/mess/drivers]c128.c c64.c cbmb.c
[src/mess/includes]c128.h c64.h cbmb.h
[src/mess/machine]c128.c c64.c c64exp.c c64exp.h cbmb.c
[src/mess/video]vic6567.c vic6567.h

src/mess/machine/cbmb.c
r14267r14268
276276   state->m_colorram[offset] = data | 0xf0;
277277}
278278
279int cbmb_dma_read( running_machine &machine, int offset )
280{
281   cbmb_state *state = machine.driver_data<cbmb_state>();
282   if (offset >= 0x1000)
283      return state->m_videoram[offset & 0x3ff];
284   else
285      return state->m_chargen[offset & 0xfff];
286}
287
288int cbmb_dma_read_color( running_machine &machine, int offset )
289{
290   cbmb_state *state = machine.driver_data<cbmb_state>();
291   return state->m_colorram[offset & 0x3ff];
292}
293
294279WRITE_LINE_DEVICE_HANDLER( cbmb_change_font )
295280{
296281   cbmb_vh_set_font(device->machine(), state);
src/mess/machine/c64.c
r14267r14268
115115   c64_irq (device->machine(), level || state->m_vicirq);
116116}
117117
118void c64_vic_interrupt( running_machine &machine, int level )
118WRITE_LINE_MEMBER( c64_state::c64_vic_interrupt )
119119{
120   c64_state *state = machine.driver_data<c64_state>();
121   device_t *cia_0 = machine.device("cia_0");
120   device_t *cia_0 = machine().device("cia_0");
122121#if 1
123   if (level != state->m_vicirq)
122   if (state != m_vicirq)
124123   {
125      c64_irq(machine, level || mos6526_irq_r(cia_0));
126      state->m_vicirq = level;
124      c64_irq(machine(), state || mos6526_irq_r(cia_0));
125      m_vicirq = state;
127126   }
128127#endif
129128}
src/mess/machine/c128.c
r14267r14268
184184   c128_irq(device->machine(), level || state->m_vicirq);
185185}
186186
187void c128_vic_interrupt( running_machine &machine, int level )
187WRITE_LINE_MEMBER( c128_state::vic_interrupt )
188188{
189   c128_state *state = machine.driver_data<c128_state>();
190   device_t *cia_0 = machine.device("cia_0");
189   device_t *cia_0 = machine().device("cia_0");
191190#if 1
192   if (level != state->m_vicirq)
191   if (state  != m_vicirq)
193192   {
194      c128_irq (machine, level || mos6526_irq_r(cia_0));
195      state->m_vicirq = level;
193      c128_irq (machine(), state || mos6526_irq_r(cia_0));
194      m_vicirq = state;
196195   }
197196#endif
198197}
r14267r14268
10301029 * a15 and a14 portlines
10311030 * 0x1000-0x1fff, 0x9000-0x9fff char rom
10321031 */
1033int c128_dma_read(running_machine &machine, int offset)
1032READ8_MEMBER( c128_state::vic_dma_read )
10341033{
1035   c128_state *state = machine.driver_data<c128_state>();
1036   UINT8 c64_port6510 = m6510_get_port(machine.device<legacy_cpu_device>("m8502"));
1034   UINT8 c64_port6510 = m6510_get_port(machine().device<legacy_cpu_device>("m8502"));
10371035
10381036   /* main memory configuration to include */
1039   if (state->m_c64mode)
1037   if (m_c64mode)
10401038   {
1041      if (!state->m_game && state->m_exrom)
1039      if (!m_game && m_exrom)
10421040      {
10431041         if (offset < 0x3000)
1044            return state->m_memory[offset];
1045         return state->m_romh[offset & 0x1fff];
1042            return m_memory[offset];
1043         return m_romh[offset & 0x1fff];
10461044      }
1047      if (((state->m_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000)
1048         return state->m_chargen[offset & 0xfff];
1049      return state->m_vicaddr[offset];
1045      if (((m_vicaddr - m_memory + offset) & 0x7000) == 0x1000)
1046         return m_chargen[offset & 0xfff];
1047      return m_vicaddr[offset];
10501048   }
1051   if (!(c64_port6510 & 4) && (((state->m_c128_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000))
1052      return state->m_c128_chargen[offset & 0xfff];
1053   return state->m_c128_vicaddr[offset];
1049   if (!(c64_port6510 & 4) && (((m_c128_vicaddr - m_memory + offset) & 0x7000) == 0x1000))
1050      return m_c128_chargen[offset & 0xfff];
1051   return m_c128_vicaddr[offset];
10541052}
10551053
1056int c128_dma_read_color(running_machine &machine, int offset)
1054READ8_MEMBER( c128_state::vic_dma_read_color )
10571055{
1058   c128_state *state = machine.driver_data<c128_state>();
1059   UINT8 c64_port6510 = m6510_get_port(machine.device<legacy_cpu_device>("m8502"));
1056   UINT8 c64_port6510 = m6510_get_port(machine().device<legacy_cpu_device>("m8502"));
10601057
1061   if (state->m_c64mode)
1062      return state->m_colorram[offset & 0x3ff] & 0xf;
1058   if (m_c64mode)
1059      return m_colorram[offset & 0x3ff] & 0xf;
10631060   else
1064      return state->m_colorram[(offset & 0x3ff)|((c64_port6510 & 0x3) << 10)] & 0xf;
1061      return m_colorram[(offset & 0x3ff)|((c64_port6510 & 0x3) << 10)] & 0xf;
10651062}
10661063
10671064/* 2008-09-01
src/mess/machine/c64exp.c
r14267r14268
9090       memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
9191       memset(&m_out_dma_cb, 0, sizeof(m_out_dma_cb));
9292       memset(&m_out_reset_cb, 0, sizeof(m_out_reset_cb));
93       memset(&m_out_game_cb, 0, sizeof(m_out_game_cb));
94       memset(&m_out_exrom_cb, 0, sizeof(m_out_exrom_cb));
9593   }
9694}
9795
r14267r14268
109107   m_out_nmi_func.resolve(m_out_nmi_cb, *this);
110108   m_out_dma_func.resolve(m_out_dma_cb, *this);
111109   m_out_reset_func.resolve(m_out_reset_cb, *this);
112   m_out_game_func.resolve(m_out_game_cb, *this);
113   m_out_exrom_func.resolve(m_out_exrom_cb, *this);
114110}
115111
116112
r14267r14268
342338WRITE_LINE_MEMBER( c64_expansion_slot_device::nmi_w ) { m_out_nmi_func(state); }
343339WRITE_LINE_MEMBER( c64_expansion_slot_device::dma_w ) { m_out_dma_func(state); }
344340WRITE_LINE_MEMBER( c64_expansion_slot_device::reset_w ) { m_out_reset_func(state); }
345WRITE_LINE_MEMBER( c64_expansion_slot_device::game_w ) { m_out_game_func(state); }
346WRITE_LINE_MEMBER( c64_expansion_slot_device::exrom_w ) { m_out_exrom_func(state); }
src/mess/machine/c64exp.h
r14267r14268
4545//  CONSTANTS
4646//**************************************************************************
4747
48#define C64_EXPANSION_SLOT_TAG      "c64exp"
48#define C64_EXPANSION_SLOT_TAG      "exp"
4949
5050
5151
r14267r14268
7676    devcb_write_line   m_out_nmi_cb;
7777    devcb_write_line   m_out_dma_cb;
7878    devcb_write_line   m_out_reset_cb;
79    devcb_write_line   m_out_game_cb;
80    devcb_write_line   m_out_exrom_cb;
8179};
8280
8381
r14267r14268
134132   DECLARE_WRITE_LINE_MEMBER( nmi_w );
135133   DECLARE_WRITE_LINE_MEMBER( dma_w );
136134   DECLARE_WRITE_LINE_MEMBER( reset_w );
137   DECLARE_WRITE_LINE_MEMBER( game_w );
138   DECLARE_WRITE_LINE_MEMBER( exrom_w );
139135
140136   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
141137
r14267r14268
169165   devcb_resolved_write_line   m_out_nmi_func;
170166   devcb_resolved_write_line   m_out_dma_func;
171167   devcb_resolved_write_line   m_out_reset_func;
172   devcb_resolved_write_line   m_out_game_func;
173   devcb_resolved_write_line   m_out_exrom_func;
174168
175169   device_c64_expansion_card_interface *m_cart;
176170};
src/mess/video/vic6567.c
r14267r14268
149149   UINT8 device_suspended;
150150
151151   /* DMA */
152   vic2_dma_read          dma_read;
153   vic2_dma_read_color    dma_read_color;
152   devcb_resolved_read8          in_dma_read_func;
153   devcb_resolved_read8    in_dma_read_color_func;
154154
155155   /* IRQ */
156   vic2_irq               interrupt;
156   devcb_resolved_write_line               out_interrupt_func;
157157
158158   /* RDY */
159   vic2_rdy_callback      rdy_workaround_cb;
159   devcb_resolved_read8      in_rdy_workaround_func;
160160
161161   /* lightpen */
162   vic2_lightpen_button_callback lightpen_button_cb;
163   vic2_lightpen_x_callback lightpen_x_cb;
164   vic2_lightpen_y_callback lightpen_y_cb;
162   devcb_resolved_read8 in_lightpen_button_func;
163   devcb_resolved_read8 in_lightpen_x_func;
164   devcb_resolved_read8 in_lightpen_y_func;
165165};
166166
167167
r14267r14268
193193
194194/* 2008-05 FP: lightpen code needs to read input port from c64.c and cbmb.c */
195195
196#define LIGHTPEN_BUTTON      (vic2->lightpen_button_cb(machine))
197#define LIGHTPEN_X_VALUE   (vic2->lightpen_x_cb(machine))
198#define LIGHTPEN_Y_VALUE   (vic2->lightpen_y_cb(machine))
196#define LIGHTPEN_BUTTON      (vic2->in_lightpen_button_func(0))
197#define LIGHTPEN_X_VALUE   (vic2->in_lightpen_x_func(0))
198#define LIGHTPEN_Y_VALUE   (vic2->in_lightpen_y_func(0))
199199
200200/* lightpen delivers values from internal counters; they do not start with the visual area or frame area */
201201#define VIC2_MAME_XPOS         0
r14267r14268
291291      {
292292         DBG_LOG(2, "vic2", ("irq start %.2x\n", mask));
293293         vic2->reg[0x19] |= 0x80;
294         vic2->interrupt(machine, 1);
294         vic2->out_interrupt_func(1);
295295      }
296296   }
297297   vic2->reg[0x19] |= mask;
r14267r14268
304304   {
305305      DBG_LOG(2, "vic2", ("irq end %.2x\n", mask));
306306      vic2->reg[0x19] &= ~0x80;
307      vic2->interrupt(machine, 0);
307      vic2->out_interrupt_func(0);
308308   }
309309}
310310
r14267r14268
340340// Idle access
341341INLINE void vic2_idle_access( running_machine &machine, vic2_state *vic2 )
342342{
343   vic2->dma_read(machine, 0x3fff);
343   vic2->in_dma_read_func(0x3fff);
344344}
345345
346346// Fetch sprite data pointer
347347INLINE void vic2_spr_ptr_access( running_machine &machine, vic2_state *vic2, int num )
348348{
349   vic2->spr_ptr[num] = vic2->dma_read(machine, SPRITE_ADDR(num)) << 6;
349   vic2->spr_ptr[num] = vic2->in_dma_read_func(SPRITE_ADDR(num)) << 6;
350350}
351351
352352// Fetch sprite data, increment data counter
r14267r14268
354354{
355355   if (vic2->spr_dma_on & (1 << num))
356356   {
357      vic2->spr_data[num][bytenum] = vic2->dma_read(machine, (vic2->mc[num] & 0x3f) | vic2->spr_ptr[num]);
357      vic2->spr_data[num][bytenum] = vic2->in_dma_read_func((vic2->mc[num] & 0x3f) | vic2->spr_ptr[num]);
358358      vic2->mc[num]++;
359359   }
360360   else
r14267r14268
375375   if (vic2->device_suspended == 0)
376376   {
377377      vic2->first_ba_cycle = vic2->cycles_counter;
378      if ((vic2->rdy_workaround_cb != NULL) && (vic2->rdy_workaround_cb(machine) != 7 ))
378      if (vic2->in_rdy_workaround_func(0) != 7 )
379379      {
380380//          device_suspend(machine.firstcpu, SUSPEND_REASON_SPIN, 0);
381381      }
r14267r14268
388388{
389389   if (vic2->device_suspended == 1)
390390   {
391      if ((vic2->rdy_workaround_cb != NULL))
392      {
393//  device_resume(machine.firstcpu, SUSPEND_REASON_SPIN);
394      }
391   //  device_resume(machine.firstcpu, SUSPEND_REASON_SPIN);
395392      vic2->device_suspended = 0;
396393   }
397394}
r14267r14268
399396// Refresh access
400397INLINE void vic2_refresh_access( running_machine &machine, vic2_state *vic2 )
401398{
402   vic2->dma_read(machine, 0x3f00 | vic2->ref_cnt--);
399   vic2->in_dma_read_func(0x3f00 | vic2->ref_cnt--);
403400}
404401
405402
r14267r14268
458455      else
459456      {
460457         UINT16 adr = (vic2->vc & 0x03ff) | VIDEOADDR;
461         vic2->matrix_line[vic2->ml_index] = vic2->dma_read(machine, adr); \
462         vic2->color_line[vic2->ml_index] = vic2->dma_read_color(machine, (adr & 0x03ff)); \
458         vic2->matrix_line[vic2->ml_index] = vic2->in_dma_read_func(adr); \
459         vic2->color_line[vic2->ml_index] = vic2->in_dma_read_color_func((adr & 0x03ff)); \
463460      }
464461   }
465462}
r14267r14268
476473         adr = (vic2->matrix_line[vic2->ml_index] << 3) | vic2->chargenaddr | vic2->rc;
477474      if (ECMON)
478475         adr &= 0xf9ff;
479      vic2->gfx_data = vic2->dma_read(machine, adr);
476      vic2->gfx_data = vic2->in_dma_read_func(adr);
480477      vic2->char_data = vic2->matrix_line[vic2->ml_index];
481478      vic2->color_data = vic2->color_line[vic2->ml_index];
482479      vic2->ml_index++;
r14267r14268
484481   }
485482   else
486483   {
487      vic2->gfx_data = vic2->dma_read(machine, (ECMON ? 0x39ff : 0x3fff));
484      vic2->gfx_data = vic2->in_dma_read_func((ECMON ? 0x39ff : 0x3fff));
488485      vic2->char_data = 0;
489486   }
490487}
r14267r14268
12351232
12361233      vic2->raster_x = 0xfffc;
12371234
1238      if ((vic2->rdy_workaround_cb(machine) == 0 ) && (vic2->is_bad_line))
1235      if ((vic2->in_rdy_workaround_func(0) == 0 ) && (vic2->is_bad_line))
12391236         vic2->rdy_cycles += (43+adjust(0));
12401237
12411238      vic2->cycle++;
r14267r14268
12501247
12511248      vic2->vc = vic2->vc_base;
12521249
1253      if ((vic2->rdy_workaround_cb(machine) == 1 ) && (vic2->is_bad_line))
1250      if ((vic2->in_rdy_workaround_func(0) == 1 ) && (vic2->is_bad_line))
12541251         vic2->rdy_cycles += (42+adjust(0));
12551252
12561253      vic2->cycle++;
r14267r14268
12701267      vic2->ml_index = 0;
12711268      vic2_matrix_access(machine, vic2);
12721269
1273      if ((vic2->rdy_workaround_cb(machine) == 2 ) && (vic2->is_bad_line))
1270      if ((vic2->in_rdy_workaround_func(0) == 2 ) && (vic2->is_bad_line))
12741271         vic2->rdy_cycles += (41+adjust(0));
12751272
12761273      vic2->cycle++;
r14267r14268
12941291
12951292      vic2_matrix_access(machine, vic2);
12961293
1297      if ((vic2->rdy_workaround_cb(machine) == 3 ) && (vic2->is_bad_line))
1294      if ((vic2->in_rdy_workaround_func(0) == 3 ) && (vic2->is_bad_line))
12981295         vic2->rdy_cycles += (40+adjust(0));
12991296
13001297      vic2->cycle++;
r14267r14268
13311328      vic2_fetch_if_bad_line(vic2);
13321329      vic2_matrix_access(machine, vic2);
13331330
1334      if ((vic2->rdy_workaround_cb(machine) == 4 ) && (vic2->is_bad_line))
1331      if ((vic2->in_rdy_workaround_func(0) == 4 ) && (vic2->is_bad_line))
13351332         vic2->rdy_cycles += (40+adjust(0));
13361333
13371334      vic2->cycle++;
r14267r14268
26012598   int width, height;
26022599   int i;
26032600
2601   // resolve callbacks
2602   vic2->in_lightpen_x_func.resolve(intf->in_x_cb, *device);
2603   vic2->in_lightpen_y_func.resolve(intf->in_y_cb, *device);
2604   vic2->in_lightpen_button_func.resolve(intf->in_button_cb, *device);
2605   vic2->in_dma_read_func.resolve(intf->in_dma_read_cb, *device);
2606   vic2->in_dma_read_color_func.resolve(intf->in_dma_read_color_cb, *device);
2607   vic2->out_interrupt_func.resolve(intf->out_irq_cb, *device);
2608   vic2->in_rdy_workaround_func.resolve(intf->in_rdy_cb, *device);
2609
26042610   vic2->cpu = device->machine().device(intf->cpu);
26052611
26062612   vic2->screen = device->machine().device<screen_device>(intf->screen);
r14267r14268
26112617
26122618   vic2->type = intf->type;
26132619
2614   vic2->dma_read = intf->dma_read;
2615   vic2->dma_read_color = intf->dma_read_color;
2616   vic2->interrupt = intf->irq;
2617
2618   vic2->rdy_workaround_cb = intf->rdy_cb;
2619
2620   vic2->lightpen_button_cb = intf->button_cb;
2621   vic2->lightpen_x_cb = intf->x_cb;
2622   vic2->lightpen_y_cb = intf->y_cb;
2623
26242620   // immediately call the timer to handle the first line
26252621   if (vic2->type == VIC6569 || vic2->type == VIC8566)
26262622      device->machine().scheduler().timer_set(downcast<cpu_device *>(vic2->cpu)->cycles_to_attotime(0), FUNC(pal_timer_callback), 0, vic2);
src/mess/video/vic6567.h
r14267r14268
1414    TYPE DEFINITIONS
1515***************************************************************************/
1616
17typedef UINT8 (*vic2_lightpen_x_callback)(running_machine &machine);
18typedef UINT8 (*vic2_lightpen_y_callback)(running_machine &machine);
19typedef UINT8 (*vic2_lightpen_button_callback)(running_machine &machine);
20
21typedef int (*vic2_dma_read)(running_machine &machine, int);
22typedef int (*vic2_dma_read_color)(running_machine &machine, int);
23typedef void (*vic2_irq) (running_machine&, int);
24
25typedef UINT8 (*vic2_rdy_callback)(running_machine &machine);
26
2717typedef enum
2818{
2919   VIC6567,   // VIC II NTSC
r14267r14268
3525typedef struct _vic2_interface vic2_interface;
3626struct _vic2_interface
3727{
38   const char         *screen;
39   const char         *cpu;
28   const char         *screen;
29   const char         *cpu;
4030
4131   vic2_type type;
4232
43   vic2_lightpen_x_callback        x_cb;
44   vic2_lightpen_y_callback        y_cb;
45   vic2_lightpen_button_callback   button_cb;
33   devcb_read8         in_x_cb;
34   devcb_read8         in_y_cb;
35   devcb_read8         in_button_cb;
4636
47   vic2_dma_read          dma_read;
48   vic2_dma_read_color    dma_read_color;
49   vic2_irq               irq;
37   devcb_read8         in_dma_read_cb;
38   devcb_read8          in_dma_read_color_cb;
39   devcb_write_line   out_irq_cb;
5040
51   vic2_rdy_callback        rdy_cb;
41   devcb_read8         in_rdy_cb;
5242};
5343
5444/***************************************************************************
src/mess/includes/cbmb.h
r14267r14268
2626
2727   required_device<ieee488_device> m_ieee;
2828
29   DECLARE_READ8_MEMBER( vic_lightpen_x_cb );
30   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
31   DECLARE_READ8_MEMBER( vic_lightpen_button_cb );
32   DECLARE_READ8_MEMBER( vic_dma_read );
33   DECLARE_READ8_MEMBER( vic_dma_read_color );
34   DECLARE_READ8_MEMBER( vic_rdy_cb );
35
2936   /* keyboard lines */
3037   int m_cbmb_keyline_a;
3138   int m_cbmb_keyline_b;
src/mess/includes/c128.h
r14267r14268
2323   c128_state(const machine_config &mconfig, device_type type, const char *tag)
2424      : c64_state(mconfig, type, tag) { }
2525
26   DECLARE_READ8_MEMBER( vic_lightpen_x_cb );
27   DECLARE_READ8_MEMBER( vic_lightpen_y_cb );
28   DECLARE_READ8_MEMBER( vic_lightpen_button_cb );
29   DECLARE_READ8_MEMBER( vic_dma_read );
30   DECLARE_READ8_MEMBER( vic_dma_read_ultimax );
31   DECLARE_READ8_MEMBER( vic_dma_read_color );
32   DECLARE_WRITE_LINE_MEMBER( vic_interrupt );
33   DECLARE_READ8_MEMBER( vic_rdy_cb );
34
2635   UINT8 *m_c128_basic;
2736   UINT8 *m_c128_kernal;
2837   UINT8 *m_c128_chargen;
src/mess/includes/c64.h
r14267r14268
4343
4444   optional_device<cbm_iec_device> m_iec;
4545
46   DECLARE_READ8_MEMBER( c64_lightpen_x_cb );
47   DECLARE_READ8_MEMBER( c64_lightpen_y_cb );
48   DECLARE_READ8_MEMBER( c64_lightpen_button_cb );
49   DECLARE_READ8_MEMBER( c64_dma_read );
50   DECLARE_READ8_MEMBER( c64_dma_read_ultimax );
51   DECLARE_READ8_MEMBER( c64_dma_read_color );
52   DECLARE_WRITE_LINE_MEMBER( c64_vic_interrupt );
53   DECLARE_READ8_MEMBER( c64_rdy_cb );
54   
4655   int m_old_level;
4756   int m_old_data;
4857   int m_old_exrom;
r14267r14268
109118WRITE8_HANDLER ( c64_write_io );
110119READ8_HANDLER ( c64_read_io );
111120int c64_paddle_read (device_t *device, int which);
112void c64_vic_interrupt (running_machine &machine, int level);
113121
114122extern const mos6526_interface c64_ntsc_cia0, c64_pal_cia0;
115123extern const mos6526_interface c64_ntsc_cia1, c64_pal_cia1;
src/mess/drivers/cbmb.c
r14267r14268
344344   return 0;
345345}
346346
347static UINT8 cbmb_lightpen_x_cb( running_machine &machine )
347READ8_MEMBER( cbmb_state::vic_lightpen_x_cb )
348348{
349   return input_port_read(machine, "LIGHTX") & ~0x01;
349   return input_port_read(machine(), "LIGHTX") & ~0x01;
350350}
351351
352static UINT8 cbmb_lightpen_y_cb( running_machine &machine )
352READ8_MEMBER( cbmb_state::vic_lightpen_y_cb )
353353{
354   return input_port_read(machine, "LIGHTY") & ~0x01;
354   return input_port_read(machine(), "LIGHTY") & ~0x01;
355355}
356356
357static UINT8 cbmb_lightpen_button_cb( running_machine &machine )
357READ8_MEMBER( cbmb_state::vic_lightpen_button_cb )
358358{
359   return input_port_read(machine, "OTHER") & 0x04;
359   return input_port_read(machine(), "OTHER") & 0x04;
360360}
361361
362static UINT8 cbmb_rdy_cb( running_machine &machine )
362READ8_MEMBER( cbmb_state::vic_dma_read )
363363{
364   return input_port_read(machine, "CTRLSEL") & 0x08;
364   if (offset >= 0x1000)
365      return m_videoram[offset & 0x3ff];
366   else
367      return m_chargen[offset & 0xfff];
365368}
366369
370READ8_MEMBER( cbmb_state::vic_dma_read_color )
371{
372   return m_colorram[offset & 0x3ff];
373}
367374
375READ8_MEMBER( cbmb_state::vic_rdy_cb )
376{
377   return input_port_read(machine(), "CTRLSEL") & 0x08;
378}
379
380
368381static const vic2_interface p500_vic2_intf = {
369382   "screen",
370383   "maincpu",
371384   VIC6567,
372   cbmb_lightpen_x_cb,
373   cbmb_lightpen_y_cb,
374   cbmb_lightpen_button_cb,
375   cbmb_dma_read,
376   cbmb_dma_read_color,
377   NULL,
378   cbmb_rdy_cb
385   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_x_cb),
386   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_y_cb),
387   DEVCB_DRIVER_MEMBER(cbmb_state, vic_lightpen_button_cb),
388   DEVCB_DRIVER_MEMBER(cbmb_state, vic_dma_read),
389   DEVCB_DRIVER_MEMBER(cbmb_state, vic_dma_read_color),
390   DEVCB_NULL,
391   DEVCB_DRIVER_MEMBER(cbmb_state, vic_rdy_cb)
379392};
380393
381394/*************************************
src/mess/drivers/c128.c
r14267r14268
679679 *
680680 *************************************/
681681
682static UINT8 c128_lightpen_x_cb( running_machine &machine )
682READ8_MEMBER( c128_state::vic_lightpen_x_cb )
683683{
684   return input_port_read(machine, "LIGHTX") & ~0x01;
684   return input_port_read(machine(), "LIGHTX") & ~0x01;
685685}
686686
687static UINT8 c128_lightpen_y_cb( running_machine &machine )
687READ8_MEMBER( c128_state::vic_lightpen_y_cb )
688688{
689   return input_port_read(machine, "LIGHTY") & ~0x01;
689   return input_port_read(machine(), "LIGHTY") & ~0x01;
690690}
691691
692static UINT8 c128_lightpen_button_cb( running_machine &machine )
692READ8_MEMBER( c128_state::vic_lightpen_button_cb )
693693{
694   return input_port_read(machine, "OTHER") & 0x04;
694   return input_port_read(machine(), "OTHER") & 0x04;
695695}
696696
697static UINT8 c128_rdy_cb( running_machine &machine )
697READ8_MEMBER( c128_state::vic_rdy_cb )
698698{
699   return input_port_read(machine, "CTRLSEL") & 0x08;
699   return input_port_read(machine(), "CTRLSEL") & 0x08;
700700}
701701
702702static const vic2_interface c128_vic2_ntsc_intf = {
703703   "screen",
704704   "maincpu",
705705   VIC8564,
706   c128_lightpen_x_cb,
707   c128_lightpen_y_cb,
708   c128_lightpen_button_cb,
709   c128_dma_read,
710   c128_dma_read_color,
711   c128_vic_interrupt,
712   c128_rdy_cb
706   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb),
707   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb),
708   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb),
709   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read),
710   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color),
711   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt),
712   DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb)
713713};
714714
715715static const vic2_interface c128_vic2_pal_intf = {
716716   "screen",
717717   "maincpu",
718718   VIC8566,
719   c128_lightpen_x_cb,
720   c128_lightpen_y_cb,
721   c128_lightpen_button_cb,
722   c128_dma_read,
723   c128_dma_read_color,
724   c128_vic_interrupt,
725   c128_rdy_cb
719   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_x_cb),
720   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_y_cb),
721   DEVCB_DRIVER_MEMBER(c128_state, vic_lightpen_button_cb),
722   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read),
723   DEVCB_DRIVER_MEMBER(c128_state, vic_dma_read_color),
724   DEVCB_DRIVER_LINE_MEMBER(c128_state, vic_interrupt),
725   DEVCB_DRIVER_MEMBER(c128_state, vic_rdy_cb)
726726};
727727
728728static const vdc8563_interface c128_vdc8563_intf = {
src/mess/drivers/c64.c
r14267r14268
580580   return 0;
581581}
582582
583static UINT8 c64_lightpen_x_cb( running_machine &machine )
583READ8_MEMBER( c64_state::c64_lightpen_x_cb )
584584{
585   return input_port_read(machine, "LIGHTX") & ~0x01;
585   return input_port_read(machine(), "LIGHTX") & ~0x01;
586586}
587587
588static UINT8 c64_lightpen_y_cb( running_machine &machine )
588READ8_MEMBER( c64_state::c64_lightpen_y_cb )
589589{
590   return input_port_read(machine, "LIGHTY") & ~0x01;
590   return input_port_read(machine(), "LIGHTY") & ~0x01;
591591}
592592
593static UINT8 c64_lightpen_button_cb( running_machine &machine )
593READ8_MEMBER( c64_state::c64_lightpen_button_cb )
594594{
595   return input_port_read(machine, "OTHER") & 0x04;
595   return input_port_read(machine(), "OTHER") & 0x04;
596596}
597597
598static int c64_dma_read( running_machine &machine, int offset )
598READ8_MEMBER( c64_state::c64_dma_read )
599599{
600   c64_state *state = machine.driver_data<c64_state>();
601   if (!state->m_game && state->m_exrom)
600   if (!m_game && m_exrom)
602601   {
603602      if (offset < 0x3000)
604         return state->m_memory[offset];
603         return m_memory[offset];
605604
606      return state->m_c64_romh[offset & 0x1fff];
605      return m_c64_romh[offset & 0x1fff];
607606   }
608607
609   if (((state->m_vicaddr - state->m_memory + offset) & 0x7000) == 0x1000)
610      return state->m_chargen[offset & 0xfff];
608   if (((m_vicaddr - m_memory + offset) & 0x7000) == 0x1000)
609      return m_chargen[offset & 0xfff];
611610
612   return state->m_vicaddr[offset];
611   return m_vicaddr[offset];
613612}
614613
615static int c64_dma_read_ultimax( running_machine &machine, int offset )
614READ8_MEMBER( c64_state::c64_dma_read_ultimax )
616615{
617   c64_state *state = machine.driver_data<c64_state>();
618616   if (offset < 0x3000)
619      return state->m_memory[offset];
617      return m_memory[offset];
620618
621   return state->m_c64_romh[offset & 0x1fff];
619   return m_c64_romh[offset & 0x1fff];
622620}
623621
624static int c64_dma_read_color( running_machine &machine, int offset )
622READ8_MEMBER( c64_state::c64_dma_read_color )
625623{
626   c64_state *state = machine.driver_data<c64_state>();
627   return state->m_colorram[offset & 0x3ff] & 0xf;
624   return m_colorram[offset & 0x3ff] & 0xf;
628625}
629626
630static UINT8 c64_rdy_cb( running_machine &machine )
627READ8_MEMBER( c64_state::c64_rdy_cb )
631628{
632   return input_port_read(machine, "CYCLES") & 0x07;
629   return input_port_read(machine(), "CYCLES") & 0x07;
633630}
634631
635632static const vic2_interface c64_vic2_ntsc_intf = {
636633   "screen",
637634   "maincpu",
638635   VIC6567,
639   c64_lightpen_x_cb,
640   c64_lightpen_y_cb,
641   c64_lightpen_button_cb,
642   c64_dma_read,
643   c64_dma_read_color,
644   c64_vic_interrupt,
645   c64_rdy_cb
636   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
637   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
638   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
639   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read),
640   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
641   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
642   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
646643};
647644
648645static const vic2_interface c64_vic2_pal_intf = {
649646   "screen",
650647   "maincpu",
651648   VIC6569,
652   c64_lightpen_x_cb,
653   c64_lightpen_y_cb,
654   c64_lightpen_button_cb,
655   c64_dma_read,
656   c64_dma_read_color,
657   c64_vic_interrupt,
658   c64_rdy_cb
649   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
650   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
651   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
652   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read),
653   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
654   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
655   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
659656};
660657
661658static const vic2_interface ultimax_vic2_intf = {
662659   "screen",
663660   "maincpu",
664661   VIC6567,
665   c64_lightpen_x_cb,
666   c64_lightpen_y_cb,
667   c64_lightpen_button_cb,
668   c64_dma_read_ultimax,
669   c64_dma_read_color,
670   c64_vic_interrupt,
671   c64_rdy_cb
662   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_x_cb),
663   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_y_cb),
664   DEVCB_DRIVER_MEMBER(c64_state, c64_lightpen_button_cb),
665   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_ultimax),
666   DEVCB_DRIVER_MEMBER(c64_state, c64_dma_read_color),
667   DEVCB_DRIVER_LINE_MEMBER(c64_state, c64_vic_interrupt),
668   DEVCB_DRIVER_MEMBER(c64_state, c64_rdy_cb)
672669};
673670
674671static C64_EXPANSION_INTERFACE( c64_expansion_intf )
r14267r14268
676673   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_IRQ0),
677674   DEVCB_CPU_INPUT_LINE("maincpu", INPUT_LINE_NMI),
678675   DEVCB_NULL, // DMA
679   DEVCB_NULL, // RESET
680   DEVCB_NULL, // GAME
681   DEVCB_NULL  // EXROM
676   DEVCB_NULL // RESET
682677};
683678
684679
r14267r14268
10921087COMP(1982, max,      0,    0,    ultimax, c64,     ultimax, "Commodore Business Machines", "Commodore Max Machine", 0)
10931088
10941089COMP(1982, c64,     0,    0,    c64,     c64,     c64,     "Commodore Business Machines", "Commodore 64 (NTSC)", 0)
1095COMP(1982, c64pal,  c64,  0,    c64pal,  c64,     c64pal,  "Commodore Business Machines", "Commodore 64 (PAL)",  0)
1090//COMP(1982, c64pal,  c64,  0,    c64pal,  c64,     c64pal,  "Commodore Business Machines", "Commodore 64 (PAL)",  0)
10961091COMP(1982, c64jpn,  c64,  0,    c64,     c64,     c64,     "Commodore Business Machines", "Commodore 64 (Japan)", 0)
10971092COMP(1982, vic64s,  c64,  0,    c64pal,  vic64s,  c64pal,  "Commodore Business Machines", "VIC 64S", 0)
10981093COMP(1982, c64swe,  c64,  0,    c64pal,  vic64s,  c64pal,  "Commodore Business Machines", "Commodore 64 (Sweden/Finland)", 0)

Previous 15994 Revisions Next


© 1998-2018 The MESS Team