Previous 199869 Revisions Next

r21160 Monday 18th February, 2013 at 12:45:59 UTC by Miodrag Milanović
cleanup (nw)
[src/mame/drivers]trvquest.c
[src/mame/includes]gameplan.h
[src/mame/video]gameplan.c

trunk/src/mame/video/gameplan.c
r21159r21160
205205}
206206
207207
208static void via_irq(device_t *device, int state)
208WRITE_LINE_MEMBER(gameplan_state::via_irq)
209209{
210   gameplan_state *driver_state = device->machine().driver_data<gameplan_state>();
211210   /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
212211      cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
213212      leave time for the program to see the flag change. */
214   device->machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(gameplan_state::via_irq_delayed),driver_state), state);
213   machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(gameplan_state::via_irq_delayed),this), state);
215214}
216215
217216
r21159r21160
228227   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,                             /*inputs : CA/B1,CA/B2 */
229228   DEVCB_DRIVER_MEMBER(gameplan_state,video_data_w), DEVCB_DRIVER_MEMBER(gameplan_state,gameplan_video_command_w),     /*outputs: A/B         */
230229   DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(gameplan_state,video_command_trigger_w), DEVCB_NULL,   /*outputs: CA/B1,CA/B2 */
231   DEVCB_LINE(via_irq)                                                         /*irq                  */
230   DEVCB_DRIVER_LINE_MEMBER(gameplan_state,via_irq)                                                         /*irq                  */
232231};
233232
234233
r21159r21160
238237   DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,                             /*inputs : CA/B1,CA/B2 */
239238   DEVCB_DRIVER_MEMBER(gameplan_state,video_data_w), DEVCB_DRIVER_MEMBER(gameplan_state,leprechn_video_command_w),     /*outputs: A/B         */
240239   DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_LINE_MEMBER(gameplan_state,video_command_trigger_w), DEVCB_NULL,   /*outputs: CA/B1,CA/B2 */
241   DEVCB_LINE(via_irq)                                                         /*irq                  */
240   DEVCB_DRIVER_LINE_MEMBER(gameplan_state,via_irq)                                                         /*irq                  */
242241};
243242
244243
trunk/src/mame/includes/gameplan.h
r21159r21160
8181   DECLARE_READ8_MEMBER(vblank_r);
8282   void gameplan_get_pens( pen_t *pens );
8383   void leprechn_get_pens( pen_t *pens );
84   DECLARE_WRITE_LINE_MEMBER(via_irq);
85   DECLARE_READ8_MEMBER(trvquest_question_r);
86   DECLARE_WRITE8_MEMBER(trvquest_coin_w);
87   DECLARE_WRITE8_MEMBER(trvquest_misc_w);
8488};
8589
8690/*----------- defined in video/gameplan.c -----------*/
trunk/src/mame/drivers/trvquest.c
r21159r21160
4141#include "includes/gameplan.h"
4242#include "machine/nvram.h"
4343
44static READ8_HANDLER( trvquest_question_r )
44READ8_MEMBER(gameplan_state::trvquest_question_r)
4545{
46   gameplan_state *state = space.machine().driver_data<gameplan_state>();
47
48   return state->memregion("questions")->base()[*state->m_trvquest_question * 0x2000 + offset];
46   return memregion("questions")->base()[*m_trvquest_question * 0x2000 + offset];
4947}
5048
51static WRITE8_DEVICE_HANDLER( trvquest_coin_w )
49WRITE8_MEMBER(gameplan_state::trvquest_coin_w)
5250{
53   coin_counter_w(space.machine(), 0, ~data & 1);
51   coin_counter_w(machine(), 0, ~data & 1);
5452}
5553
56static WRITE8_DEVICE_HANDLER( trvquest_misc_w )
54WRITE8_MEMBER(gameplan_state::trvquest_misc_w)
5755{
5856   // data & 1 -> led on/off ?
5957}
r21159r21160
6765   AM_RANGE(0x3830, 0x3831) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w)
6866   AM_RANGE(0x3840, 0x3841) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w)
6967   AM_RANGE(0x3850, 0x3850) AM_READNOP //watchdog_reset_r ?
70   AM_RANGE(0x8000, 0x9fff) AM_READ_LEGACY(trvquest_question_r)
68   AM_RANGE(0x8000, 0x9fff) AM_READ(trvquest_question_r)
7169   AM_RANGE(0xa000, 0xa000) AM_WRITEONLY AM_SHARE("trvquest_q")
7270   AM_RANGE(0xa000, 0xa000) AM_READNOP // bogus read from the game code when reads question roms
7371   AM_RANGE(0xb000, 0xffff) AM_ROM
r21159r21160
147145   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
148146INPUT_PORTS_END
149147
150static TIMER_CALLBACK( via_irq_delayed )
151{
152   gameplan_state *state = machine.driver_data<gameplan_state>();
153   state->m_maincpu->set_input_line(0, param);
154}
155
156static void via_irq( device_t *device, int state )
157{
158   // from gameplan.c
159
160   /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is
161      cleared by the irq handler. Therefore, I wait a bit before triggering the irq to
162      leave time for the program to see the flag change. */
163   device->machine().scheduler().timer_set(attotime::from_usec(50), FUNC(via_irq_delayed), state);
164}
165
166
167148static const via6522_interface via_1_interface =
168149{
169150   /*inputs : A/B         */ DEVCB_INPUT_PORT("IN0"), DEVCB_INPUT_PORT("IN1"),
170151   /*inputs : CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
171152   /*outputs: A/B         */ DEVCB_NULL, DEVCB_NULL,
172   /*outputs: CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(trvquest_coin_w), DEVCB_NULL,
153   /*outputs: CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(gameplan_state,trvquest_coin_w), DEVCB_NULL,
173154   /*irq                  */ DEVCB_NULL
174155};
175156
r21159r21160
178159   /*inputs : A/B         */ DEVCB_INPUT_PORT("UNK"), DEVCB_INPUT_PORT("DSW"),
179160   /*inputs : CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL,
180161   /*outputs: A/B         */ DEVCB_NULL, DEVCB_NULL,
181   /*outputs: CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_HANDLER(trvquest_misc_w), DEVCB_NULL,
182   /*irq                  */ DEVCB_LINE(via_irq)
162   /*outputs: CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_DRIVER_MEMBER(gameplan_state,trvquest_misc_w), DEVCB_NULL,
163   /*irq                  */ DEVCB_DRIVER_LINE_MEMBER(gameplan_state,via_irq)
183164};
184165
185166

Previous 199869 Revisions Next


© 1997-2024 The MAME Team