trunk/src/mame/video/gameplan.c
| r21159 | r21160 | |
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | |
| 208 | | static void via_irq(device_t *device, int state) |
| 208 | WRITE_LINE_MEMBER(gameplan_state::via_irq) |
| 209 | 209 | { |
| 210 | | gameplan_state *driver_state = device->machine().driver_data<gameplan_state>(); |
| 211 | 210 | /* Kaos sits in a tight loop polling the VIA irq flags register, but that register is |
| 212 | 211 | cleared by the irq handler. Therefore, I wait a bit before triggering the irq to |
| 213 | 212 | 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); |
| 215 | 214 | } |
| 216 | 215 | |
| 217 | 216 | |
| r21159 | r21160 | |
| 228 | 227 | DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, /*inputs : CA/B1,CA/B2 */ |
| 229 | 228 | DEVCB_DRIVER_MEMBER(gameplan_state,video_data_w), DEVCB_DRIVER_MEMBER(gameplan_state,gameplan_video_command_w), /*outputs: A/B */ |
| 230 | 229 | 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 */ |
| 232 | 231 | }; |
| 233 | 232 | |
| 234 | 233 | |
| r21159 | r21160 | |
| 238 | 237 | DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, /*inputs : CA/B1,CA/B2 */ |
| 239 | 238 | DEVCB_DRIVER_MEMBER(gameplan_state,video_data_w), DEVCB_DRIVER_MEMBER(gameplan_state,leprechn_video_command_w), /*outputs: A/B */ |
| 240 | 239 | 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 */ |
| 242 | 241 | }; |
| 243 | 242 | |
| 244 | 243 | |
trunk/src/mame/drivers/trvquest.c
| r21159 | r21160 | |
| 41 | 41 | #include "includes/gameplan.h" |
| 42 | 42 | #include "machine/nvram.h" |
| 43 | 43 | |
| 44 | | static READ8_HANDLER( trvquest_question_r ) |
| 44 | READ8_MEMBER(gameplan_state::trvquest_question_r) |
| 45 | 45 | { |
| 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]; |
| 49 | 47 | } |
| 50 | 48 | |
| 51 | | static WRITE8_DEVICE_HANDLER( trvquest_coin_w ) |
| 49 | WRITE8_MEMBER(gameplan_state::trvquest_coin_w) |
| 52 | 50 | { |
| 53 | | coin_counter_w(space.machine(), 0, ~data & 1); |
| 51 | coin_counter_w(machine(), 0, ~data & 1); |
| 54 | 52 | } |
| 55 | 53 | |
| 56 | | static WRITE8_DEVICE_HANDLER( trvquest_misc_w ) |
| 54 | WRITE8_MEMBER(gameplan_state::trvquest_misc_w) |
| 57 | 55 | { |
| 58 | 56 | // data & 1 -> led on/off ? |
| 59 | 57 | } |
| r21159 | r21160 | |
| 67 | 65 | AM_RANGE(0x3830, 0x3831) AM_DEVWRITE_LEGACY("ay1", ay8910_address_data_w) |
| 68 | 66 | AM_RANGE(0x3840, 0x3841) AM_DEVWRITE_LEGACY("ay2", ay8910_address_data_w) |
| 69 | 67 | 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) |
| 71 | 69 | AM_RANGE(0xa000, 0xa000) AM_WRITEONLY AM_SHARE("trvquest_q") |
| 72 | 70 | AM_RANGE(0xa000, 0xa000) AM_READNOP // bogus read from the game code when reads question roms |
| 73 | 71 | AM_RANGE(0xb000, 0xffff) AM_ROM |
| r21159 | r21160 | |
| 147 | 145 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
| 148 | 146 | INPUT_PORTS_END |
| 149 | 147 | |
| 150 | | static 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 | | |
| 156 | | static 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 | | |
| 167 | 148 | static const via6522_interface via_1_interface = |
| 168 | 149 | { |
| 169 | 150 | /*inputs : A/B */ DEVCB_INPUT_PORT("IN0"), DEVCB_INPUT_PORT("IN1"), |
| 170 | 151 | /*inputs : CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, |
| 171 | 152 | /*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, |
| 173 | 154 | /*irq */ DEVCB_NULL |
| 174 | 155 | }; |
| 175 | 156 | |
| r21159 | r21160 | |
| 178 | 159 | /*inputs : A/B */ DEVCB_INPUT_PORT("UNK"), DEVCB_INPUT_PORT("DSW"), |
| 179 | 160 | /*inputs : CA/B1,CA/B2 */ DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, DEVCB_NULL, |
| 180 | 161 | /*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) |
| 183 | 164 | }; |
| 184 | 165 | |
| 185 | 166 | |