Previous 199869 Revisions Next

r21065 Thursday 14th February, 2013 at 13:34:16 UTC by Miodrag Milanović
some more cleanup (nw)
[src/mame/drivers]itech8.c matmania.c mquake.c
[src/mame/includes]amiga.h itech8.h matmania.h
[src/mame/machine]maniach.c slikshot.c

trunk/src/mame/machine/slikshot.c
r21064r21065
170170 *
171171 *************************************/
172172
173static void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
173void itech8_state::inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
174174                     UINT8 *xres, UINT8 *vxres, UINT8 *vyres)
175175{
176176   UINT32 _27d8, _27c2;
r21064r21065
243243 *
244244 *************************************/
245245
246static void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
246void itech8_state::vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
247247                     UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams)
248248{
249249   UINT32 _27d8;
r21064r21065
296296 *
297297 *************************************/
298298
299static void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
299void itech8_state::inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
300300                     UINT16 *word1, UINT16 *word2, UINT16 *word3)
301301{
302302   UINT16 word2mod;
r21064r21065
358358 *
359359 *************************************/
360360
361static void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
361void itech8_state::words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
362362                     UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3)
363363{
364364   /* if bit 0 of the beams is set, sensor 1 fired first; otherwise sensor 0 fired */
r21064r21065
382382 *
383383 *************************************/
384384
385static void compute_sensors(running_machine &machine)
386{
387   itech8_state *state = machine.driver_data<itech8_state>();
385void itech8_state::compute_sensors()
386{   
388387   UINT16 inter1, inter2, inter3;
389388   UINT16 word1 = 0, word2 = 0, word3 = 0;
390389   UINT8 beams;
391390
392391   /* skip if we're not ready */
393   if (state->m_sensor0 != 0 || state->m_sensor1 != 0 || state->m_sensor2 != 0 || state->m_sensor3 != 0)
392   if (m_sensor0 != 0 || m_sensor1 != 0 || m_sensor2 != 0 || m_sensor3 != 0)
394393      return;
395394
396395   /* reverse map the inputs */
397   vels_to_inters(state->m_curx, state->m_curvx, state->m_curvy, &inter1, &inter2, &inter3, &beams);
396   vels_to_inters(m_curx, m_curvx, m_curvy, &inter1, &inter2, &inter3, &beams);
398397   inters_to_words(inter1, inter2, inter3, &beams, &word1, &word2, &word3);
399   words_to_sensors(word1, word2, word3, beams, &state->m_sensor0, &state->m_sensor1, &state->m_sensor2, &state->m_sensor3);
398   words_to_sensors(word1, word2, word3, beams, &m_sensor0, &m_sensor1, &m_sensor2, &m_sensor3);
400399
401   logerror("%15f: Sensor values: %04x %04x %04x %04x\n", machine.time().as_double(), state->m_sensor0, state->m_sensor1, state->m_sensor2, state->m_sensor3);
400   logerror("%15f: Sensor values: %04x %04x %04x %04x\n", machine().time().as_double(), m_sensor0, m_sensor1, m_sensor2, m_sensor3);
402401}
403402
404403
r21064r21065
409408 *
410409 *************************************/
411410
412READ8_HANDLER( slikz80_port_r )
411READ8_MEMBER(itech8_state::slikz80_port_r )
413412{
414   itech8_state *state = space.machine().driver_data<itech8_state>();
415413   int result = 0;
416414
417415   /* if we have nothing, return 0x03 */
418   if (!state->m_sensor0 && !state->m_sensor1 && !state->m_sensor2 && !state->m_sensor3)
419      return 0x03 | (state->m_z80_clear_to_send << 7);
416   if (!m_sensor0 && !m_sensor1 && !m_sensor2 && !m_sensor3)
417      return 0x03 | (m_z80_clear_to_send << 7);
420418
421419   /* 1 bit for each sensor */
422   if (state->m_sensor0)
423      result |= 1, state->m_sensor0--;
424   if (state->m_sensor1)
425      result |= 2, state->m_sensor1--;
426   if (state->m_sensor2)
427      result |= 4, state->m_sensor2--;
428   if (state->m_sensor3)
429      result |= 8, state->m_sensor3--;
430   result |= state->m_z80_clear_to_send << 7;
420   if (m_sensor0)
421      result |= 1, m_sensor0--;
422   if (m_sensor1)
423      result |= 2, m_sensor1--;
424   if (m_sensor2)
425      result |= 4, m_sensor2--;
426   if (m_sensor3)
427      result |= 8, m_sensor3--;
428   result |= m_z80_clear_to_send << 7;
431429
432430   return result;
433431}
r21064r21065
440438 *
441439 *************************************/
442440
443WRITE8_HANDLER( slikz80_port_w )
441WRITE8_MEMBER(itech8_state::slikz80_port_w )
444442{
445   itech8_state *state = space.machine().driver_data<itech8_state>();
446   state->m_z80_port_val = data;
447   state->m_z80_clear_to_send = 0;
443   m_z80_port_val = data;
444   m_z80_clear_to_send = 0;
448445}
449446
450447
r21064r21065
455452 *
456453 *************************************/
457454
458READ8_HANDLER( slikshot_z80_r )
455READ8_MEMBER(itech8_state::slikshot_z80_r )
459456{
460   itech8_state *state = space.machine().driver_data<itech8_state>();
461457   /* allow the Z80 to send us stuff now */
462   state->m_z80_clear_to_send = 1;
463   return state->m_z80_port_val;
458   m_z80_clear_to_send = 1;
459   return m_z80_port_val;
464460}
465461
466462
r21064r21065
471467 *
472468 *************************************/
473469
474READ8_HANDLER( slikshot_z80_control_r )
470READ8_MEMBER(itech8_state::slikshot_z80_control_r )
475471{
476   itech8_state *state = space.machine().driver_data<itech8_state>();
477   return state->m_z80_ctrl;
472   return m_z80_ctrl;
478473}
479474
480475
r21064r21065
485480 *
486481 *************************************/
487482
488static TIMER_CALLBACK( delayed_z80_control_w )
483TIMER_CALLBACK_MEMBER( itech8_state::delayed_z80_control_w )
489484{
490   itech8_state *state = machine.driver_data<itech8_state>();
491485   int data = param;
492486
493487   /* bit 4 controls the reset line on the Z80 */
494488
495489   /* this is a big kludge: only allow a reset if the Z80 is stopped */
496490   /* at its endpoint; otherwise, we never get a result from the Z80 */
497   if ((data & 0x10) || machine.device("sub")->state().state_int(Z80_PC) == 0x13a)
491   if ((data & 0x10) || machine().device("sub")->state().state_int(Z80_PC) == 0x13a)
498492   {
499      machine.device("sub")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
493      machine().device("sub")->execute().set_input_line(INPUT_LINE_RESET, (data & 0x10) ? CLEAR_LINE : ASSERT_LINE);
500494
501495      /* on the rising edge, make the crosshair visible again */
502      if ((data & 0x10) && !(state->m_z80_ctrl & 0x10))
503         state->m_crosshair_vis = 1;
496      if ((data & 0x10) && !(m_z80_ctrl & 0x10))
497         m_crosshair_vis = 1;
504498   }
505499
506500   /* boost the interleave whenever this is written to */
507   machine.scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
501   machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100));
508502
509503   /* stash the new value */
510   state->m_z80_ctrl = data;
504   m_z80_ctrl = data;
511505}
512506
513507
514WRITE8_HANDLER( slikshot_z80_control_w )
508WRITE8_MEMBER(itech8_state::slikshot_z80_control_w )
515509{
516   space.machine().scheduler().synchronize(FUNC(delayed_z80_control_w), data);
510   machine().scheduler().synchronize(timer_expired_delegate(FUNC(itech8_state::delayed_z80_control_w),this), data);
517511}
518512
519513
r21064r21065
593587      if (temp >=  0x90) temp =  0x90;
594588      m_curx = temp;
595589
596      compute_sensors(machine());
590      compute_sensors();
597591//      popmessage("V=%02x,%02x  X=%02x", m_curvx, m_curvy, m_curx);
598592      m_crosshair_vis = 0;
599593   }
trunk/src/mame/machine/maniach.c
r21064r21065
1919
2020***************************************************************************/
2121
22READ8_HANDLER( maniach_68705_port_a_r )
22READ8_MEMBER(matmania_state::maniach_68705_port_a_r )
2323{
24   matmania_state *state = space.machine().driver_data<matmania_state>();
25
26   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), state->m_port_a_in);
27   return (state->m_port_a_out & state->m_ddr_a) | (state->m_port_a_in & ~state->m_ddr_a);
24   //logerror("%04x: 68705 port A read %02x\n", space.device().safe_pc(), m_port_a_in);
25   return (m_port_a_out & m_ddr_a) | (m_port_a_in & ~m_ddr_a);
2826}
2927
30WRITE8_HANDLER( maniach_68705_port_a_w )
28WRITE8_MEMBER(matmania_state::maniach_68705_port_a_w )
3129{
32   matmania_state *state = space.machine().driver_data<matmania_state>();
33
3430   //logerror("%04x: 68705 port A write %02x\n", space.device().safe_pc(), data);
35   state->m_port_a_out = data;
31   m_port_a_out = data;
3632}
3733
38WRITE8_HANDLER( maniach_68705_ddr_a_w )
34WRITE8_MEMBER(matmania_state::maniach_68705_ddr_a_w )
3935{
40   matmania_state *state = space.machine().driver_data<matmania_state>();
41   state->m_ddr_a = data;
36   m_ddr_a = data;
4237}
4338
4439
r21064r21065
5247 *  2   W  when 0->1, copies port A to the latch for the main CPU
5348 */
5449
55READ8_HANDLER( maniach_68705_port_b_r )
50READ8_MEMBER(matmania_state::maniach_68705_port_b_r )
5651{
57   matmania_state *state = space.machine().driver_data<matmania_state>();
58   return (state->m_port_b_out & state->m_ddr_b) | (state->m_port_b_in & ~state->m_ddr_b);
52   return (m_port_b_out & m_ddr_b) | (m_port_b_in & ~m_ddr_b);
5953}
6054
61WRITE8_HANDLER( maniach_68705_port_b_w )
55WRITE8_MEMBER(matmania_state::maniach_68705_port_b_w )
6256{
63   matmania_state *state = space.machine().driver_data<matmania_state>();
64
6557   //logerror("%04x: 68705 port B write %02x\n", space.device().safe_pc(), data);
6658
67   if (BIT(state->m_ddr_b, 1) && BIT(~data, 1) && BIT(state->m_port_b_out, 1))
59   if (BIT(m_ddr_b, 1) && BIT(~data, 1) && BIT(m_port_b_out, 1))
6860   {
69      state->m_port_a_in = state->m_from_main;
70      state->m_main_sent = 0;
71      //logerror("read command %02x from main cpu\n", state->m_port_a_in);
61      m_port_a_in = m_from_main;
62      m_main_sent = 0;
63      //logerror("read command %02x from main cpu\n", m_port_a_in);
7264   }
73   if (BIT(state->m_ddr_b, 2) && BIT(data, 2) && BIT(~state->m_port_b_out, 2))
65   if (BIT(m_ddr_b, 2) && BIT(data, 2) && BIT(~m_port_b_out, 2))
7466   {
75      //logerror("send command %02x to main cpu\n", state->m_port_a_out);
76      state->m_from_mcu = state->m_port_a_out;
77      state->m_mcu_sent = 1;
67      //logerror("send command %02x to main cpu\n", m_port_a_out);
68      m_from_mcu = m_port_a_out;
69      m_mcu_sent = 1;
7870   }
7971
80   state->m_port_b_out = data;
72   m_port_b_out = data;
8173}
8274
83WRITE8_HANDLER( maniach_68705_ddr_b_w )
75WRITE8_MEMBER(matmania_state::maniach_68705_ddr_b_w )
8476{
85   matmania_state *state = space.machine().driver_data<matmania_state>();
86   state->m_ddr_b = data;
77   m_ddr_b = data;
8778}
8879
8980
90READ8_HANDLER( maniach_68705_port_c_r )
81READ8_MEMBER(matmania_state::maniach_68705_port_c_r )
9182{
92   matmania_state *state = space.machine().driver_data<matmania_state>();
83   m_port_c_in = 0;
9384
94   state->m_port_c_in = 0;
85   if (m_main_sent)
86      m_port_c_in |= 0x01;
9587
96   if (state->m_main_sent)
97      state->m_port_c_in |= 0x01;
88   if (!m_mcu_sent)
89      m_port_c_in |= 0x02;
9890
99   if (!state->m_mcu_sent)
100      state->m_port_c_in |= 0x02;
91   //logerror("%04x: 68705 port C read %02x\n",m_space->device().safe_pc(), m_port_c_in);
10192
102   //logerror("%04x: 68705 port C read %02x\n",state->m_space->device().safe_pc(), state->m_port_c_in);
103
104   return (state->m_port_c_out & state->m_ddr_c) | (state->m_port_c_in & ~state->m_ddr_c);
93   return (m_port_c_out & m_ddr_c) | (m_port_c_in & ~m_ddr_c);
10594}
10695
107WRITE8_HANDLER( maniach_68705_port_c_w )
96WRITE8_MEMBER(matmania_state::maniach_68705_port_c_w )
10897{
109   matmania_state *state = space.machine().driver_data<matmania_state>();
110
11198   //logerror("%04x: 68705 port C write %02x\n", space.device().safe_pc(), data);
112   state->m_port_c_out = data;
99   m_port_c_out = data;
113100}
114101
115WRITE8_HANDLER( maniach_68705_ddr_c_w )
102WRITE8_MEMBER(matmania_state::maniach_68705_ddr_c_w )
116103{
117   matmania_state *state = space.machine().driver_data<matmania_state>();
118   state->m_ddr_c = data;
104   m_ddr_c = data;
119105}
120106
121107
122WRITE8_HANDLER( maniach_mcu_w )
108WRITE8_MEMBER(matmania_state::maniach_mcu_w )
123109{
124   matmania_state *state = space.machine().driver_data<matmania_state>();
125
126110   //logerror("%04x: 3040_w %02x\n", space.device().safe_pc(), data);
127   state->m_from_main = data;
128   state->m_main_sent = 1;
111   m_from_main = data;
112   m_main_sent = 1;
129113}
130114
131READ8_HANDLER( maniach_mcu_r )
115READ8_MEMBER(matmania_state::maniach_mcu_r )
132116{
133   matmania_state *state = space.machine().driver_data<matmania_state>();
134
135   //logerror("%04x: 3040_r %02x\n", space.device().safe_pc(), state->m_from_mcu);
136   state->m_mcu_sent = 0;
137   return state->m_from_mcu;
117   //logerror("%04x: 3040_r %02x\n", space.device().safe_pc(), m_from_mcu);
118   m_mcu_sent = 0;
119   return m_from_mcu;
138120}
139121
140READ8_HANDLER( maniach_mcu_status_r )
122READ8_MEMBER(matmania_state::maniach_mcu_status_r )
141123{
142   matmania_state *state = space.machine().driver_data<matmania_state>();
143124   int res = 0;
144125
145126   /* bit 0 = when 0, mcu has sent data to the main cpu */
146127   /* bit 1 = when 1, mcu is ready to receive data from main cpu */
147128   //logerror("%04x: 3041_r\n", space.device().safe_pc());
148   if (!state->m_mcu_sent)
129   if (!m_mcu_sent)
149130      res |= 0x01;
150   if (!state->m_main_sent)
131   if (!m_main_sent)
151132      res |= 0x02;
152133
153134   return res;
trunk/src/mame/includes/amiga.h
r21064r21065
459459   int m_aga_sprite_dma_used_words[8];
460460
461461   DECLARE_CUSTOM_INPUT_MEMBER( amiga_joystick_convert );
462   DECLARE_DRIVER_INIT(mquake);
463462   DECLARE_DRIVER_INIT(amiga);
464463   DECLARE_DRIVER_INIT(cdtv);
465464   DECLARE_DRIVER_INIT(a3000);
466   DECLARE_MACHINE_RESET(mquake);
467465   DECLARE_MACHINE_RESET(amiga);
468466   DECLARE_VIDEO_START(amiga);
469467   DECLARE_PALETTE_INIT(amiga);
trunk/src/mame/includes/matmania.h
r21064r21065
6161   DECLARE_MACHINE_RESET(maniach);
6262   UINT32 screen_update_matmania(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
6363   UINT32 screen_update_maniach(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
64   /*----------- defined in machine/maniach.c -----------*/
65   DECLARE_READ8_MEMBER( maniach_68705_port_a_r );
66   DECLARE_WRITE8_MEMBER( maniach_68705_port_a_w );
67   DECLARE_READ8_MEMBER( maniach_68705_port_b_r );
68   DECLARE_WRITE8_MEMBER( maniach_68705_port_b_w );
69   DECLARE_READ8_MEMBER( maniach_68705_port_c_r );
70   DECLARE_WRITE8_MEMBER( maniach_68705_port_c_w );
71   DECLARE_WRITE8_MEMBER( maniach_68705_ddr_a_w );
72   DECLARE_WRITE8_MEMBER( maniach_68705_ddr_b_w );
73   DECLARE_WRITE8_MEMBER( maniach_68705_ddr_c_w );
74   DECLARE_WRITE8_MEMBER( maniach_mcu_w );
75   DECLARE_READ8_MEMBER( maniach_mcu_r );
76   DECLARE_READ8_MEMBER( maniach_mcu_status_r );   
6477};
65
66/*----------- defined in machine/maniach.c -----------*/
67
68DECLARE_READ8_HANDLER( maniach_68705_port_a_r );
69DECLARE_WRITE8_HANDLER( maniach_68705_port_a_w );
70DECLARE_READ8_HANDLER( maniach_68705_port_b_r );
71DECLARE_WRITE8_HANDLER( maniach_68705_port_b_w );
72DECLARE_READ8_HANDLER( maniach_68705_port_c_r );
73DECLARE_WRITE8_HANDLER( maniach_68705_port_c_w );
74DECLARE_WRITE8_HANDLER( maniach_68705_ddr_a_w );
75DECLARE_WRITE8_HANDLER( maniach_68705_ddr_b_w );
76DECLARE_WRITE8_HANDLER( maniach_68705_ddr_c_w );
77DECLARE_WRITE8_HANDLER( maniach_mcu_w );
78DECLARE_READ8_HANDLER( maniach_mcu_r );
79DECLARE_READ8_HANDLER( maniach_mcu_status_r );
trunk/src/mame/includes/itech8.h
r21064r21065
110110   inline void consume_rle(int count);
111111   void perform_blit(address_space &space);
112112   void itech8_update_interrupts(int periodic, int tms34061, int blitter);
113};
113   
114   /*----------- defined in machine/slikshot.c -----------*/
114115
115/*----------- defined in machine/slikshot.c -----------*/
116   DECLARE_READ8_MEMBER( slikz80_port_r );
117   DECLARE_WRITE8_MEMBER( slikz80_port_w );
116118
117DECLARE_READ8_HANDLER( slikz80_port_r );
118DECLARE_WRITE8_HANDLER( slikz80_port_w );
119   DECLARE_READ8_MEMBER( slikshot_z80_r );
120   DECLARE_READ8_MEMBER( slikshot_z80_control_r );
121   DECLARE_WRITE8_MEMBER( slikshot_z80_control_w );
119122
120DECLARE_READ8_HANDLER( slikshot_z80_r );
121DECLARE_READ8_HANDLER( slikshot_z80_control_r );
122DECLARE_WRITE8_HANDLER( slikshot_z80_control_w );
123   void inters_to_vels(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 beams,
124                     UINT8 *xres, UINT8 *vxres, UINT8 *vyres);
125   void vels_to_inters(UINT8 x, UINT8 vx, UINT8 vy,
126                     UINT16 *inter1, UINT16 *inter2, UINT16 *inter3, UINT8 *beams);
127   void inters_to_words(UINT16 inter1, UINT16 inter2, UINT16 inter3, UINT8 *beams,
128                     UINT16 *word1, UINT16 *word2, UINT16 *word3);
129                     
130   void words_to_sensors(UINT16 word1, UINT16 word2, UINT16 word3, UINT8 beams,
131                     UINT16 *sens0, UINT16 *sens1, UINT16 *sens2, UINT16 *sens3);
132   void compute_sensors();
133   TIMER_CALLBACK_MEMBER( delayed_z80_control_w );
134};
135
trunk/src/mame/drivers/matmania.c
r21064r21065
9393   AM_RANGE(0x3010, 0x3010) AM_READ_PORT("IN1") AM_WRITE(maniach_sh_command_w)
9494   AM_RANGE(0x3020, 0x3020) AM_READ_PORT("DSW2") AM_WRITEONLY AM_SHARE("scroll")
9595   AM_RANGE(0x3030, 0x3030) AM_READ_PORT("DSW1") AM_WRITENOP   /* ?? */
96   AM_RANGE(0x3040, 0x3040) AM_READWRITE_LEGACY(maniach_mcu_r,maniach_mcu_w)
97   AM_RANGE(0x3041, 0x3041) AM_READ_LEGACY(maniach_mcu_status_r)
96   AM_RANGE(0x3040, 0x3040) AM_READWRITE(maniach_mcu_r,maniach_mcu_w)
97   AM_RANGE(0x3041, 0x3041) AM_READ(maniach_mcu_status_r)
9898   AM_RANGE(0x3050, 0x307f) AM_WRITE(matmania_paletteram_w) AM_SHARE("paletteram")
9999   AM_RANGE(0x4000, 0xffff) AM_ROM
100100ADDRESS_MAP_END
r21064r21065
120120
121121static ADDRESS_MAP_START( maniach_mcu_map, AS_PROGRAM, 8, matmania_state )
122122   ADDRESS_MAP_GLOBAL_MASK(0x7ff)
123   AM_RANGE(0x0000, 0x0000) AM_READWRITE_LEGACY(maniach_68705_port_a_r,maniach_68705_port_a_w)
124   AM_RANGE(0x0001, 0x0001) AM_READWRITE_LEGACY(maniach_68705_port_b_r,maniach_68705_port_b_w)
125   AM_RANGE(0x0002, 0x0002) AM_READWRITE_LEGACY(maniach_68705_port_c_r,maniach_68705_port_c_w)
126   AM_RANGE(0x0004, 0x0004) AM_WRITE_LEGACY(maniach_68705_ddr_a_w)
127   AM_RANGE(0x0005, 0x0005) AM_WRITE_LEGACY(maniach_68705_ddr_b_w)
128   AM_RANGE(0x0006, 0x0006) AM_WRITE_LEGACY(maniach_68705_ddr_c_w)
123   AM_RANGE(0x0000, 0x0000) AM_READWRITE(maniach_68705_port_a_r,maniach_68705_port_a_w)
124   AM_RANGE(0x0001, 0x0001) AM_READWRITE(maniach_68705_port_b_r,maniach_68705_port_b_w)
125   AM_RANGE(0x0002, 0x0002) AM_READWRITE(maniach_68705_port_c_r,maniach_68705_port_c_w)
126   AM_RANGE(0x0004, 0x0004) AM_WRITE(maniach_68705_ddr_a_w)
127   AM_RANGE(0x0005, 0x0005) AM_WRITE(maniach_68705_ddr_b_w)
128   AM_RANGE(0x0006, 0x0006) AM_WRITE(maniach_68705_ddr_c_w)
129129   AM_RANGE(0x0010, 0x007f) AM_RAM
130130   AM_RANGE(0x0080, 0x07ff) AM_ROM
131131ADDRESS_MAP_END
trunk/src/mame/drivers/itech8.c
r21064r21065
980980
981981static ADDRESS_MAP_START( slikz80_io_map, AS_IO, 8, itech8_state )
982982   ADDRESS_MAP_GLOBAL_MASK(0xff)
983   AM_RANGE(0x00, 0x00) AM_READWRITE_LEGACY(slikz80_port_r, slikz80_port_w)
983   AM_RANGE(0x00, 0x00) AM_READWRITE(slikz80_port_r, slikz80_port_w)
984984ADDRESS_MAP_END
985985
986986
r21064r21065
26362636
26372637DRIVER_INIT_MEMBER(itech8_state,slikshot)
26382638{
2639   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x0180, 0x0180, FUNC(slikshot_z80_r));
2640   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x01cf, 0x01cf, FUNC(slikshot_z80_control_r));
2641   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x01cf, 0x01cf, FUNC(slikshot_z80_control_w));
2639   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x0180, 0x0180, read8_delegate(FUNC(itech8_state::slikshot_z80_r),this));
2640   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x01cf, 0x01cf, read8_delegate(FUNC(itech8_state::slikshot_z80_control_r),this));
2641   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x01cf, 0x01cf, write8_delegate(FUNC(itech8_state::slikshot_z80_control_w),this));
26422642}
26432643
26442644
26452645DRIVER_INIT_MEMBER(itech8_state,sstrike)
26462646{
2647   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x1180, 0x1180, FUNC(slikshot_z80_r));
2648   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_read_handler (0x11cf, 0x11cf, FUNC(slikshot_z80_control_r));
2649   machine().device("maincpu")->memory().space(AS_PROGRAM).install_legacy_write_handler(0x11cf, 0x11cf, FUNC(slikshot_z80_control_w));
2647   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x1180, 0x1180, read8_delegate(FUNC(itech8_state::slikshot_z80_r),this));
2648   machine().device("maincpu")->memory().space(AS_PROGRAM).install_read_handler (0x11cf, 0x11cf, read8_delegate(FUNC(itech8_state::slikshot_z80_control_r),this));
2649   machine().device("maincpu")->memory().space(AS_PROGRAM).install_write_handler(0x11cf, 0x11cf, write8_delegate(FUNC(itech8_state::slikshot_z80_control_w),this));
26502650}
26512651
26522652
trunk/src/mame/drivers/mquake.c
r21064r21065
1515#include "machine/nvram.h"
1616#include "machine/amigafdc.h"
1717
18class mquake_state : public amiga_state
19{
20public:
21   mquake_state(const machine_config &mconfig, device_type type, const char *tag)
22      : amiga_state(mconfig, type, tag) { }
1823
24   DECLARE_DRIVER_INIT(mquake);
25   DECLARE_MACHINE_RESET(mquake);
26   DECLARE_WRITE8_MEMBER( mquake_cia_0_porta_w );
27   DECLARE_READ8_MEMBER( mquake_cia_0_portb_r );
28   DECLARE_WRITE8_MEMBER( mquake_cia_0_portb_w );
29   DECLARE_READ8_MEMBER( es5503_sample_r );
30   DECLARE_WRITE16_MEMBER( output_w );
31   DECLARE_READ16_MEMBER( coin_chip_r );
32   DECLARE_WRITE16_MEMBER( coin_chip_w );   
33};
1934
2035/*************************************
2136 *
r21064r21065
3247 *
3348 *************************************/
3449
35static WRITE8_DEVICE_HANDLER( mquake_cia_0_porta_w )
50WRITE8_MEMBER(mquake_state::mquake_cia_0_porta_w)
3651{
37   amiga_state *sta = device->machine().driver_data<amiga_state>();
38
3952   /* switch banks as appropriate */
40   sta->m_bank1->set_entry(data & 1);
53   m_bank1->set_entry(data & 1);
4154
4255   /* swap the write handlers between ROM and bank 1 based on the bit */
4356   if ((data & 1) == 0)
4457      /* overlay disabled, map RAM on 0x000000 */
45      sta->m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
58      m_maincpu->space(AS_PROGRAM).install_write_bank(0x000000, 0x07ffff, "bank1");
4659
4760   else
4861      /* overlay enabled, map Amiga system ROM on 0x000000 */
49      sta->m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
62      m_maincpu->space(AS_PROGRAM).unmap_write(0x000000, 0x07ffff);
5063}
5164
5265
r21064r21065
6679 *
6780 *************************************/
6881
69static READ8_DEVICE_HANDLER( mquake_cia_0_portb_r )
82READ8_MEMBER(mquake_state::mquake_cia_0_portb_r)
7083{
7184   /* parallel port */
72   logerror("%s:CIA0_portb_r\n", space.machine().describe_context());
85   logerror("%s:CIA0_portb_r\n", machine().describe_context());
7386   return 0xff;
7487}
7588
76static WRITE8_DEVICE_HANDLER( mquake_cia_0_portb_w )
89WRITE8_MEMBER(mquake_state::mquake_cia_0_portb_w)
7790{
7891   /* parallel port */
79   logerror("%s:CIA0_portb_w(%02x)\n", space.machine().describe_context(), data);
92   logerror("%s:CIA0_portb_w(%02x)\n", machine().describe_context(), data);
8093}
8194
8295
r21064r21065
87100 *
88101 *************************************/
89102
90static READ8_HANDLER( es5503_sample_r )
103READ8_MEMBER(mquake_state::es5503_sample_r)
91104{
92   UINT8 *rom = space.machine().root_device().memregion("es5503")->base();
93   es5503_device *es5503 = space.machine().device<es5503_device>("es5503");
105   UINT8 *rom = memregion("es5503")->base();
106   es5503_device *es5503 = machine().device<es5503_device>("es5503");
94107
95108   return rom[offset + (es5503->get_channel_strobe() * 0x10000)];
96109}
97110
98static ADDRESS_MAP_START( mquake_es5503_map, AS_0, 8, amiga_state )
99   AM_RANGE(0x000000, 0x1ffff) AM_READ_LEGACY(es5503_sample_r)
111static ADDRESS_MAP_START( mquake_es5503_map, AS_0, 8, mquake_state )
112   AM_RANGE(0x000000, 0x1ffff) AM_READ(es5503_sample_r)
100113ADDRESS_MAP_END
101114
102static WRITE16_HANDLER( output_w )
115WRITE16_MEMBER(mquake_state::output_w)
103116{
104117   if (ACCESSING_BITS_0_7)
105118      logerror("%06x:output_w(%x) = %02x\n", space.device().safe_pc(), offset, data);
106119}
107120
108121
109static READ16_HANDLER( coin_chip_r )
122READ16_MEMBER(mquake_state::coin_chip_r)
110123{
111124   if (offset == 1)
112      return space.machine().root_device().ioport("COINCHIP")->read();
125      return ioport("COINCHIP")->read();
113126   logerror("%06x:coin_chip_r(%02x) & %04x\n", space.device().safe_pc(), offset, mem_mask);
114127   return 0xffff;
115128}
116129
117static WRITE16_HANDLER( coin_chip_w )
130WRITE16_MEMBER(mquake_state::coin_chip_w)
118131{
119132   logerror("%06x:coin_chip_w(%02x) = %04x & %04x\n", space.device().safe_pc(), offset, data, mem_mask);
120133}
r21064r21065
133146 *
134147 *************************************/
135148
136static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, amiga_state )
149static ADDRESS_MAP_START( main_map, AS_PROGRAM, 16, mquake_state )
137150   ADDRESS_MAP_UNMAP_HIGH
138151   AM_RANGE(0x000000, 0x07ffff) AM_RAMBANK("bank1") AM_SHARE("chip_ram")
139152   AM_RANGE(0xbfd000, 0xbfefff) AM_READWRITE_LEGACY(amiga_cia_r, amiga_cia_w)
r21064r21065
145158   AM_RANGE(0x204000, 0x2041ff) AM_DEVREADWRITE8("es5503", es5503_device, read, write, 0x00ff)
146159   AM_RANGE(0x282000, 0x282001) AM_READ_PORT("SW.LO")
147160   AM_RANGE(0x282002, 0x282003) AM_READ_PORT("SW.HI")
148   AM_RANGE(0x284000, 0x28400f) AM_WRITE_LEGACY(output_w)
149   AM_RANGE(0x286000, 0x28600f) AM_READWRITE_LEGACY(coin_chip_r, coin_chip_w)
161   AM_RANGE(0x284000, 0x28400f) AM_WRITE(output_w)
162   AM_RANGE(0x286000, 0x28600f) AM_READWRITE(coin_chip_r, coin_chip_w)
150163   AM_RANGE(0x300000, 0x3bffff) AM_ROM AM_REGION("user2", 0)
151164   AM_RANGE(0xf00000, 0xfbffff) AM_ROM AM_REGION("user2", 0)           /* Custom ROM */
152165ADDRESS_MAP_END
r21064r21065
166179   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2)         /* JS1SW */
167180
168181   PORT_START("JOY0DAT")
169   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 0)
182   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 0)
170183   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
171184
172185   PORT_START("JOY1DAT")
173   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, amiga_state,amiga_joystick_convert, 1)
186   PORT_BIT( 0x0303, IP_ACTIVE_HIGH, IPT_SPECIAL ) PORT_CUSTOM_MEMBER(DEVICE_SELF, mquake_state,amiga_joystick_convert, 1)
174187   PORT_BIT( 0xfcfc, IP_ACTIVE_HIGH, IPT_UNKNOWN )
175188
176189   PORT_START("P1JOY")
r21064r21065
304317 *
305318 *************************************/
306319
307MACHINE_RESET_MEMBER(amiga_state,mquake)
320MACHINE_RESET_MEMBER(mquake_state,mquake)
308321{
309322   MACHINE_RESET_CALL_MEMBER(amiga);
310323}
r21064r21065
322335   DEVCB_NULL,
323336   DEVCB_NULL,
324337   DEVCB_INPUT_PORT("CIA0PORTA"),
325   DEVCB_HANDLER(mquake_cia_0_porta_w),    /* port A */
326   DEVCB_HANDLER(mquake_cia_0_portb_r),
327   DEVCB_HANDLER(mquake_cia_0_portb_w) /* port B */
338   DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_porta_w),    /* port A */
339   DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_portb_r),
340   DEVCB_DRIVER_MEMBER(mquake_state,mquake_cia_0_portb_w) /* port B */
328341};
329342
330343static const legacy_mos6526_interface cia_1_intf =
r21064r21065
339352   DEVCB_NULL
340353};
341354
342static MACHINE_CONFIG_START( mquake, amiga_state )
355static MACHINE_CONFIG_START( mquake, mquake_state )
343356
344357   /* basic machine hardware */
345358   MCFG_CPU_ADD("maincpu", M68000, AMIGA_68000_NTSC_CLOCK)
346359   MCFG_CPU_PROGRAM_MAP(main_map)
347360
348   MCFG_MACHINE_RESET_OVERRIDE(amiga_state,mquake)
361   MCFG_MACHINE_RESET_OVERRIDE(mquake_state,mquake)
349362   MCFG_NVRAM_ADD_0FILL("nvram")
350363
351364   /* video hardware */
r21064r21065
356369   MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0))
357370   MCFG_SCREEN_SIZE(512*2, 262)
358371   MCFG_SCREEN_VISIBLE_AREA((129-8)*2, (449+8-1)*2, 44-8, 244+8-1)
359   MCFG_SCREEN_UPDATE_DRIVER(amiga_state, screen_update_amiga)
372   MCFG_SCREEN_UPDATE_DRIVER(mquake_state, screen_update_amiga)
360373
361374   MCFG_PALETTE_LENGTH(4096)
362   MCFG_PALETTE_INIT_OVERRIDE(amiga_state,amiga)
375   MCFG_PALETTE_INIT_OVERRIDE(mquake_state,amiga)
363376
364   MCFG_VIDEO_START_OVERRIDE(amiga_state,amiga)
377   MCFG_VIDEO_START_OVERRIDE(mquake_state,amiga)
365378
366379   /* sound hardware */
367380   MCFG_SPEAKER_STANDARD_STEREO("lspeaker", "rspeaker")
r21064r21065
427440 *
428441 *************************************/
429442
430DRIVER_INIT_MEMBER(amiga_state,mquake)
443DRIVER_INIT_MEMBER(mquake_state,mquake)
431444{
432445   static const amiga_machine_interface mquake_intf =
433446   {
r21064r21065
453466 *
454467 *************************************/
455468
456GAME( 1987, mquake, 0, mquake, mquake, amiga_state, mquake, 0, "Sente", "Moonquake", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )
469GAME( 1987, mquake, 0, mquake, mquake, mquake_state, mquake, 0, "Sente", "Moonquake", GAME_NOT_WORKING | GAME_NO_SOUND | GAME_IMPERFECT_GRAPHICS )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team