Previous | 199869 Revisions | Next |
r18115 Monday 24th September, 2012 at 15:01:45 UTC by Miodrag Milanović |
---|
modernization or timer callbacks part 3 - final (no whatsnew) |
[src/mame/drivers] | 2mindril.c 39in1.c acefruit.c aces1.c alg.c aristmk4.c aristmk5.c astinvad.c beaminv.c berzerk.c boxer.c cball.c clayshoo.c cliffhgr.c crystal.c cubeqst.c destroyr.c enigma2.c esh.c famibox.c firebeat.c flyball.c gpworld.c gticlub.c guab.c halleys.c hornet.c jangou.c jpmsys5.c kinst.c ksys573.c lgp.c mazerbla.c mgolf.c missile.c mjsister.c mlanding.c mpu3.c multigam.c namcos23.c nwk-tr.c peplus.c pipeline.c rabbit.c sbrkout.c seattle.c sothello.c ssfindo.c taitogn.c thayers.c tickee.c tmmjprd.c tugboat.c vegas.c viper.c zn.c zr107.c |
[src/mess/drivers] | a2600.c a7000.c alphatro.c amico2k.c argo.c c10.c cat.c craft.c dectalk.c h19.c ip20.c ip22.c jr200.c mekd2.c ng_aes.c ngp.c okean240.c osbexec.c pb1000.c pc6001.c pc8801.c pc88va.c pcfx.c plan80.c pockstat.c psx.c ptcsol.c pv1000.c px4.c scv.c socrates.c supercon.c supracan.c sys2900.c tec1.c tutor.c vg5k.c vii.c vk100.c zrt80.c |
r18114 | r18115 | |
---|---|---|
80 | 80 | virtual void machine_start(); |
81 | 81 | virtual void machine_reset(); |
82 | 82 | UINT32 screen_update_beaminv(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
83 | TIMER_CALLBACK_MEMBER(interrupt_callback); | |
83 | 84 | }; |
84 | 85 | |
85 | 86 | |
r18114 | r18115 | |
97 | 98 | static const int interrupt_lines[INTERRUPTS_PER_FRAME] = { 0x00, 0x80 }; |
98 | 99 | |
99 | 100 | |
100 | ||
101 | TIMER_CALLBACK_MEMBER(beaminv_state::interrupt_callback) | |
101 | 102 | { |
102 | beaminv_state *state = machine.driver_data<beaminv_state>(); | |
103 | 103 | int interrupt_number = param; |
104 | 104 | int next_interrupt_number; |
105 | 105 | int next_vpos; |
106 | 106 | |
107 | | |
107 | m_maincpu->set_input_line(0, HOLD_LINE); | |
108 | 108 | |
109 | 109 | /* set up for next interrupt */ |
110 | 110 | next_interrupt_number = (interrupt_number + 1) % INTERRUPTS_PER_FRAME; |
111 | 111 | next_vpos = interrupt_lines[next_interrupt_number]; |
112 | 112 | |
113 | | |
113 | m_interrupt_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_interrupt_number); | |
114 | 114 | } |
115 | 115 | |
116 | 116 | |
117 | 117 | static void create_interrupt_timer( running_machine &machine ) |
118 | 118 | { |
119 | 119 | beaminv_state *state = machine.driver_data<beaminv_state>(); |
120 | state->m_interrupt_timer = machine.scheduler().timer_alloc(FUNC(interrupt_callback)); | |
120 | state->m_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(beaminv_state::interrupt_callback),state)); | |
121 | 121 | } |
122 | 122 | |
123 | 123 |
r18114 | r18115 | |
---|---|---|
164 | 164 | virtual void machine_reset(); |
165 | 165 | UINT32 screen_update_kinst(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
166 | 166 | INTERRUPT_GEN_MEMBER(irq0_start); |
167 | TIMER_CALLBACK_MEMBER(irq0_stop); | |
167 | 168 | }; |
168 | 169 | |
169 | 170 | |
r18114 | r18115 | |
276 | 277 | * |
277 | 278 | *************************************/ |
278 | 279 | |
279 | ||
280 | TIMER_CALLBACK_MEMBER(kinst_state::irq0_stop) | |
280 | 281 | { |
281 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
282 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
282 | 283 | } |
283 | 284 | |
284 | 285 | |
285 | 286 | INTERRUPT_GEN_MEMBER(kinst_state::irq0_start) |
286 | 287 | { |
287 | 288 | device.execute().set_input_line(0, ASSERT_LINE); |
288 | machine().scheduler().timer_set(attotime::from_usec(50), FUNC(irq0_stop)); | |
289 | machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(kinst_state::irq0_stop),this)); | |
289 | 290 | } |
290 | 291 | |
291 | 292 |
r18114 | r18115 | |
---|---|---|
65 | 65 | DECLARE_MACHINE_RESET(drill); |
66 | 66 | INTERRUPT_GEN_MEMBER(drill_vblank_irq); |
67 | 67 | //INTERRUPT_GEN_MEMBER(drill_device_irq); |
68 | TIMER_CALLBACK_MEMBER(shutter_req); | |
69 | TIMER_CALLBACK_MEMBER(defender_req); | |
68 | 70 | }; |
69 | 71 | |
70 | 72 | |
r18114 | r18115 | |
132 | 134 | PORT_DIPSETTING( 0x0800, DEF_STR( On ) ) |
133 | 135 | */ |
134 | 136 | #ifdef UNUSED_FUNCTION |
135 | ||
137 | TIMER_CALLBACK_MEMBER(_2mindril_state::shutter_req) | |
136 | 138 | { |
137 | _2mindril_state *state = machine.driver_data<_2mindril_state>(); | |
138 | state->m_shutter_sensor = param; | |
139 | m_shutter_sensor = param; | |
139 | 140 | } |
140 | 141 | |
141 | ||
142 | TIMER_CALLBACK_MEMBER(_2mindril_state::defender_req) | |
142 | 143 | { |
143 | _2mindril_state *state = machine.driver_data<_2mindril_state>(); | |
144 | state->m_defender_sensor = param; | |
144 | m_defender_sensor = param; | |
145 | 145 | } |
146 | 146 | #endif |
147 | 147 |
r18114 | r18115 | |
---|---|---|
58 | 58 | virtual void palette_init(); |
59 | 59 | UINT32 screen_update_cubeqst(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
60 | 60 | INTERRUPT_GEN_MEMBER(vblank); |
61 | TIMER_CALLBACK_MEMBER(delayed_bank_swap); | |
61 | 62 | }; |
62 | 63 | |
63 | 64 | |
r18114 | r18115 | |
256 | 257 | * |
257 | 258 | *************************************/ |
258 | 259 | |
259 | ||
260 | TIMER_CALLBACK_MEMBER(cubeqst_state::delayed_bank_swap) | |
260 | 261 | { |
261 | cubeqcpu_swap_line_banks(machine.device("line_cpu")); | |
262 | cubeqcpu_swap_line_banks(machine().device("line_cpu")); | |
262 | 263 | |
263 | 264 | /* TODO: This is a little dubious */ |
264 | cubeqcpu_clear_stack(machine.device("line_cpu")); | |
265 | cubeqcpu_clear_stack(machine().device("line_cpu")); | |
265 | 266 | } |
266 | 267 | |
267 | 268 | |
268 | 269 | static void swap_linecpu_banks(running_machine &machine) |
269 | 270 | { |
271 | cubeqst_state *state = machine.driver_data<cubeqst_state>(); | |
270 | 272 | /* Best sync up before we switch banks around */ |
271 | machine.scheduler().synchronize(FUNC(delayed_bank_swap)); | |
273 | machine.scheduler().synchronize(timer_expired_delegate(FUNC(cubeqst_state::delayed_bank_swap),state)); | |
272 | 274 | } |
273 | 275 | |
274 | 276 |
r18114 | r18115 | |
---|---|---|
50 | 50 | virtual void machine_reset(); |
51 | 51 | virtual void palette_init(); |
52 | 52 | UINT32 screen_update_boxer(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
53 | TIMER_CALLBACK_MEMBER(pot_interrupt); | |
54 | TIMER_CALLBACK_MEMBER(periodic_callback); | |
53 | 55 | }; |
54 | 56 | |
55 | 57 | /************************************* |
r18114 | r18115 | |
58 | 60 | * |
59 | 61 | *************************************/ |
60 | 62 | |
61 | ||
63 | TIMER_CALLBACK_MEMBER(boxer_state::pot_interrupt) | |
62 | 64 | { |
63 | boxer_state *state = machine.driver_data<boxer_state>(); | |
64 | 65 | int mask = param; |
65 | 66 | |
66 | if (state->m_pot_latch & mask) | |
67 | state->m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); | |
67 | if (m_pot_latch & mask) | |
68 | m_maincpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); | |
68 | 69 | |
69 | | |
70 | m_pot_state |= mask; | |
70 | 71 | } |
71 | 72 | |
72 | 73 | |
73 | ||
74 | TIMER_CALLBACK_MEMBER(boxer_state::periodic_callback) | |
74 | 75 | { |
75 | boxer_state *state = machine.driver_data<boxer_state>(); | |
76 | 76 | int scanline = param; |
77 | 77 | |
78 | | |
78 | m_maincpu->set_input_line(0, ASSERT_LINE); | |
79 | 79 | |
80 | 80 | if (scanline == 0) |
81 | 81 | { |
r18114 | r18115 | |
85 | 85 | |
86 | 86 | memset(mask, 0, sizeof mask); |
87 | 87 | |
88 | mask[state->ioport("STICK0_X")->read()] |= 0x01; | |
89 | mask[state->ioport("STICK0_Y")->read()] |= 0x02; | |
90 | mask[state->ioport("PADDLE0")->read()] |= 0x04; | |
91 | mask[state->ioport("STICK1_X")->read()] |= 0x08; | |
92 | mask[state->ioport("STICK1_Y")->read()] |= 0x10; | |
93 | mask[state->ioport("PADDLE1")->read()] |= 0x20; | |
88 | mask[ioport("STICK0_X")->read()] |= 0x01; | |
89 | mask[ioport("STICK0_Y")->read()] |= 0x02; | |
90 | mask[ioport("PADDLE0")->read()] |= 0x04; | |
91 | mask[ioport("STICK1_X")->read()] |= 0x08; | |
92 | mask[ioport("STICK1_Y")->read()] |= 0x10; | |
93 | mask[ioport("PADDLE1")->read()] |= 0x20; | |
94 | 94 | |
95 | 95 | for (i = 1; i < 256; i++) |
96 | 96 | if (mask[i] != 0) |
97 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(i), FUNC(pot_interrupt), mask[i]); | |
97 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(i), timer_expired_delegate(FUNC(boxer_state::pot_interrupt),this), mask[i]); | |
98 | 98 | |
99 | | |
99 | m_pot_state = 0; | |
100 | 100 | } |
101 | 101 | |
102 | 102 | scanline += 64; |
r18114 | r18115 | |
104 | 104 | if (scanline >= 262) |
105 | 105 | scanline = 0; |
106 | 106 | |
107 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(periodic_callback), scanline); | |
107 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this), scanline); | |
108 | 108 | } |
109 | 109 | |
110 | 110 | |
r18114 | r18115 | |
436 | 436 | |
437 | 437 | void boxer_state::machine_reset() |
438 | 438 | { |
439 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(periodic_callback)); | |
439 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(boxer_state::periodic_callback),this)); | |
440 | 440 | |
441 | 441 | m_pot_state = 0; |
442 | 442 | m_pot_latch = 0; |
r18114 | r18115 | |
---|---|---|
83 | 83 | DECLARE_DRIVER_INIT(aristmk5); |
84 | 84 | virtual void machine_start(); |
85 | 85 | virtual void machine_reset(); |
86 | TIMER_CALLBACK_MEMBER(mk5_VSYNC_callback); | |
87 | TIMER_CALLBACK_MEMBER(mk5_2KHz_callback); | |
86 | 88 | }; |
87 | 89 | |
88 | 90 | |
89 | ||
91 | TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_VSYNC_callback) | |
90 | 92 | { |
91 | aristmk5_state *state = machine.driver_data<aristmk5_state>(); | |
92 | state->m_ioc_regs[IRQ_STATUS_A] |= 0x08; //turn vsync bit on | |
93 | state->m_mk5_VSYNC_timer->adjust(attotime::never); | |
93 | m_ioc_regs[IRQ_STATUS_A] |= 0x08; //turn vsync bit on | |
94 | m_mk5_VSYNC_timer->adjust(attotime::never); | |
94 | 95 | } |
95 | 96 | |
96 | 97 | WRITE32_MEMBER(aristmk5_state::Ns5w48) |
r18114 | r18115 | |
152 | 153 | } |
153 | 154 | } |
154 | 155 | |
155 | ||
156 | TIMER_CALLBACK_MEMBER(aristmk5_state::mk5_2KHz_callback) | |
156 | 157 | { |
157 | aristmk5_state *state = machine.driver_data<aristmk5_state>(); | |
158 | state->m_ioc_regs[IRQ_STATUS_A] |= 0x01; | |
159 | state->m_mk5_2KHz_timer->adjust(attotime::never); | |
158 | m_ioc_regs[IRQ_STATUS_A] |= 0x01; | |
159 | m_mk5_2KHz_timer->adjust(attotime::never); | |
160 | 160 | |
161 | 161 | } |
162 | 162 | |
r18114 | r18115 | |
379 | 379 | // reset the DAC to centerline |
380 | 380 | //machine().device<dac_device>("dac")->write_signed8(0x80); |
381 | 381 | |
382 | m_mk5_2KHz_timer = machine().scheduler().timer_alloc(FUNC(mk5_2KHz_callback)); | |
383 | m_mk5_VSYNC_timer = machine().scheduler().timer_alloc(FUNC(mk5_VSYNC_callback)); | |
382 | m_mk5_2KHz_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_2KHz_callback),this)); | |
383 | m_mk5_VSYNC_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(aristmk5_state::mk5_VSYNC_callback),this)); | |
384 | 384 | } |
385 | 385 | |
386 | 386 | void aristmk5_state::machine_reset() |
r18114 | r18115 | |
---|---|---|
193 | 193 | UINT32 screen_update_crystal(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
194 | 194 | void screen_eof_crystal(screen_device &screen, bool state); |
195 | 195 | INTERRUPT_GEN_MEMBER(crystal_interrupt); |
196 | TIMER_CALLBACK_MEMBER(Timercb); | |
196 | 197 | }; |
197 | 198 | |
198 | 199 | static void IntReq( running_machine &machine, int num ) |
r18114 | r18115 | |
300 | 301 | membank("bank1")->set_base(machine().root_device().memregion("user2")->base()); |
301 | 302 | } |
302 | 303 | |
303 | ||
304 | TIMER_CALLBACK_MEMBER(crystal_state::Timercb) | |
304 | 305 | { |
305 | crystal_state *state = machine.driver_data<crystal_state>(); | |
306 | 306 | int which = (int)(FPTR)ptr; |
307 | 307 | static const int num[] = { 0, 1, 9, 10 }; |
308 | 308 | |
309 | if (!(state->m_Timerctrl[which] & 2)) | |
310 | state->m_Timerctrl[which] &= ~1; | |
309 | if (!(m_Timerctrl[which] & 2)) | |
310 | m_Timerctrl[which] &= ~1; | |
311 | 311 | |
312 | IntReq(machine, num[which]); | |
312 | IntReq(machine(), num[which]); | |
313 | 313 | } |
314 | 314 | |
315 | 315 | INLINE void Timer_w( address_space &space, int which, UINT32 data, UINT32 mem_mask ) |
r18114 | r18115 | |
589 | 589 | |
590 | 590 | machine().device("maincpu")->execute().set_irq_acknowledge_callback(icallback); |
591 | 591 | for (i = 0; i < 4; i++) |
592 | m_Timer[i] = machine().scheduler().timer_alloc(FUNC(Timercb), (void*)(FPTR)i); | |
592 | m_Timer[i] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(crystal_state::Timercb),this), (void*)(FPTR)i); | |
593 | 593 | |
594 | 594 | PatchReset(machine()); |
595 | 595 |
r18114 | r18115 | |
---|---|---|
110 | 110 | virtual void video_start(); |
111 | 111 | virtual void palette_init(); |
112 | 112 | UINT32 screen_update_famibox(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
113 | TIMER_CALLBACK_MEMBER(famicombox_attract_timer_callback); | |
114 | TIMER_CALLBACK_MEMBER(famicombox_gameplay_timer_callback); | |
113 | 115 | }; |
114 | 116 | |
115 | 117 | /****************************************************** |
r18114 | r18115 | |
282 | 284 | machine.device("maincpu")->reset(); |
283 | 285 | } |
284 | 286 | |
285 | ||
287 | TIMER_CALLBACK_MEMBER(famibox_state::famicombox_attract_timer_callback) | |
286 | 288 | { |
287 | famibox_state *state = machine.driver_data<famibox_state>(); | |
288 | 289 | |
289 | state->m_attract_timer->adjust(attotime::never, 0, attotime::never); | |
290 | if ( BIT(state->m_exception_mask,1) ) | |
290 | m_attract_timer->adjust(attotime::never, 0, attotime::never); | |
291 | if ( BIT(m_exception_mask,1) ) | |
291 | 292 | { |
292 | state->m_exception_cause &= ~0x02; | |
293 | famicombox_reset(machine); | |
293 | m_exception_cause &= ~0x02; | |
294 | famicombox_reset(machine()); | |
294 | 295 | } |
295 | 296 | } |
296 | 297 | |
297 | ||
298 | TIMER_CALLBACK_MEMBER(famibox_state::famicombox_gameplay_timer_callback) | |
298 | 299 | { |
299 | famibox_state *state = machine.driver_data<famibox_state>(); | |
300 | 300 | |
301 | if (state->m_coins > 0) | |
302 | state->m_coins--; | |
301 | if (m_coins > 0) | |
302 | m_coins--; | |
303 | 303 | |
304 | if ( | |
304 | if (m_coins == 0) | |
305 | 305 | { |
306 | state->m_gameplay_timer->adjust(attotime::never, 0, attotime::never); | |
307 | if ( BIT(state->m_exception_mask,4) ) | |
306 | m_gameplay_timer->adjust(attotime::never, 0, attotime::never); | |
307 | if ( BIT(m_exception_mask,4) ) | |
308 | 308 | { |
309 | state->m_exception_cause &= ~0x10; | |
310 | famicombox_reset(machine); | |
309 | m_exception_cause &= ~0x10; | |
310 | famicombox_reset(machine()); | |
311 | 311 | } |
312 | 312 | } |
313 | 313 | } |
r18114 | r18115 | |
570 | 570 | famicombox_bankswitch(machine(), 0); |
571 | 571 | |
572 | 572 | |
573 | m_attract_timer = machine().scheduler().timer_alloc(FUNC(famicombox_attract_timer_callback)); | |
574 | m_gameplay_timer = machine().scheduler().timer_alloc(FUNC(famicombox_gameplay_timer_callback)); | |
573 | m_attract_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_attract_timer_callback),this)); | |
574 | m_gameplay_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(famibox_state::famicombox_gameplay_timer_callback),this)); | |
575 | 575 | m_exception_cause = 0xff; |
576 | 576 | m_exception_mask = 0; |
577 | 577 | m_attract_timer_period = 0; |
r18114 | r18115 | |
---|---|---|
118 | 118 | DECLARE_MACHINE_RESET(coh1002v); |
119 | 119 | DECLARE_MACHINE_RESET(coh1002m); |
120 | 120 | INTERRUPT_GEN_MEMBER(qsound_interrupt); |
121 | TIMER_CALLBACK_MEMBER(dip_timer_fired); | |
121 | 122 | }; |
122 | 123 | |
123 | 124 | INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) |
r18114 | r18115 | |
420 | 421 | verboselog( machine(), 2, "znsecsel_w( %08x, %08x, %08x )\n", offset, data, mem_mask ); |
421 | 422 | } |
422 | 423 | |
423 | ||
424 | TIMER_CALLBACK_MEMBER(zn_state::dip_timer_fired) | |
424 | 425 | { |
425 | zn_state *state = machine.driver_data<zn_state>(); | |
426 | psx_sio_input( machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); | |
426 | psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); | |
427 | 427 | |
428 | 428 | if( param ) |
429 | 429 | { |
430 | | |
430 | m_dip_timer->adjust( machine().device<cpu_device>( "maincpu" )->cycles_to_attotime(50 ) ); | |
431 | 431 | } |
432 | 432 | } |
433 | 433 | |
r18114 | r18115 | |
531 | 531 | n_game++; |
532 | 532 | } |
533 | 533 | |
534 | state->m_dip_timer = machine.scheduler().timer_alloc( FUNC(dip_timer_fired), NULL ); | |
534 | state->m_dip_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(zn_state::dip_timer_fired),state), NULL ); | |
535 | 535 | } |
536 | 536 | |
537 | 537 | static void psx_spu_irq(device_t *device, UINT32 data) |
r18114 | r18115 | |
---|---|---|
69 | 69 | virtual void video_start(); |
70 | 70 | UINT32 screen_update_tmmjprd_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
71 | 71 | UINT32 screen_update_tmmjprd_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
72 | TIMER_CALLBACK_MEMBER(tmmjprd_blit_done); | |
72 | 73 | }; |
73 | 74 | |
74 | 75 | |
r18114 | r18115 | |
378 | 379 | #define BLITLOG 0 |
379 | 380 | |
380 | 381 | #if 0 |
381 | ||
382 | TIMER_CALLBACK_MEMBER(tmmjprd_state::tmmjprd_blit_done) | |
382 | 383 | { |
383 | machine.device("maincpu")->execute().set_input_line(3, HOLD_LINE); | |
384 | machine().device("maincpu")->execute().set_input_line(3, HOLD_LINE); | |
384 | 385 | } |
385 | 386 | |
386 | 387 | static void tmmjprd_do_blit(running_machine &machine) |
r18114 | r18115 | |
428 | 429 | if (!blt_amount) |
429 | 430 | { |
430 | 431 | if(BLITLOG) mame_printf_debug("end of blit list\n"); |
431 | machine.scheduler().timer_set(attotime::from_usec(500), FUNC(tmmjprd_blit_done)); | |
432 | machine.scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(tmmjprd_state::tmmjprd_blit_done),this)); | |
432 | 433 | return; |
433 | 434 | } |
434 | 435 |
r18114 | r18115 | |
---|---|---|
91 | 91 | virtual void machine_reset(); |
92 | 92 | UINT32 screen_update_enigma2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
93 | 93 | UINT32 screen_update_enigma2a(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
94 | TIMER_CALLBACK_MEMBER(interrupt_clear_callback); | |
95 | TIMER_CALLBACK_MEMBER(interrupt_assert_callback); | |
94 | 96 | }; |
95 | 97 | |
96 | 98 | |
r18114 | r18115 | |
113 | 115 | } |
114 | 116 | |
115 | 117 | |
116 | ||
118 | TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_clear_callback) | |
117 | 119 | { |
118 | enigma2_state *state = machine.driver_data<enigma2_state>(); | |
119 | state->m_maincpu->set_input_line(0, CLEAR_LINE); | |
120 | m_maincpu->set_input_line(0, CLEAR_LINE); | |
120 | 121 | } |
121 | 122 | |
122 | 123 | |
123 | ||
124 | TIMER_CALLBACK_MEMBER(enigma2_state::interrupt_assert_callback) | |
124 | 125 | { |
125 | enigma2_state *state = machine.driver_data<enigma2_state>(); | |
126 | 126 | UINT16 next_counter; |
127 | 127 | int next_vpos; |
128 | 128 | |
129 | 129 | /* compute vector and set the interrupt line */ |
130 | int vpos = machine.primary_screen->vpos(); | |
130 | int vpos = machine().primary_screen->vpos(); | |
131 | 131 | UINT16 counter = vpos_to_vysnc_chain_counter(vpos); |
132 | 132 | UINT8 vector = 0xc7 | ((counter & 0x80) >> 3) | ((~counter & 0x80) >> 4); |
133 | | |
133 | m_maincpu->set_input_line_and_vector(0, ASSERT_LINE, vector); | |
134 | 134 | |
135 | 135 | /* set up for next interrupt */ |
136 | 136 | if (counter == INT_TRIGGER_COUNT_1) |
r18114 | r18115 | |
139 | 139 | next_counter = INT_TRIGGER_COUNT_1; |
140 | 140 | |
141 | 141 | next_vpos = vysnc_chain_counter_to_vpos(next_counter); |
142 | state->m_interrupt_assert_timer->adjust(machine.primary_screen->time_until_pos(next_vpos)); | |
143 | state->m_interrupt_clear_timer->adjust(machine.primary_screen->time_until_pos(vpos + 1)); | |
142 | m_interrupt_assert_timer->adjust(machine().primary_screen->time_until_pos(next_vpos)); | |
143 | m_interrupt_clear_timer->adjust(machine().primary_screen->time_until_pos(vpos + 1)); | |
144 | 144 | } |
145 | 145 | |
146 | 146 | |
147 | 147 | static void create_interrupt_timers( running_machine &machine ) |
148 | 148 | { |
149 | 149 | enigma2_state *state = machine.driver_data<enigma2_state>(); |
150 | state->m_interrupt_clear_timer = machine.scheduler().timer_alloc(FUNC(interrupt_clear_callback)); | |
151 | state->m_interrupt_assert_timer = machine.scheduler().timer_alloc(FUNC(interrupt_assert_callback)); | |
150 | state->m_interrupt_clear_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_clear_callback),state)); | |
151 | state->m_interrupt_assert_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(enigma2_state::interrupt_assert_callback),state)); | |
152 | 152 | } |
153 | 153 | |
154 | 154 |
r18114 | r18115 | |
---|---|---|
264 | 264 | DECLARE_MACHINE_RESET(gticlub); |
265 | 265 | DECLARE_MACHINE_RESET(hangplt); |
266 | 266 | INTERRUPT_GEN_MEMBER(gticlub_vblank); |
267 | TIMER_CALLBACK_MEMBER(irq_off); | |
267 | 268 | }; |
268 | 269 | |
269 | 270 | |
r18114 | r18115 | |
707 | 708 | }; |
708 | 709 | |
709 | 710 | |
710 | ||
711 | TIMER_CALLBACK_MEMBER(gticlub_state::irq_off) | |
711 | 712 | { |
712 | machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
713 | machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
713 | 714 | } |
714 | 715 | |
715 | 716 | static void sound_irq_callback( running_machine &machine, int irq ) |
716 | 717 | { |
718 | gticlub_state *state = machine.driver_data<gticlub_state>(); | |
717 | 719 | int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2; |
718 | 720 | |
719 | 721 | machine.device("audiocpu")->execute().set_input_line(line, ASSERT_LINE); |
720 | machine.scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line); | |
722 | machine.scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(gticlub_state::irq_off),state), line); | |
721 | 723 | } |
722 | 724 | |
723 | 725 | static const k056800_interface gticlub_k056800_interface = |
r18114 | r18115 | |
---|---|---|
99 | 99 | virtual void machine_reset(); |
100 | 100 | virtual void video_start(); |
101 | 101 | UINT32 screen_update_guab(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
102 | TIMER_CALLBACK_MEMBER(fdc_data_callback); | |
102 | 103 | }; |
103 | 104 | |
104 | 105 | |
r18114 | r18115 | |
324 | 325 | }; |
325 | 326 | |
326 | 327 | |
327 | ||
328 | TIMER_CALLBACK_MEMBER(guab_state::fdc_data_callback) | |
328 | 329 | { |
329 | guab_state *state = machine.driver_data<guab_state>(); | |
330 | struct wd1770 &fdc = state->m_fdc; | |
331 | UINT8* disk = (UINT8*)state->memregion("user1")->base(); | |
330 | struct wd1770 &fdc = m_fdc; | |
331 | UINT8* disk = (UINT8*)memregion("user1")->base(); | |
332 | 332 | int more_data = 0; |
333 | 333 | |
334 | 334 | /* |
r18114 | r18115 | |
374 | 374 | |
375 | 375 | if (more_data) |
376 | 376 | { |
377 | | |
377 | m_fdc_timer->adjust(attotime::from_usec(USEC_DELAY)); | |
378 | 378 | } |
379 | 379 | else |
380 | 380 | { |
r18114 | r18115 | |
384 | 384 | } |
385 | 385 | |
386 | 386 | fdc.status |= DATA_REQUEST; |
387 | machine.device("maincpu")->execute().set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); | |
387 | machine().device("maincpu")->execute().set_input_line(INT_FLOPPYCTRL, ASSERT_LINE); | |
388 | 388 | } |
389 | 389 | |
390 | 390 | |
r18114 | r18115 | |
805 | 805 | |
806 | 806 | void guab_state::machine_start() |
807 | 807 | { |
808 | m_fdc_timer = machine().scheduler().timer_alloc(FUNC(fdc_data_callback)); | |
808 | m_fdc_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(guab_state::fdc_data_callback),this)); | |
809 | 809 | } |
810 | 810 | |
811 | 811 | void guab_state::machine_reset() |
r18114 | r18115 | |
---|---|---|
59 | 59 | virtual void machine_reset(); |
60 | 60 | virtual void video_start(); |
61 | 61 | UINT32 screen_update_berzerk(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
62 | TIMER_CALLBACK_MEMBER(irq_callback); | |
63 | TIMER_CALLBACK_MEMBER(nmi_callback); | |
62 | 64 | }; |
63 | 65 | |
64 | 66 | |
r18114 | r18115 | |
181 | 183 | } |
182 | 184 | |
183 | 185 | |
184 | ||
186 | TIMER_CALLBACK_MEMBER(berzerk_state::irq_callback) | |
185 | 187 | { |
186 | berzerk_state *state = machine.driver_data<berzerk_state>(); | |
187 | 188 | int irq_number = param; |
188 | 189 | UINT8 next_counter; |
189 | 190 | UINT8 next_v256; |
r18114 | r18115 | |
191 | 192 | int next_irq_number; |
192 | 193 | |
193 | 194 | /* set the IRQ line if enabled */ |
194 | if (state->m_irq_enabled) | |
195 | machine.device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfc); | |
195 | if (m_irq_enabled) | |
196 | machine().device("maincpu")->execute().set_input_line_and_vector(0, HOLD_LINE, 0xfc); | |
196 | 197 | |
197 | 198 | /* set up for next interrupt */ |
198 | 199 | next_irq_number = (irq_number + 1) % IRQS_PER_FRAME; |
r18114 | r18115 | |
200 | 201 | next_v256 = irq_trigger_v256s[next_irq_number]; |
201 | 202 | |
202 | 203 | next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256); |
203 | | |
204 | m_irq_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_irq_number); | |
204 | 205 | } |
205 | 206 | |
206 | 207 | |
207 | 208 | static void create_irq_timer(running_machine &machine) |
208 | 209 | { |
209 | 210 | berzerk_state *state = machine.driver_data<berzerk_state>(); |
210 | state->m_irq_timer = machine.scheduler().timer_alloc(FUNC(irq_callback)); | |
211 | state->m_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::irq_callback),state)); | |
211 | 212 | } |
212 | 213 | |
213 | 214 | |
r18114 | r18115 | |
261 | 262 | } |
262 | 263 | |
263 | 264 | |
264 | ||
265 | TIMER_CALLBACK_MEMBER(berzerk_state::nmi_callback) | |
265 | 266 | { |
266 | berzerk_state *state = machine.driver_data<berzerk_state>(); | |
267 | 267 | int nmi_number = param; |
268 | 268 | UINT8 next_counter; |
269 | 269 | UINT8 next_v256; |
r18114 | r18115 | |
271 | 271 | int next_nmi_number; |
272 | 272 | |
273 | 273 | /* pulse the NMI line if enabled */ |
274 | if (state->m_nmi_enabled) | |
275 | machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
274 | if (m_nmi_enabled) | |
275 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
276 | 276 | |
277 | 277 | /* set up for next interrupt */ |
278 | 278 | next_nmi_number = (nmi_number + 1) % NMIS_PER_FRAME; |
r18114 | r18115 | |
280 | 280 | next_v256 = nmi_trigger_v256s[next_nmi_number]; |
281 | 281 | |
282 | 282 | next_vpos = vsync_chain_counter_to_vpos(next_counter, next_v256); |
283 | | |
283 | m_nmi_timer->adjust(machine().primary_screen->time_until_pos(next_vpos), next_nmi_number); | |
284 | 284 | } |
285 | 285 | |
286 | 286 | |
287 | 287 | static void create_nmi_timer(running_machine &machine) |
288 | 288 | { |
289 | 289 | berzerk_state *state = machine.driver_data<berzerk_state>(); |
290 | state->m_nmi_timer = machine.scheduler().timer_alloc(FUNC(nmi_callback)); | |
290 | state->m_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::nmi_callback),state)); | |
291 | 291 | } |
292 | 292 | |
293 | 293 |
r18114 | r18115 | |
---|---|---|
494 | 494 | virtual void machine_start(); |
495 | 495 | virtual void machine_reset(); |
496 | 496 | UINT32 screen_update_seattle(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
497 | TIMER_CALLBACK_MEMBER(galileo_timer_callback); | |
497 | 498 | }; |
498 | 499 | |
499 | 500 | |
r18114 | r18115 | |
506 | 507 | static void vblank_assert(device_t *device, int state); |
507 | 508 | static void update_vblank_irq(running_machine &machine); |
508 | 509 | static void galileo_reset(running_machine &machine); |
509 | ||
510 | ||
510 | 511 | static void galileo_perform_dma(address_space &space, int which); |
511 | 512 | static void voodoo_stall(device_t *device, int stall); |
512 | 513 | static void widget_reset(running_machine &machine); |
r18114 | r18115 | |
540 | 541 | m_voodoo = machine().device("voodoo"); |
541 | 542 | |
542 | 543 | /* allocate timers for the galileo */ |
543 | m_galileo.timer[0].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); | |
544 | m_galileo.timer[1].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); | |
545 | m_galileo.timer[2].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); | |
546 | m_galileo.timer[3].timer = machine().scheduler().timer_alloc(FUNC(galileo_timer_callback)); | |
544 | m_galileo.timer[0].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); | |
545 | m_galileo.timer[1].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); | |
546 | m_galileo.timer[2].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); | |
547 | m_galileo.timer[3].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(seattle_state::galileo_timer_callback),this)); | |
547 | 548 | |
548 | 549 | /* set the fastest DRC options, but strict verification */ |
549 | 550 | mips3drc_set_options(machine().device("maincpu"), MIPS3DRC_FASTEST_OPTIONS + MIPS3DRC_STRICT_VERIFY); |
r18114 | r18115 | |
940 | 941 | } |
941 | 942 | |
942 | 943 | |
943 | ||
944 | TIMER_CALLBACK_MEMBER(seattle_state::galileo_timer_callback) | |
944 | 945 | { |
945 | seattle_state *state = machine.driver_data<seattle_state>(); | |
946 | 946 | int which = param; |
947 | galileo_timer *timer = & | |
947 | galileo_timer *timer = &m_galileo.timer[which]; | |
948 | 948 | |
949 | 949 | if (LOG_TIMERS) |
950 | 950 | logerror("timer %d fired\n", which); |
951 | 951 | |
952 | 952 | /* copy the start value from the registers */ |
953 | timer->count = | |
953 | timer->count = m_galileo.reg[GREG_TIMER0_COUNT + which]; | |
954 | 954 | if (which != 0) |
955 | 955 | timer->count &= 0xffffff; |
956 | 956 | |
957 | 957 | /* if we're a timer, adjust the timer to fire again */ |
958 | if ( | |
958 | if (m_galileo.reg[GREG_TIMER_CONTROL] & (2 << (2 * which))) | |
959 | 959 | timer->timer->adjust(TIMER_PERIOD * timer->count, which); |
960 | 960 | else |
961 | 961 | timer->active = timer->count = 0; |
962 | 962 | |
963 | 963 | /* trigger the interrupt */ |
964 | state->m_galileo.reg[GREG_INT_STATE] |= 1 << (GINT_T0EXP_SHIFT + which); | |
965 | update_galileo_irqs(machine); | |
964 | m_galileo.reg[GREG_INT_STATE] |= 1 << (GINT_T0EXP_SHIFT + which); | |
965 | update_galileo_irqs(machine()); | |
966 | 966 | } |
967 | 967 | |
968 | 968 |
r18114 | r18115 | |
---|---|---|
61 | 61 | virtual void video_start(); |
62 | 62 | virtual void palette_init(); |
63 | 63 | UINT32 screen_update_flyball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
64 | TIMER_CALLBACK_MEMBER(flyball_joystick_callback); | |
65 | TIMER_CALLBACK_MEMBER(flyball_quarter_callback); | |
64 | 66 | }; |
65 | 67 | |
66 | 68 | |
r18114 | r18115 | |
129 | 131 | } |
130 | 132 | |
131 | 133 | |
132 | ||
134 | TIMER_CALLBACK_MEMBER(flyball_state::flyball_joystick_callback) | |
133 | 135 | { |
134 | flyball_state *state = machine.driver_data<flyball_state>(); | |
135 | 136 | int potsense = param; |
136 | 137 | |
137 | if (potsense & ~state->m_potmask) | |
138 | generic_pulse_irq_line(state->m_maincpu, 0, 1); | |
138 | if (potsense & ~m_potmask) | |
139 | generic_pulse_irq_line(*m_maincpu, 0, 1); | |
139 | 140 | |
140 | | |
141 | m_potsense |= potsense; | |
141 | 142 | } |
142 | 143 | |
143 | 144 | |
144 | ||
145 | TIMER_CALLBACK_MEMBER(flyball_state::flyball_quarter_callback) | |
145 | 146 | { |
146 | flyball_state *state = machine.driver_data<flyball_state>(); | |
147 | 147 | int scanline = param; |
148 | 148 | int potsense[64], i; |
149 | 149 | |
150 | 150 | memset(potsense, 0, sizeof potsense); |
151 | 151 | |
152 | potsense[state->ioport("STICK1_Y")->read()] |= 1; | |
153 | potsense[state->ioport("STICK1_X")->read()] |= 2; | |
154 | potsense[state->ioport("STICK0_Y")->read()] |= 4; | |
155 | potsense[state->ioport("STICK0_X")->read()] |= 8; | |
152 | potsense[ioport("STICK1_Y")->read()] |= 1; | |
153 | potsense[ioport("STICK1_X")->read()] |= 2; | |
154 | potsense[ioport("STICK0_Y")->read()] |= 4; | |
155 | potsense[ioport("STICK0_X")->read()] |= 8; | |
156 | 156 | |
157 | 157 | for (i = 0; i < 64; i++) |
158 | 158 | if (potsense[i] != 0) |
159 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline + i), FUNC(flyball_joystick_callback), potsense[i]); | |
159 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline + i), timer_expired_delegate(FUNC(flyball_state::flyball_joystick_callback),this), potsense[i]); | |
160 | 160 | |
161 | 161 | scanline += 0x40; |
162 | 162 | scanline &= 0xff; |
163 | 163 | |
164 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(flyball_quarter_callback), scanline); | |
164 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(flyball_state::flyball_quarter_callback),this), scanline); | |
165 | 165 | |
166 | state->m_potsense = 0; | |
167 | state->m_potmask = 0; | |
166 | m_potsense = 0; | |
167 | m_potmask = 0; | |
168 | 168 | } |
169 | 169 | |
170 | 170 | |
r18114 | r18115 | |
398 | 398 | |
399 | 399 | machine().device("maincpu")->reset(); |
400 | 400 | |
401 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(flyball_quarter_callback)); | |
401 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(flyball_state::flyball_quarter_callback),this)); | |
402 | 402 | |
403 | 403 | m_pitcher_vert = 0; |
404 | 404 | m_pitcher_horz = 0; |
r18114 | r18115 | |
---|---|---|
102 | 102 | virtual void video_start(); |
103 | 103 | virtual void palette_init(); |
104 | 104 | UINT32 screen_update_pipeline(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
105 | TIMER_CALLBACK_MEMBER(protection_deferred_w); | |
105 | 106 | }; |
106 | 107 | |
107 | 108 | |
r18114 | r18115 | |
178 | 179 | return m_fromMCU; |
179 | 180 | } |
180 | 181 | |
181 | ||
182 | TIMER_CALLBACK_MEMBER(pipeline_state::protection_deferred_w) | |
182 | 183 | { |
183 | pipeline_state *state = machine.driver_data<pipeline_state>(); | |
184 | state->m_toMCU = param; | |
184 | m_toMCU = param; | |
185 | 185 | } |
186 | 186 | |
187 | 187 | WRITE8_MEMBER(pipeline_state::protection_w) |
188 | 188 | { |
189 | machine().scheduler().synchronize(FUNC(protection_deferred_w), data); | |
189 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(pipeline_state::protection_deferred_w),this), data); | |
190 | 190 | machine().scheduler().boost_interleave(attotime::zero, attotime::from_usec(100)); |
191 | 191 | } |
192 | 192 |
r18114 | r18115 | |
---|---|---|
76 | 76 | virtual void machine_start(); |
77 | 77 | UINT32 screen_update_39in1(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
78 | 78 | INTERRUPT_GEN_MEMBER(pxa255_vblank_start); |
79 | TIMER_CALLBACK_MEMBER(pxa255_dma_dma_end); | |
80 | TIMER_CALLBACK_MEMBER(pxa255_ostimer_match); | |
81 | TIMER_CALLBACK_MEMBER(pxa255_lcd_dma_eof); | |
79 | 82 | }; |
80 | 83 | |
81 | 84 | |
r18114 | r18115 | |
87 | 90 | |
88 | 91 | |
89 | 92 | static void pxa255_ostimer_irq_check(running_machine& machine); |
90 | static TIMER_CALLBACK( pxa255_ostimer_match ); | |
91 | 93 | |
92 | 94 | |
93 | 95 | |
96 | ||
94 | 97 | static void pxa255_update_interrupts(running_machine& machine); |
95 | 98 | static void pxa255_set_irq_line(running_machine& machine, UINT32 line, int state); |
96 | 99 | |
r18114 | r18115 | |
308 | 311 | dma_regs->dcsr[channel] &= ~PXA255_DCSR_STOPSTATE; |
309 | 312 | } |
310 | 313 | |
311 | ||
314 | TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_dma_dma_end) | |
312 | 315 | { |
313 | _39in1_state *state = machine.driver_data<_39in1_state>(); | |
314 | PXA255_DMA_Regs *dma_regs = &state->m_dma_regs; | |
316 | PXA255_DMA_Regs *dma_regs = &m_dma_regs; | |
315 | 317 | UINT32 sadr = dma_regs->dsadr[param]; |
316 | 318 | UINT32 tadr = dma_regs->dtadr[param]; |
317 | 319 | UINT32 count = dma_regs->dcmd[param] & 0x00001fff; |
r18114 | r18115 | |
320 | 322 | UINT16 temp16; |
321 | 323 | UINT32 temp32; |
322 | 324 | |
323 | address_space &space = machine.device<pxa255_device>("maincpu")->space(AS_PROGRAM); | |
325 | address_space &space = machine().device<pxa255_device>("maincpu")->space(AS_PROGRAM); | |
324 | 326 | switch(param) |
325 | 327 | { |
326 | 328 | case 3: |
327 | 329 | for(index = 0; index < count; index += 4) |
328 | 330 | { |
329 | state->m_words[index >> 2] = space.read_dword(sadr); | |
330 | state->m_samples[(index >> 1) + 0] = (INT16)(state->m_words[index >> 2] >> 16); | |
331 | state->m_samples[(index >> 1) + 1] = (INT16)(state->m_words[index >> 2] & 0xffff); | |
331 | m_words[index >> 2] = space.read_dword(sadr); | |
332 | m_samples[(index >> 1) + 0] = (INT16)(m_words[index >> 2] >> 16); | |
333 | m_samples[(index >> 1) + 1] = (INT16)(m_words[index >> 2] & 0xffff); | |
332 | 334 | sadr += 4; |
333 | 335 | } |
334 | dmadac_transfer(& | |
336 | dmadac_transfer(&m_dmadac[0], 2, 2, 2, count/4, m_samples); | |
335 | 337 | break; |
336 | 338 | default: |
337 | 339 | for(index = 0; index < count;) |
r18114 | r18115 | |
403 | 405 | { |
404 | 406 | if(dma_regs->dcsr[param] & PXA255_DCSR_RUN) |
405 | 407 | { |
406 | pxa255_dma_load_descriptor_and_start(machine, param); | |
408 | pxa255_dma_load_descriptor_and_start(machine(), param); | |
407 | 409 | } |
408 | 410 | else |
409 | 411 | { |
r18114 | r18115 | |
416 | 418 | dma_regs->dcsr[param] &= ~PXA255_DCSR_RUN; |
417 | 419 | dma_regs->dcsr[param] |= PXA255_DCSR_STOPSTATE; |
418 | 420 | } |
419 | pxa255_dma_irq_check(machine); | |
421 | pxa255_dma_irq_check(machine()); | |
420 | 422 | } |
421 | 423 | |
422 | 424 | READ32_MEMBER(_39in1_state::pxa255_dma_r) |
r18114 | r18115 | |
579 | 581 | //pxa255_set_irq_line(machine, PXA255_INT_OSTIMER3, (ostimer_regs->oier & PXA255_OIER_E3) ? ((ostimer_regs->ossr & PXA255_OSSR_M3) ? 1 : 0) : 0); |
580 | 582 | } |
581 | 583 | |
582 | ||
584 | TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_ostimer_match) | |
583 | 585 | { |
584 | _39in1_state *state = machine.driver_data<_39in1_state>(); | |
585 | PXA255_OSTMR_Regs *ostimer_regs = &state->m_ostimer_regs; | |
586 | PXA255_OSTMR_Regs *ostimer_regs = &m_ostimer_regs; | |
586 | 587 | |
587 | if (0) verboselog(machine, 3, "pxa255_ostimer_match channel %d\n", param); | |
588 | if (0) verboselog(machine(), 3, "pxa255_ostimer_match channel %d\n", param); | |
588 | 589 | ostimer_regs->ossr |= (1 << param); |
589 | 590 | ostimer_regs->oscr = ostimer_regs->osmr[param]; |
590 | pxa255_ostimer_irq_check(machine); | |
591 | pxa255_ostimer_irq_check(machine()); | |
591 | 592 | } |
592 | 593 | |
593 | 594 | READ32_MEMBER(_39in1_state::pxa255_ostimer_r) |
r18114 | r18115 | |
1166 | 1167 | } |
1167 | 1168 | } |
1168 | 1169 | |
1169 | ||
1170 | TIMER_CALLBACK_MEMBER(_39in1_state::pxa255_lcd_dma_eof) | |
1170 | 1171 | { |
1171 | _39in1_state *state = machine.driver_data<_39in1_state>(); | |
1172 | PXA255_LCD_Regs *lcd_regs = &state->m_lcd_regs; | |
1172 | PXA255_LCD_Regs *lcd_regs = &m_lcd_regs; | |
1173 | 1173 | |
1174 | if (0) verboselog( machine, 3, "End of frame callback\n" ); | |
1174 | if (0) verboselog( machine(), 3, "End of frame callback\n" ); | |
1175 | 1175 | if(lcd_regs->dma[param].ldcmd & PXA255_LDCMD_EOFINT) |
1176 | 1176 | { |
1177 | 1177 | lcd_regs->liidr = lcd_regs->dma[param].fidr; |
1178 | 1178 | lcd_regs->lcsr |= PXA255_LCSR_EOF; |
1179 | 1179 | } |
1180 | pxa255_lcd_check_load_next_branch(machine, param); | |
1181 | pxa255_lcd_irq_check(machine); | |
1180 | pxa255_lcd_check_load_next_branch(machine(), param); | |
1181 | pxa255_lcd_irq_check(machine()); | |
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | READ32_MEMBER(_39in1_state::pxa255_lcd_r) |
r18114 | r18115 | |
1548 | 1548 | for(index = 0; index < 16; index++) |
1549 | 1549 | { |
1550 | 1550 | state->m_dma_regs.dcsr[index] = 0x00000008; |
1551 | state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(FUNC(pxa255_dma_dma_end)); | |
1551 | state->m_dma_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_dma_dma_end),state)); | |
1552 | 1552 | } |
1553 | 1553 | |
1554 | 1554 | memset(&state->m_ostimer_regs, 0, sizeof(state->m_ostimer_regs)); |
1555 | 1555 | for(index = 0; index < 4; index++) |
1556 | 1556 | { |
1557 | 1557 | state->m_ostimer_regs.osmr[index] = 0; |
1558 | state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(FUNC(pxa255_ostimer_match)); | |
1558 | state->m_ostimer_regs.timer[index] = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_ostimer_match),state)); | |
1559 | 1559 | } |
1560 | 1560 | |
1561 | 1561 | memset(&state->m_intc_regs, 0, sizeof(state->m_intc_regs)); |
1562 | 1562 | |
1563 | 1563 | memset(&state->m_lcd_regs, 0, sizeof(state->m_lcd_regs)); |
1564 | state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof)); | |
1565 | state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(FUNC(pxa255_lcd_dma_eof)); | |
1564 | state->m_lcd_regs.dma[0].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); | |
1565 | state->m_lcd_regs.dma[1].eof = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(_39in1_state::pxa255_lcd_dma_eof),state)); | |
1566 | 1566 | state->m_lcd_regs.trgbr = 0x00aa5500; |
1567 | 1567 | state->m_lcd_regs.tcr = 0x0000754f; |
1568 | 1568 |
r18114 | r18115 | |
---|---|---|
185 | 185 | DECLARE_DRIVER_INIT(m3hprvpr); |
186 | 186 | virtual void machine_start(); |
187 | 187 | virtual void machine_reset(); |
188 | TIMER_CALLBACK_MEMBER(ic21_timeout); | |
188 | 189 | }; |
189 | 190 | |
190 | 191 | #define DISPLAY_PORT 0 |
191 | 192 | #define METER_PORT 1 |
192 | 193 | #define BWB_FUNCTIONALITY 2 |
193 | static TIMER_CALLBACK( ic21_timeout ); | |
194 | 194 | |
195 | ||
195 | 196 | static void update_triacs(running_machine &machine) |
196 | 197 | { |
197 | 198 | mpu3_state *state = machine.driver_data<mpu3_state>(); |
r18114 | r18115 | |
353 | 354 | } |
354 | 355 | } |
355 | 356 | |
356 | ||
357 | TIMER_CALLBACK_MEMBER(mpu3_state::ic21_timeout) | |
357 | 358 | { |
358 | mpu3_state *state = machine.driver_data<mpu3_state>(); | |
359 | state->m_ic11_active=0; | |
360 | ic21_output(state,0); | |
359 | m_ic11_active=0; | |
360 | ic21_output(this,0); | |
361 | 361 | } |
362 | 362 | |
363 | 363 | READ8_MEMBER(mpu3_state::pia_ic3_porta_r) |
r18114 | r18115 | |
785 | 785 | static void mpu3_config_common(running_machine &machine) |
786 | 786 | { |
787 | 787 | mpu3_state *state = machine.driver_data<mpu3_state>(); |
788 | state->m_ic21_timer = machine.scheduler().timer_alloc(FUNC(ic21_timeout)); | |
788 | state->m_ic21_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(mpu3_state::ic21_timeout),state)); | |
789 | 789 | } |
790 | 790 | |
791 | 791 | void mpu3_state::machine_start() |
r18114 | r18115 | |
---|---|---|
267 | 267 | virtual void video_start(); |
268 | 268 | virtual void palette_init(); |
269 | 269 | UINT32 screen_update_peplus(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
270 | TIMER_CALLBACK_MEMBER(assert_lp_cb); | |
270 | 271 | }; |
271 | 272 | |
272 | 273 | static const UINT8 id_022[8] = { 0x00, 0x01, 0x04, 0x09, 0x13, 0x16, 0x18, 0x00 }; |
r18114 | r18115 | |
372 | 373 | /* Reset timing logic */ |
373 | 374 | } |
374 | 375 | |
375 | ||
376 | TIMER_CALLBACK_MEMBER(peplus_state::assert_lp_cb) | |
376 | 377 | { |
377 | 378 | downcast<mc6845_device *>((device_t*)ptr)->assert_light_pen_input(); |
378 | 379 | } |
379 | 380 | |
380 | 381 | static void handle_lightpen( device_t *device ) |
381 | 382 | { |
383 | peplus_state *state = device->machine().driver_data<peplus_state>(); | |
382 | 384 | int x_val = device->machine().root_device().ioport("TOUCH_X")->read_safe(0x00); |
383 | 385 | int y_val = device->machine().root_device().ioport("TOUCH_Y")->read_safe(0x00); |
384 | 386 | const rectangle &vis_area = device->machine().primary_screen->visible_area(); |
r18114 | r18115 | |
387 | 389 | xt = x_val * vis_area.width() / 1024 + vis_area.min_x; |
388 | 390 | yt = y_val * vis_area.height() / 1024 + vis_area.min_y; |
389 | 391 | |
390 | device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), FUNC(assert_lp_cb), 0, device); | |
392 | device->machine().scheduler().timer_set(device->machine().primary_screen->time_until_pos(yt, xt), timer_expired_delegate(FUNC(peplus_state::assert_lp_cb),state), 0, device); | |
391 | 393 | } |
392 | 394 | |
393 | 395 | WRITE_LINE_MEMBER(peplus_state::crtc_vsync) |
r18114 | r18115 | |
---|---|---|
82 | 82 | DECLARE_CUSTOM_INPUT_MEMBER(laserdisc_ready_r); |
83 | 83 | virtual void machine_start(); |
84 | 84 | virtual void machine_reset(); |
85 | TIMER_CALLBACK_MEMBER(intrq_tick); | |
86 | TIMER_CALLBACK_MEMBER(ssi263_phoneme_tick); | |
85 | 87 | }; |
86 | 88 | |
87 | 89 | |
r18114 | r18115 | |
106 | 108 | } |
107 | 109 | } |
108 | 110 | |
109 | ||
111 | TIMER_CALLBACK_MEMBER(thayers_state::intrq_tick) | |
110 | 112 | { |
111 | machine.device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); | |
113 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, CLEAR_LINE); | |
112 | 114 | } |
113 | 115 | |
114 | 116 | WRITE8_MEMBER(thayers_state::intrq_w) |
r18114 | r18115 | |
117 | 119 | |
118 | 120 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); |
119 | 121 | |
120 | machine().scheduler().timer_set(attotime::from_usec(8250), FUNC(intrq_tick)); | |
122 | machine().scheduler().timer_set(attotime::from_usec(8250), timer_expired_delegate(FUNC(thayers_state::intrq_tick),this)); | |
121 | 123 | } |
122 | 124 | |
123 | 125 | READ8_MEMBER(thayers_state::irqstate_r) |
r18114 | r18115 | |
470 | 472 | "L", "L1", "LF", "W", "B", "D", "KV", "P", "T", "K", "HV", "HVC", "HF", "HFC", "HN", "Z", "S", "J", "SCH", "V", "F", "THV", "TH", "M", "N", "NG", ":A", ":OH", ":U", ":UH", "E2", "LB" |
471 | 473 | }; |
472 | 474 | |
473 | ||
475 | TIMER_CALLBACK_MEMBER(thayers_state::ssi263_phoneme_tick) | |
474 | 476 | { |
475 | thayers_state *state = machine.driver_data<thayers_state>(); | |
476 | state->m_ssi_data_request = 0; | |
477 | check_interrupt(machine); | |
477 | m_ssi_data_request = 0; | |
478 | check_interrupt(machine()); | |
478 | 479 | } |
479 | 480 | |
480 | 481 | WRITE8_MEMBER(thayers_state::ssi263_register_w) |
r18114 | r18115 | |
499 | 500 | case 0: |
500 | 501 | case 1: |
501 | 502 | // phoneme timing response |
502 | machine().scheduler().timer_set(attotime::from_usec(phoneme_time), FUNC(ssi263_phoneme_tick)); | |
503 | machine().scheduler().timer_set(attotime::from_usec(phoneme_time), timer_expired_delegate(FUNC(thayers_state::ssi263_phoneme_tick),this)); | |
503 | 504 | break; |
504 | 505 | case 2: |
505 | 506 | // frame timing response |
506 | machine().scheduler().timer_set(attotime::from_usec(frame_time), FUNC(ssi263_phoneme_tick)); | |
507 | machine().scheduler().timer_set(attotime::from_usec(frame_time), timer_expired_delegate(FUNC(thayers_state::ssi263_phoneme_tick),this)); | |
507 | 508 | break; |
508 | 509 | case 3: |
509 | 510 | // disable A/_R output |
r18114 | r18115 | |
---|---|---|
255 | 255 | virtual void machine_start(); |
256 | 256 | virtual void machine_reset(); |
257 | 257 | UINT32 screen_update_nwktr(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
258 | TIMER_CALLBACK_MEMBER(irq_off); | |
258 | 259 | }; |
259 | 260 | |
260 | 261 | |
r18114 | r18115 | |
510 | 511 | |
511 | 512 | /*****************************************************************************/ |
512 | 513 | |
513 | ||
514 | TIMER_CALLBACK_MEMBER(nwktr_state::irq_off) | |
514 | 515 | { |
515 | machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
516 | machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
516 | 517 | } |
517 | 518 | |
518 | 519 | void nwktr_state::machine_start() |
r18114 | r18115 | |
523 | 524 | /* configure fast RAM regions for DRC */ |
524 | 525 | ppcdrc_add_fastram(machine().device("maincpu"), 0x00000000, 0x003fffff, FALSE, m_work_ram); |
525 | 526 | |
526 | m_sound_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_off)); | |
527 | m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(nwktr_state::irq_off),this)); | |
527 | 528 | } |
528 | 529 | |
529 | 530 | static ADDRESS_MAP_START( nwktr_map, AS_PROGRAM, 32, nwktr_state ) |
r18114 | r18115 | |
---|---|---|
1439 | 1439 | DECLARE_MACHINE_RESET(gmen); |
1440 | 1440 | UINT32 screen_update_ss23(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
1441 | 1441 | INTERRUPT_GEN_MEMBER(s23_interrupt); |
1442 | TIMER_CALLBACK_MEMBER(c361_timer_cb); | |
1442 | 1443 | }; |
1443 | 1444 | |
1444 | 1445 | |
r18114 | r18115 | |
1749 | 1750 | } |
1750 | 1751 | |
1751 | 1752 | // raster timer. TC2 indicates it's probably one-shot since it resets it each VBL... |
1752 | ||
1753 | TIMER_CALLBACK_MEMBER(namcos23_state::c361_timer_cb) | |
1753 | 1754 | { |
1754 | namcos23_state *state = machine.driver_data<namcos23_state>(); | |
1755 | c361_t &c361 = state->m_c361; | |
1755 | c361_t &c361 = m_c361; | |
1756 | 1756 | |
1757 | 1757 | if (c361.scanline != 511) |
1758 | 1758 | { |
1759 | machine.device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); | |
1759 | machine().device("maincpu")->execute().set_input_line(MIPS3_IRQ1, ASSERT_LINE); | |
1760 | 1760 | c361.timer->adjust(attotime::never); |
1761 | 1761 | } |
1762 | 1762 | } |
r18114 | r18115 | |
2452 | 2452 | MACHINE_START_MEMBER(namcos23_state,s23) |
2453 | 2453 | { |
2454 | 2454 | c361_t &c361 = m_c361; |
2455 | c361.timer = machine().scheduler().timer_alloc(FUNC(c361_timer_cb)); | |
2455 | c361.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(namcos23_state::c361_timer_cb),this)); | |
2456 | 2456 | c361.timer->adjust(attotime::never); |
2457 | 2457 | } |
2458 | 2458 |
r18114 | r18115 | |
---|---|---|
583 | 583 | DECLARE_DRIVER_INIT(ddrdigital); |
584 | 584 | DECLARE_DRIVER_INIT(konami573); |
585 | 585 | DECLARE_MACHINE_RESET(konami573); |
586 | TIMER_CALLBACK_MEMBER(atapi_xfer_end); | |
586 | 587 | }; |
587 | 588 | |
588 | 589 | INLINE void ATTR_PRINTF(3,4) verboselog( running_machine &machine, int n_level, const char *s_fmt, ... ) |
r18114 | r18115 | |
693 | 694 | } |
694 | 695 | } |
695 | 696 | |
696 | ||
697 | TIMER_CALLBACK_MEMBER(ksys573_state::atapi_xfer_end) | |
697 | 698 | { |
698 | ksys573_state *state = machine.driver_data<ksys573_state>(); | |
699 | UINT32 *p_n_psxram = state->m_p_n_psxram; | |
700 | UINT8 *atapi_regs = state->m_atapi_regs; | |
701 | int i, n_this; | |
699 | UINT32 *p_n_psxram = m_p_n_psxram; | |
700 | UINT8 *atapi_regs = m_atapi_regs; | |
701 | int i, n_state; | |
702 | 702 | UINT8 sector_buffer[ 4096 ]; |
703 | 703 | |
704 | | |
704 | m_atapi_timer->adjust(attotime::never); | |
705 | 705 | |
706 | // verboselog( machine, 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen ); | |
706 | // verboselog( machine(), 2, "atapi_xfer_end( %d ) atapi_xferlen = %d, atapi_xfermod=%d\n", x, atapi_xfermod, atapi_xferlen ); | |
707 | 707 | |
708 | 708 | // mame_printf_debug("ATAPI: xfer_end. xferlen = %d, atapi_xfermod = %d\n", atapi_xferlen, atapi_xfermod); |
709 | 709 | |
710 | while( | |
710 | while( m_atapi_xferlen > 0 ) | |
711 | 711 | { |
712 | 712 | // get a sector from the SCSI device |
713 | | |
713 | m_inserted_cdrom->ReadData( sector_buffer, 2048 ); | |
714 | 714 | |
715 | | |
715 | m_atapi_xferlen -= 2048; | |
716 | 716 | |
717 | 717 | i = 0; |
718 | n_this = 2048 / 4; | |
719 | while( n_this > 0 ) | |
718 | n_state = 2048 / 4; | |
719 | while( n_state > 0 ) | |
720 | 720 | { |
721 | p_n_psxram[ | |
721 | p_n_psxram[ m_atapi_xferbase / 4 ] = | |
722 | 722 | ( sector_buffer[ i + 0 ] << 0 ) | |
723 | 723 | ( sector_buffer[ i + 1 ] << 8 ) | |
724 | 724 | ( sector_buffer[ i + 2 ] << 16 ) | |
725 | 725 | ( sector_buffer[ i + 3 ] << 24 ); |
726 | | |
726 | m_atapi_xferbase += 4; | |
727 | 727 | i += 4; |
728 | n_ | |
728 | n_state--; | |
729 | 729 | } |
730 | 730 | } |
731 | 731 | |
732 | if ( | |
732 | if (m_atapi_xfermod > MAX_TRANSFER_SIZE) | |
733 | 733 | { |
734 | state->m_atapi_xferlen = MAX_TRANSFER_SIZE; | |
735 | state->m_atapi_xfermod = state->m_atapi_xfermod - MAX_TRANSFER_SIZE; | |
734 | m_atapi_xferlen = MAX_TRANSFER_SIZE; | |
735 | m_atapi_xfermod = m_atapi_xfermod - MAX_TRANSFER_SIZE; | |
736 | 736 | } |
737 | 737 | else |
738 | 738 | { |
739 | state->m_atapi_xferlen = state->m_atapi_xfermod; | |
740 | state->m_atapi_xfermod = 0; | |
739 | m_atapi_xferlen = m_atapi_xfermod; | |
740 | m_atapi_xfermod = 0; | |
741 | 741 | } |
742 | 742 | |
743 | 743 | |
744 | if ( | |
744 | if (m_atapi_xferlen > 0) | |
745 | 745 | { |
746 | 746 | //mame_printf_debug("ATAPI: starting next piece of multi-part transfer\n"); |
747 | atapi_regs[ATAPI_REG_COUNTLOW] = state->m_atapi_xferlen & 0xff; | |
748 | atapi_regs[ATAPI_REG_COUNTHIGH] = (state->m_atapi_xferlen>>8)&0xff; | |
747 | atapi_regs[ATAPI_REG_COUNTLOW] = m_atapi_xferlen & 0xff; | |
748 | atapi_regs[ATAPI_REG_COUNTHIGH] = (m_atapi_xferlen>>8)&0xff; | |
749 | 749 | |
750 | | |
750 | m_atapi_timer->adjust(machine().device<cpu_device>("maincpu")->cycles_to_attotime((ATAPI_CYCLES_PER_SECTOR * (m_atapi_xferlen/2048)))); | |
751 | 751 | } |
752 | 752 | else |
753 | 753 | { |
r18114 | r18115 | |
756 | 756 | atapi_regs[ATAPI_REG_INTREASON] = ATAPI_INTREASON_IO | ATAPI_INTREASON_COMMAND; |
757 | 757 | } |
758 | 758 | |
759 | psx_irq_set(machine, 0x400); | |
759 | psx_irq_set(machine(), 0x400); | |
760 | 760 | |
761 | verboselog( machine, 2, "atapi_xfer_end: %d %d\n", | |
761 | verboselog( machine(), 2, "atapi_xfer_end: %d %d\n", m_atapi_xferlen, m_atapi_xfermod ); | |
762 | 762 | } |
763 | 763 | |
764 | 764 | READ32_MEMBER(ksys573_state::atapi_r) |
r18114 | r18115 | |
1131 | 1131 | state->m_atapi_data_len = 0; |
1132 | 1132 | state->m_atapi_cdata_wait = 0; |
1133 | 1133 | |
1134 | state->m_atapi_timer = machine.scheduler().timer_alloc(FUNC(atapi_xfer_end)); | |
1134 | state->m_atapi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ksys573_state::atapi_xfer_end),state)); | |
1135 | 1135 | state->m_atapi_timer->adjust(attotime::never); |
1136 | 1136 | |
1137 | 1137 | state->m_available_cdroms[ 0 ] = machine.device<scsidev_device>( ":cdrom0" ); |
r18114 | r18115 | |
---|---|---|
67 | 67 | virtual void machine_reset(); |
68 | 68 | virtual void video_start(); |
69 | 69 | UINT32 screen_update_sbrkout(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
70 | TIMER_CALLBACK_MEMBER(scanline_callback); | |
71 | TIMER_CALLBACK_MEMBER(pot_trigger_callback); | |
70 | 72 | }; |
71 | 73 | |
72 | 74 | |
r18114 | r18115 | |
89 | 91 | * |
90 | 92 | *************************************/ |
91 | 93 | |
92 | static TIMER_CALLBACK( scanline_callback ); | |
93 | static TIMER_CALLBACK( pot_trigger_callback ); | |
94 | 94 | |
95 | 95 | |
96 | 96 | |
97 | ||
98 | ||
97 | 99 | /************************************* |
98 | 100 | * |
99 | 101 | * Machine setup |
r18114 | r18115 | |
104 | 106 | { |
105 | 107 | UINT8 *videoram = m_videoram; |
106 | 108 | membank("bank1")->set_base(&videoram[0x380]); |
107 | m_scanline_timer = machine().scheduler().timer_alloc(FUNC(scanline_callback)); | |
108 | m_pot_timer = machine().scheduler().timer_alloc(FUNC(pot_trigger_callback)); | |
109 | m_scanline_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::scanline_callback),this)); | |
110 | m_pot_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sbrkout_state::pot_trigger_callback),this)); | |
109 | 111 | |
110 | 112 | save_item(NAME(m_sync2_value)); |
111 | 113 | save_item(NAME(m_pot_mask)); |
r18114 | r18115 | |
126 | 128 | * |
127 | 129 | *************************************/ |
128 | 130 | |
129 | ||
131 | TIMER_CALLBACK_MEMBER(sbrkout_state::scanline_callback) | |
130 | 132 | { |
131 | sbrkout_state *state = machine.driver_data<sbrkout_state>(); | |
132 | UINT8 *videoram = state->m_videoram; | |
133 | UINT8 *videoram = m_videoram; | |
133 | 134 | int scanline = param; |
134 | 135 | |
135 | 136 | /* force a partial update before anything happens */ |
136 | machine.primary_screen->update_partial(scanline); | |
137 | machine().primary_screen->update_partial(scanline); | |
137 | 138 | |
138 | 139 | /* if this is a rising edge of 16V, assert the CPU interrupt */ |
139 | 140 | if (scanline % 32 == 16) |
140 | machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
141 | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
141 | 142 | |
142 | 143 | /* update the DAC state */ |
143 | machine.device<dac_device>("dac")->write_unsigned8((videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0); | |
144 | machine().device<dac_device>("dac")->write_unsigned8((videoram[0x380 + 0x11] & (scanline >> 2)) ? 255 : 0); | |
144 | 145 | |
145 | 146 | /* on the VBLANK, read the pot and schedule an interrupt time for it */ |
146 | if (scanline == machine.primary_screen->visible_area().max_y + 1) | |
147 | if (scanline == machine().primary_screen->visible_area().max_y + 1) | |
147 | 148 | { |
148 | UINT8 potvalue = state->ioport("PADDLE")->read(); | |
149 | state->m_pot_timer->adjust(machine.primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128)); | |
149 | UINT8 potvalue = ioport("PADDLE")->read(); | |
150 | m_pot_timer->adjust(machine().primary_screen->time_until_pos(56 + (potvalue / 2), (potvalue % 2) * 128)); | |
150 | 151 | } |
151 | 152 | |
152 | 153 | /* call us back in 4 scanlines */ |
153 | 154 | scanline += 4; |
154 | if (scanline >= machine.primary_screen->height()) | |
155 | if (scanline >= machine().primary_screen->height()) | |
155 | 156 | scanline = 0; |
156 | | |
157 | m_scanline_timer->adjust(machine().primary_screen->time_until_pos(scanline), scanline); | |
157 | 158 | } |
158 | 159 | |
159 | 160 | |
r18114 | r18115 | |
210 | 211 | } |
211 | 212 | |
212 | 213 | |
213 | ||
214 | TIMER_CALLBACK_MEMBER(sbrkout_state::pot_trigger_callback) | |
214 | 215 | { |
215 | sbrkout_state *state = machine.driver_data<sbrkout_state>(); | |
216 | state->m_pot_trigger[param] = 1; | |
217 | update_nmi_state(machine); | |
216 | m_pot_trigger[param] = 1; | |
217 | update_nmi_state(machine()); | |
218 | 218 | } |
219 | 219 | |
220 | 220 |
r18114 | r18115 | |
---|---|---|
146 | 146 | DECLARE_DRIVER_INIT(aces1); |
147 | 147 | virtual void machine_start(); |
148 | 148 | virtual void machine_reset(); |
149 | TIMER_CALLBACK_MEMBER(m_aces1_irq_timer_callback); | |
150 | TIMER_CALLBACK_MEMBER(m_aces1_nmi_timer_callback); | |
149 | 151 | }; |
150 | 152 | |
151 | 153 | |
152 | 154 | |
153 | 155 | |
154 | 156 | |
155 | ||
157 | TIMER_CALLBACK_MEMBER(aces1_state::m_aces1_irq_timer_callback) | |
156 | 158 | { |
157 | aces1_state *state = machine.driver_data<aces1_state>(); | |
158 | 159 | // printf("irq\n"); |
159 | state->m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); | |
160 | state->aces1_reset_irq_timer(); | |
160 | m_maincpu->set_input_line(INPUT_LINE_IRQ0, HOLD_LINE); | |
161 | aces1_reset_irq_timer(); | |
161 | 162 | } |
162 | 163 | |
163 | ||
164 | TIMER_CALLBACK_MEMBER(aces1_state::m_aces1_nmi_timer_callback) | |
164 | 165 | { |
165 | aces1_state *state = machine.driver_data<aces1_state>(); | |
166 | 166 | // printf("nmi\n"); |
167 | state->m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
168 | state->aces1_reset_nmi_timer(); | |
167 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
168 | aces1_reset_nmi_timer(); | |
169 | 169 | } |
170 | 170 | |
171 | 171 | static void aces1_create_timers(running_machine &machine) |
172 | 172 | { |
173 | 173 | aces1_state *state = machine.driver_data<aces1_state>(); |
174 | 174 | |
175 | state->m_aces1_irq_timer = machine.scheduler().timer_alloc(FUNC(m_aces1_irq_timer_callback), 0); | |
176 | state->m_aces1_nmi_timer = machine.scheduler().timer_alloc(FUNC(m_aces1_nmi_timer_callback), 0); | |
175 | state->m_aces1_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_irq_timer_callback),state), 0); | |
176 | state->m_aces1_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(aces1_state::m_aces1_nmi_timer_callback),state), 0); | |
177 | 177 | } |
178 | 178 | |
179 | 179 | void aces1_state::machine_start() |
r18114 | r18115 | |
---|---|---|
61 | 61 | virtual void machine_reset(); |
62 | 62 | virtual void video_start(); |
63 | 63 | UINT32 screen_update_mjsister(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
64 | TIMER_CALLBACK_MEMBER(dac_callback); | |
64 | 65 | }; |
65 | 66 | |
66 | 67 | |
r18114 | r18115 | |
165 | 166 | * |
166 | 167 | *************************************/ |
167 | 168 | |
168 | ||
169 | TIMER_CALLBACK_MEMBER(mjsister_state::dac_callback) | |
169 | 170 | { |
170 | mjsister_state *state = machine.driver_data<mjsister_state>(); | |
171 | UINT8 *DACROM = state->memregion("samples")->base(); | |
171 | UINT8 *DACROM = memregion("samples")->base(); | |
172 | 172 | |
173 | | |
173 | m_dac->write_unsigned8(DACROM[(m_dac_bank * 0x10000 + m_dac_adr++) & 0x1ffff]); | |
174 | 174 | |
175 | if (((state->m_dac_adr & 0xff00 ) >> 8) != state->m_dac_adr_e) | |
176 | machine.scheduler().timer_set(attotime::from_hz(MCLK) * 1024, FUNC(dac_callback)); | |
175 | if (((m_dac_adr & 0xff00 ) >> 8) != m_dac_adr_e) | |
176 | machine().scheduler().timer_set(attotime::from_hz(MCLK) * 1024, timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); | |
177 | 177 | else |
178 | | |
178 | m_dac_busy = 0; | |
179 | 179 | } |
180 | 180 | |
181 | 181 | WRITE8_MEMBER(mjsister_state::mjsister_dac_adr_s_w) |
r18114 | r18115 | |
189 | 189 | m_dac_adr = m_dac_adr_s << 8; |
190 | 190 | |
191 | 191 | if (m_dac_busy == 0) |
192 | machine().scheduler().synchronize(FUNC(dac_callback)); | |
192 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(mjsister_state::dac_callback),this)); | |
193 | 193 | |
194 | 194 | m_dac_busy = 1; |
195 | 195 | } |
r18114 | r18115 | |
---|---|---|
502 | 502 | virtual void machine_start(); |
503 | 503 | virtual void machine_reset(); |
504 | 504 | UINT32 screen_update_vegas(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
505 | TIMER_CALLBACK_MEMBER(nile_timer_callback); | |
505 | 506 | }; |
506 | 507 | |
507 | 508 | |
r18114 | r18115 | |
512 | 513 | * |
513 | 514 | *************************************/ |
514 | 515 | |
515 | ||
516 | ||
516 | 517 | static void ide_interrupt(device_t *device, int state); |
517 | 518 | static void remap_dynamic_addresses(running_machine &machine); |
518 | 519 | |
r18114 | r18115 | |
543 | 544 | /* allocate timers for the NILE */ |
544 | 545 | m_timer[0] = machine().scheduler().timer_alloc(FUNC_NULL); |
545 | 546 | m_timer[1] = machine().scheduler().timer_alloc(FUNC_NULL); |
546 | m_timer[2] = machine().scheduler().timer_alloc(FUNC(nile_timer_callback)); | |
547 | m_timer[3] = machine().scheduler().timer_alloc(FUNC(nile_timer_callback)); | |
547 | m_timer[2] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); | |
548 | m_timer[3] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vegas_state::nile_timer_callback),this)); | |
548 | 549 | |
549 | 550 | /* identify our sound board */ |
550 | 551 | if (machine().device("dsio") != NULL) |
r18114 | r18115 | |
918 | 919 | } |
919 | 920 | |
920 | 921 | |
921 | ||
922 | TIMER_CALLBACK_MEMBER(vegas_state::nile_timer_callback) | |
922 | 923 | { |
923 | vegas_state *state = machine.driver_data<vegas_state>(); | |
924 | 924 | int which = param; |
925 | UINT32 *regs = & | |
925 | UINT32 *regs = &m_nile_regs[NREG_T0CTRL + which * 4]; | |
926 | 926 | if (LOG_TIMERS) logerror("timer %d fired\n", which); |
927 | 927 | |
928 | 928 | /* adjust the timer to fire again */ |
r18114 | r18115 | |
931 | 931 | if (regs[1] & 2) |
932 | 932 | logerror("Unexpected value: timer %d is prescaled\n", which); |
933 | 933 | if (scale != 0) |
934 | | |
934 | m_timer[which]->adjust(TIMER_PERIOD * scale, which); | |
935 | 935 | } |
936 | 936 | |
937 | 937 | /* trigger the interrupt */ |
938 | 938 | if (which == 2) |
939 | | |
939 | m_nile_irq_state |= 1 << 6; | |
940 | 940 | if (which == 3) |
941 | | |
941 | m_nile_irq_state |= 1 << 5; | |
942 | 942 | |
943 | update_nile_irqs(machine); | |
943 | update_nile_irqs(machine()); | |
944 | 944 | } |
945 | 945 | |
946 | 946 |
r18114 | r18115 | |
---|---|---|
139 | 139 | virtual void video_start(); |
140 | 140 | UINT32 screen_update_rabbit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
141 | 141 | INTERRUPT_GEN_MEMBER(rabbit_vblank_interrupt); |
142 | TIMER_CALLBACK_MEMBER(rabbit_blit_done); | |
142 | 143 | }; |
143 | 144 | |
144 | 145 | |
r18114 | r18115 | |
558 | 559 | #define BLITCMDLOG 0 |
559 | 560 | #define BLITLOG 0 |
560 | 561 | |
561 | ||
562 | TIMER_CALLBACK_MEMBER(rabbit_state::rabbit_blit_done) | |
562 | 563 | { |
563 | rabbit_state *state = machine.driver_data<rabbit_state>(); | |
564 | machine.device("maincpu")->execute().set_input_line(state->m_bltirqlevel, HOLD_LINE); | |
564 | machine().device("maincpu")->execute().set_input_line(m_bltirqlevel, HOLD_LINE); | |
565 | 565 | } |
566 | 566 | |
567 | 567 | static void rabbit_do_blit(running_machine &machine) |
r18114 | r18115 | |
609 | 609 | if (!blt_amount) |
610 | 610 | { |
611 | 611 | if(BLITLOG) mame_printf_debug("end of blit list\n"); |
612 | machine.scheduler().timer_set(attotime::from_usec(500), FUNC(rabbit_blit_done)); | |
612 | machine.scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(rabbit_state::rabbit_blit_done),state)); | |
613 | 613 | return; |
614 | 614 | } |
615 | 615 |
r18114 | r18115 | |
---|---|---|
388 | 388 | DECLARE_DRIVER_INIT(coh3002t_mp); |
389 | 389 | DECLARE_DRIVER_INIT(coh3002t); |
390 | 390 | DECLARE_MACHINE_RESET(coh3002t); |
391 | TIMER_CALLBACK_MEMBER(dip_timer_fired); | |
391 | 392 | }; |
392 | 393 | |
393 | 394 | |
r18114 | r18115 | |
782 | 783 | } |
783 | 784 | } |
784 | 785 | |
785 | ||
786 | TIMER_CALLBACK_MEMBER(taitogn_state::dip_timer_fired) | |
786 | 787 | { |
787 | taitogn_state *state = machine.driver_data<taitogn_state>(); | |
788 | 788 | |
789 | psx_sio_input( machine, 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); | |
789 | psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, param * PSX_SIO_IN_DSR ); | |
790 | 790 | |
791 | 791 | if( param ) |
792 | 792 | { |
793 | | |
793 | m_dip_timer->adjust(machine().device<cpu_device>("maincpu")->cycles_to_attotime(50)); | |
794 | 794 | } |
795 | 795 | } |
796 | 796 | |
r18114 | r18115 | |
868 | 868 | znsec_init(0, tt10); |
869 | 869 | znsec_init(1, tt16); |
870 | 870 | psx_sio_install_handler(machine(), 0, sio_pad_handler); |
871 | m_dip_timer = machine().scheduler().timer_alloc( FUNC(dip_timer_fired), NULL ); | |
871 | m_dip_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(taitogn_state::dip_timer_fired),this), NULL ); | |
872 | 872 | |
873 | 873 | UINT32 metalength; |
874 | 874 | memset(m_cis, 0xff, 512); |
r18114 | r18115 | |
---|---|---|
248 | 248 | virtual void machine_reset(); |
249 | 249 | UINT32 screen_update_ssfindo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
250 | 250 | INTERRUPT_GEN_MEMBER(ssfindo_interrupt); |
251 | TIMER_CALLBACK_MEMBER(PS7500_Timer0_callback); | |
252 | TIMER_CALLBACK_MEMBER(PS7500_Timer1_callback); | |
251 | 253 | }; |
252 | 254 | |
253 | 255 | |
r18114 | r18115 | |
290 | 292 | m_PS7500_FIFO[1]++; //autoinc |
291 | 293 | } |
292 | 294 | } |
293 | ||
295 | TIMER_CALLBACK_MEMBER(ssfindo_state::PS7500_Timer0_callback) | |
294 | 296 | { |
295 | ssfindo_state *state = machine.driver_data<ssfindo_state>(); | |
296 | state->m_PS7500_IO[IRQSTA]|=0x20; | |
297 | if(state->m_PS7500_IO[IRQMSKA]&0x20) | |
297 | m_PS7500_IO[IRQSTA]|=0x20; | |
298 | if(m_PS7500_IO[IRQMSKA]&0x20) | |
298 | 299 | { |
299 | generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE, 1); | |
300 | generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE, 1); | |
300 | 301 | } |
301 | 302 | } |
302 | 303 | |
r18114 | r18115 | |
311 | 312 | state->m_PS7500timer0->adjust(attotime::from_usec(val ), 0, attotime::from_usec(val )); |
312 | 313 | } |
313 | 314 | |
314 | ||
315 | TIMER_CALLBACK_MEMBER(ssfindo_state::PS7500_Timer1_callback) | |
315 | 316 | { |
316 | ssfindo_state *state = machine.driver_data<ssfindo_state>(); | |
317 | state->m_PS7500_IO[IRQSTA]|=0x40; | |
318 | if(state->m_PS7500_IO[IRQMSKA]&0x40) | |
317 | m_PS7500_IO[IRQSTA]|=0x40; | |
318 | if(m_PS7500_IO[IRQMSKA]&0x40) | |
319 | 319 | { |
320 | generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE, 1); | |
320 | generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE, 1); | |
321 | 321 | } |
322 | 322 | } |
323 | 323 | |
r18114 | r18115 | |
857 | 857 | DRIVER_INIT_MEMBER(ssfindo_state,common) |
858 | 858 | { |
859 | 859 | ssfindo_speedup = 0; |
860 | m_PS7500timer0 = machine().scheduler().timer_alloc(FUNC(PS7500_Timer0_callback)); | |
861 | m_PS7500timer1 = machine().scheduler().timer_alloc(FUNC(PS7500_Timer1_callback)); | |
860 | m_PS7500timer0 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer0_callback),this)); | |
861 | m_PS7500timer1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ssfindo_state::PS7500_Timer1_callback),this)); | |
862 | 862 | |
863 | 863 | } |
864 | 864 |
r18114 | r18115 | |
---|---|---|
371 | 371 | DECLARE_MACHINE_RESET(hornet_2board); |
372 | 372 | UINT32 screen_update_hornet(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
373 | 373 | UINT32 screen_update_hornet_2board(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
374 | TIMER_CALLBACK_MEMBER(irq_off); | |
374 | 375 | }; |
375 | 376 | |
376 | 377 | |
r18114 | r18115 | |
880 | 881 | NMI: SCI |
881 | 882 | |
882 | 883 | */ |
883 | static TIMER_CALLBACK( irq_off ); | |
884 | 884 | |
885 | ||
885 | 886 | void hornet_state::machine_start() |
886 | 887 | { |
887 | 888 | m_jvs_sdata_ptr = 0; |
r18114 | r18115 | |
898 | 899 | state_save_register_global_pointer(machine(), m_jvs_sdata, 1024); |
899 | 900 | state_save_register_global(machine(), m_jvs_sdata_ptr); |
900 | 901 | |
901 | m_sound_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_off)); | |
902 | m_sound_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hornet_state::irq_off),this)); | |
902 | 903 | } |
903 | 904 | |
904 | 905 | void hornet_state::machine_reset() |
r18114 | r18115 | |
933 | 934 | adc12138_input_callback |
934 | 935 | }; |
935 | 936 | |
936 | ||
937 | TIMER_CALLBACK_MEMBER(hornet_state::irq_off) | |
937 | 938 | { |
938 | machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
939 | machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
939 | 940 | } |
940 | 941 | |
941 | 942 | static void sound_irq_callback( running_machine &machine, int irq ) |
r18114 | r18115 | |
---|---|---|
73 | 73 | virtual void machine_start(); |
74 | 74 | UINT32 screen_update_gpworld(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
75 | 75 | INTERRUPT_GEN_MEMBER(vblank_callback_gpworld); |
76 | TIMER_CALLBACK_MEMBER(irq_stop); | |
76 | 77 | }; |
77 | 78 | |
78 | 79 | |
r18114 | r18115 | |
425 | 426 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
426 | 427 | INPUT_PORTS_END |
427 | 428 | |
428 | ||
429 | TIMER_CALLBACK_MEMBER(gpworld_state::irq_stop) | |
429 | 430 | { |
430 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
431 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
431 | 432 | } |
432 | 433 | |
433 | 434 | INTERRUPT_GEN_MEMBER(gpworld_state::vblank_callback_gpworld) |
r18114 | r18115 | |
442 | 443 | |
443 | 444 | /* The time the IRQ line stays high is set just long enough to happen after the NMI - hacky? */ |
444 | 445 | device.execute().set_input_line(0, ASSERT_LINE); |
445 | machine().scheduler().timer_set(attotime::from_usec(100), FUNC(irq_stop)); | |
446 | machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(gpworld_state::irq_stop),this)); | |
446 | 447 | } |
447 | 448 | |
448 | 449 | static const gfx_layout gpworld_tile_layout = |
r18114 | r18115 | |
---|---|---|
107 | 107 | DECLARE_MACHINE_START(jpmsys5); |
108 | 108 | DECLARE_MACHINE_RESET(jpmsys5); |
109 | 109 | UINT32 screen_update_jpmsys5v(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
110 | TIMER_CALLBACK_MEMBER(touch_cb); | |
110 | 111 | }; |
111 | 112 | |
112 | 113 | |
r18114 | r18115 | |
409 | 410 | *************************************/ |
410 | 411 | |
411 | 412 | /* Serial bit transmission callback */ |
412 | ||
413 | TIMER_CALLBACK_MEMBER(jpmsys5_state::touch_cb) | |
413 | 414 | { |
414 | jpmsys5_state *state = machine.driver_data<jpmsys5_state>(); | |
415 | switch (state->m_touch_state) | |
415 | switch (m_touch_state) | |
416 | 416 | { |
417 | 417 | case IDLE: |
418 | 418 | { |
r18114 | r18115 | |
420 | 420 | } |
421 | 421 | case START: |
422 | 422 | { |
423 | state->m_touch_shift_cnt = 0; | |
424 | state->m_a2_data_in = 0; | |
425 | state->m_touch_state = DATA; | |
423 | m_touch_shift_cnt = 0; | |
424 | m_a2_data_in = 0; | |
425 | m_touch_state = DATA; | |
426 | 426 | break; |
427 | 427 | } |
428 | 428 | case DATA: |
429 | 429 | { |
430 | | |
430 | m_a2_data_in = (m_touch_data[m_touch_data_count] >> (m_touch_shift_cnt)) & 1; | |
431 | 431 | |
432 | if (++state->m_touch_shift_cnt == 8) | |
433 | state->m_touch_state = STOP1; | |
432 | if (++m_touch_shift_cnt == 8) | |
433 | m_touch_state = STOP1; | |
434 | 434 | |
435 | 435 | break; |
436 | 436 | } |
437 | 437 | case STOP1: |
438 | 438 | { |
439 | state->m_a2_data_in = 1; | |
440 | state->m_touch_state = STOP2; | |
439 | m_a2_data_in = 1; | |
440 | m_touch_state = STOP2; | |
441 | 441 | break; |
442 | 442 | } |
443 | 443 | case STOP2: |
444 | 444 | { |
445 | | |
445 | m_a2_data_in = 1; | |
446 | 446 | |
447 | if (++ | |
447 | if (++m_touch_data_count == 3) | |
448 | 448 | { |
449 | state->m_touch_timer->reset(); | |
450 | state->m_touch_state = IDLE; | |
449 | m_touch_timer->reset(); | |
450 | m_touch_state = IDLE; | |
451 | 451 | } |
452 | 452 | else |
453 | 453 | { |
454 | | |
454 | m_touch_state = START; | |
455 | 455 | } |
456 | 456 | |
457 | 457 | break; |
r18114 | r18115 | |
690 | 690 | MACHINE_START_MEMBER(jpmsys5_state,jpmsys5v) |
691 | 691 | { |
692 | 692 | membank("bank1")->set_base(memregion("maincpu")->base()+0x20000); |
693 | m_touch_timer = machine().scheduler().timer_alloc(FUNC(touch_cb)); | |
693 | m_touch_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jpmsys5_state::touch_cb),this)); | |
694 | 694 | } |
695 | 695 | |
696 | 696 | MACHINE_RESET_MEMBER(jpmsys5_state,jpmsys5v) |
r18114 | r18115 | |
---|---|---|
51 | 51 | virtual void palette_init(); |
52 | 52 | UINT32 screen_update_esh(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
53 | 53 | INTERRUPT_GEN_MEMBER(vblank_callback_esh); |
54 | TIMER_CALLBACK_MEMBER(irq_stop); | |
54 | 55 | }; |
55 | 56 | |
56 | 57 | |
r18114 | r18115 | |
279 | 280 | GFXDECODE_ENTRY("gfx1", 0, esh_gfx_layout, 0x0, 0x20) |
280 | 281 | GFXDECODE_END |
281 | 282 | |
282 | ||
283 | TIMER_CALLBACK_MEMBER(esh_state::irq_stop) | |
283 | 284 | { |
284 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
285 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
285 | 286 | } |
286 | 287 | |
287 | 288 | INTERRUPT_GEN_MEMBER(esh_state::vblank_callback_esh) |
288 | 289 | { |
289 | 290 | // IRQ |
290 | 291 | device.execute().set_input_line(0, ASSERT_LINE); |
291 | machine().scheduler().timer_set(attotime::from_usec(50), FUNC(irq_stop)); | |
292 | machine().scheduler().timer_set(attotime::from_usec(50), timer_expired_delegate(FUNC(esh_state::irq_stop),this)); | |
292 | 293 | } |
293 | 294 | |
294 | 295 | void esh_state::machine_start() |
r18114 | r18115 | |
---|---|---|
322 | 322 | virtual void palette_init(); |
323 | 323 | DECLARE_PALETTE_INIT(lions); |
324 | 324 | UINT32 screen_update_aristmk4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
325 | TIMER_CALLBACK_MEMBER(note_input_reset); | |
326 | TIMER_CALLBACK_MEMBER(coin_input_reset); | |
327 | TIMER_CALLBACK_MEMBER(hopper_reset); | |
325 | 328 | }; |
326 | 329 | |
327 | 330 | /* Partial Cashcade protocol */ |
r18114 | r18115 | |
484 | 487 | |
485 | 488 | } |
486 | 489 | |
487 | ||
490 | TIMER_CALLBACK_MEMBER(aristmk4_state::note_input_reset) | |
488 | 491 | { |
489 | aristmk4_state *state = machine.driver_data<aristmk4_state>(); | |
490 | state->m_insnote=0; //reset note input after 150msec | |
492 | m_insnote=0; //reset note input after 150msec | |
491 | 493 | } |
492 | 494 | |
493 | 495 | READ8_MEMBER(aristmk4_state::bv_p0) |
r18114 | r18115 | |
504 | 506 | case 0x02: |
505 | 507 | bv_p0_ret=0x89; |
506 | 508 | m_insnote++; |
507 | machine().scheduler().timer_set(attotime::from_msec(150), FUNC(note_input_reset)); | |
509 | machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::note_input_reset),this)); | |
508 | 510 | break; |
509 | 511 | default: |
510 | 512 | break; //timer will reset the input |
r18114 | r18115 | |
630 | 632 | |
631 | 633 | ******************************************************************************/ |
632 | 634 | |
633 | ||
635 | TIMER_CALLBACK_MEMBER(aristmk4_state::coin_input_reset) | |
634 | 636 | { |
635 | aristmk4_state *state = machine.driver_data<aristmk4_state>(); | |
636 | state->m_inscrd=0; //reset credit input after 150msec | |
637 | m_inscrd=0; //reset credit input after 150msec | |
637 | 638 | } |
638 | 639 | |
639 | ||
640 | TIMER_CALLBACK_MEMBER(aristmk4_state::hopper_reset) | |
640 | 641 | { |
641 | aristmk4_state *state = machine.driver_data<aristmk4_state>(); | |
642 | state->m_hopper_motor=0x01; | |
642 | m_hopper_motor=0x01; | |
643 | 643 | } |
644 | 644 | |
645 | 645 | // Port A read (SW1) |
r18114 | r18115 | |
686 | 686 | case 0x02: |
687 | 687 | ret=ret^0x20; |
688 | 688 | m_inscrd++; |
689 | machine().scheduler().timer_set(attotime::from_msec(150), FUNC(coin_input_reset)); | |
689 | machine().scheduler().timer_set(attotime::from_msec(150), timer_expired_delegate(FUNC(aristmk4_state::coin_input_reset),this)); | |
690 | 690 | break; |
691 | 691 | default: |
692 | 692 | break; //timer will reset the input |
r18114 | r18115 | |
698 | 698 | { |
699 | 699 | case 0x00: |
700 | 700 | ret=ret^0x40; |
701 | machine().scheduler().timer_set(attotime::from_msec(175), FUNC(hopper_reset)); | |
701 | machine().scheduler().timer_set(attotime::from_msec(175), timer_expired_delegate(FUNC(aristmk4_state::hopper_reset),this)); | |
702 | 702 | m_hopper_motor=0x02; |
703 | 703 | break; |
704 | 704 | case 0x01: |
r18114 | r18115 | |
---|---|---|
66 | 66 | DECLARE_READ8_MEMBER(subcpu_status_r); |
67 | 67 | DECLARE_WRITE8_MEMBER(msm_cfg_w); |
68 | 68 | virtual void machine_reset(); |
69 | TIMER_CALLBACK_MEMBER(subcpu_suspend); | |
70 | TIMER_CALLBACK_MEMBER(subcpu_resume); | |
69 | 71 | }; |
70 | 72 | |
71 | 73 | |
r18114 | r18115 | |
94 | 96 | membank("bank1")->set_base(&RAM[bank*0x4000+0x10000]); |
95 | 97 | } |
96 | 98 | |
97 | ||
99 | TIMER_CALLBACK_MEMBER(sothello_state::subcpu_suspend) | |
98 | 100 | { |
99 | machine.device<cpu_device>("sub")->suspend(SUSPEND_REASON_HALT, 1); | |
101 | machine().device<cpu_device>("sub")->suspend(SUSPEND_REASON_HALT, 1); | |
100 | 102 | } |
101 | 103 | |
102 | ||
104 | TIMER_CALLBACK_MEMBER(sothello_state::subcpu_resume) | |
103 | 105 | { |
104 | machine.device<cpu_device>("sub")->resume(SUSPEND_REASON_HALT); | |
105 | machine.device("sub")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
106 | machine().device<cpu_device>("sub")->resume(SUSPEND_REASON_HALT); | |
107 | machine().device("sub")->execute().set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
106 | 108 | } |
107 | 109 | |
108 | 110 | READ8_MEMBER(sothello_state::subcpu_halt_set) |
109 | 111 | { |
110 | machine().scheduler().synchronize(FUNC(subcpu_suspend)); | |
112 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(sothello_state::subcpu_suspend),this)); | |
111 | 113 | m_subcpu_status|=2; |
112 | 114 | return 0; |
113 | 115 | } |
114 | 116 | |
115 | 117 | READ8_MEMBER(sothello_state::subcpu_halt_clear) |
116 | 118 | { |
117 | machine().scheduler().synchronize(FUNC(subcpu_resume)); | |
119 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(sothello_state::subcpu_resume),this)); | |
118 | 120 | m_subcpu_status&=~1; |
119 | 121 | m_subcpu_status&=~2; |
120 | 122 | return 0; |
r18114 | r18115 | |
---|---|---|
83 | 83 | DECLARE_VIDEO_START(spaceint); |
84 | 84 | UINT32 screen_update_astinvad(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
85 | 85 | UINT32 screen_update_spaceint(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
86 | TIMER_CALLBACK_MEMBER(kamikaze_int_off); | |
87 | TIMER_CALLBACK_MEMBER(kamizake_int_gen); | |
86 | 88 | }; |
87 | 89 | |
88 | 90 | |
r18114 | r18115 | |
219 | 221 | * |
220 | 222 | *************************************/ |
221 | 223 | |
222 | ||
224 | TIMER_CALLBACK_MEMBER(astinvad_state::kamikaze_int_off) | |
223 | 225 | { |
224 | astinvad_state *state = machine.driver_data<astinvad_state>(); | |
225 | state->m_maincpu->set_input_line(0, CLEAR_LINE); | |
226 | m_maincpu->set_input_line(0, CLEAR_LINE); | |
226 | 227 | } |
227 | 228 | |
228 | 229 | |
229 | ||
230 | TIMER_CALLBACK_MEMBER(astinvad_state::kamizake_int_gen) | |
230 | 231 | { |
231 | astinvad_state *state = machine.driver_data<astinvad_state>(); | |
232 | 232 | /* interrupts are asserted on every state change of the 128V line */ |
233 | | |
233 | m_maincpu->set_input_line(0, ASSERT_LINE); | |
234 | 234 | param ^= 128; |
235 | | |
235 | m_int_timer->adjust(machine().primary_screen->time_until_pos(param), param); | |
236 | 236 | |
237 | 237 | /* an RC circuit turns the interrupt off after a short amount of time */ |
238 | machine.scheduler().timer_set(attotime::from_double(300 * 0.1e-6), FUNC(kamikaze_int_off)); | |
238 | machine().scheduler().timer_set(attotime::from_double(300 * 0.1e-6), timer_expired_delegate(FUNC(astinvad_state::kamikaze_int_off),this)); | |
239 | 239 | } |
240 | 240 | |
241 | 241 | |
r18114 | r18115 | |
244 | 244 | |
245 | 245 | m_samples = machine().device<samples_device>("samples"); |
246 | 246 | |
247 | m_int_timer = machine().scheduler().timer_alloc(FUNC(kamizake_int_gen)); | |
247 | m_int_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(astinvad_state::kamizake_int_gen),this)); | |
248 | 248 | m_int_timer->adjust(machine().primary_screen->time_until_pos(128), 128); |
249 | 249 | |
250 | 250 | save_item(NAME(m_screen_flip)); |
r18114 | r18115 | |
---|---|---|
52 | 52 | virtual void machine_reset(); |
53 | 53 | virtual void palette_init(); |
54 | 54 | UINT32 screen_update_destroyr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
55 | TIMER_CALLBACK_MEMBER(destroyr_dial_callback); | |
56 | TIMER_CALLBACK_MEMBER(destroyr_frame_callback); | |
55 | 57 | }; |
56 | 58 | |
57 | 59 | |
r18114 | r18115 | |
121 | 123 | return 0; |
122 | 124 | } |
123 | 125 | |
124 | ||
126 | TIMER_CALLBACK_MEMBER(destroyr_state::destroyr_dial_callback) | |
125 | 127 | { |
126 | destroyr_state *state = machine.driver_data<destroyr_state>(); | |
127 | 128 | int dial = param; |
128 | 129 | |
129 | 130 | /* Analog inputs come from the player's depth control potentiometer. |
r18114 | r18115 | |
133 | 134 | computer then reads the VSYNC data functions to tell where the |
134 | 135 | cursor should be located. */ |
135 | 136 | |
136 | | |
137 | m_potsense[dial] = 1; | |
137 | 138 | |
138 | if ( | |
139 | if (m_potmask[dial]) | |
139 | 140 | { |
140 | | |
141 | m_maincpu->set_input_line(INPUT_LINE_NMI, PULSE_LINE); | |
141 | 142 | } |
142 | 143 | } |
143 | 144 | |
144 | 145 | |
145 | ||
146 | TIMER_CALLBACK_MEMBER(destroyr_state::destroyr_frame_callback) | |
146 | 147 | { |
147 | destroyr_state *state = machine.driver_data<destroyr_state>(); | |
148 | state->m_potsense[0] = 0; | |
149 | state->m_potsense[1] = 0; | |
148 | m_potsense[0] = 0; | |
149 | m_potsense[1] = 0; | |
150 | 150 | |
151 | 151 | /* PCB supports two dials, but cab has only got one */ |
152 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(state->ioport("PADDLE")->read()), FUNC(destroyr_dial_callback)); | |
153 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback)); | |
152 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(ioport("PADDLE")->read()), timer_expired_delegate(FUNC(destroyr_state::destroyr_dial_callback),this)); | |
153 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(destroyr_state::destroyr_frame_callback),this)); | |
154 | 154 | } |
155 | 155 | |
156 | 156 | |
157 | 157 | void destroyr_state::machine_reset() |
158 | 158 | { |
159 | 159 | |
160 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), FUNC(destroyr_frame_callback)); | |
160 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(0), timer_expired_delegate(FUNC(destroyr_state::destroyr_frame_callback),this)); | |
161 | 161 | |
162 | 162 | m_cursor = 0; |
163 | 163 | m_wavemod = 0; |
r18114 | r18115 | |
---|---|---|
145 | 145 | DECLARE_MACHINE_RESET(multigm3); |
146 | 146 | DECLARE_MACHINE_START(supergm3); |
147 | 147 | UINT32 screen_update_multigam(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
148 | TIMER_CALLBACK_MEMBER(mmc1_resync_callback); | |
148 | 149 | }; |
149 | 150 | |
150 | 151 | |
r18114 | r18115 | |
693 | 694 | *******************************************************/ |
694 | 695 | |
695 | 696 | |
696 | ||
697 | TIMER_CALLBACK_MEMBER(multigam_state::mmc1_resync_callback) | |
697 | 698 | { |
698 | multigam_state *state = machine.driver_data<multigam_state>(); | |
699 | state->m_mmc1_reg_write_enable = 1; | |
699 | m_mmc1_reg_write_enable = 1; | |
700 | 700 | } |
701 | 701 | |
702 | 702 | WRITE8_MEMBER(multigam_state::mmc1_rom_switch_w) |
r18114 | r18115 | |
710 | 710 | else |
711 | 711 | { |
712 | 712 | m_mmc1_reg_write_enable = 0; |
713 | machine().scheduler().synchronize(FUNC(mmc1_resync_callback)); | |
713 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(multigam_state::mmc1_resync_callback),this)); | |
714 | 714 | } |
715 | 715 | |
716 | 716 | int reg = (offset >> 13); |
r18114 | r18115 | |
---|---|---|
90 | 90 | DECLARE_MACHINE_START(common); |
91 | 91 | DECLARE_MACHINE_RESET(common); |
92 | 92 | UINT32 screen_update_jangou(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
93 | TIMER_CALLBACK_MEMBER(cvsd_bit_timer_callback); | |
93 | 94 | }; |
94 | 95 | |
95 | 96 | |
r18114 | r18115 | |
328 | 329 | m_cvsd_shiftreg = data; |
329 | 330 | } |
330 | 331 | |
331 | ||
332 | TIMER_CALLBACK_MEMBER(jangou_state::cvsd_bit_timer_callback) | |
332 | 333 | { |
333 | jangou_state *state = machine.driver_data<jangou_state>(); | |
334 | 334 | |
335 | 335 | /* Data is shifted out at the MSB */ |
336 | hc55516_digit_w(state->m_cvsd, (state->m_cvsd_shiftreg >> 7) & 1); | |
337 | state->m_cvsd_shiftreg <<= 1; | |
336 | hc55516_digit_w(m_cvsd, (m_cvsd_shiftreg >> 7) & 1); | |
337 | m_cvsd_shiftreg <<= 1; | |
338 | 338 | |
339 | 339 | /* Trigger an IRQ for every 8 shifted bits */ |
340 | if ((++state->m_cvsd_shift_cnt & 7) == 0) | |
341 | state->m_cpu_1->execute().set_input_line(0, HOLD_LINE); | |
340 | if ((++m_cvsd_shift_cnt & 7) == 0) | |
341 | m_cpu_1->execute().set_input_line(0, HOLD_LINE); | |
342 | 342 | } |
343 | 343 | |
344 | 344 | |
r18114 | r18115 | |
907 | 907 | jangou_state *state = machine.driver_data<jangou_state>(); |
908 | 908 | |
909 | 909 | /* Create a timer to feed the CVSD DAC with sample bits */ |
910 | state->m_cvsd_bit_timer = machine.scheduler().timer_alloc(FUNC(cvsd_bit_timer_callback)); | |
910 | state->m_cvsd_bit_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(jangou_state::cvsd_bit_timer_callback),state)); | |
911 | 911 | state->m_cvsd_bit_timer->adjust(attotime::from_hz(MASTER_CLOCK / 1024), 0, attotime::from_hz(MASTER_CLOCK / 1024)); |
912 | 912 | } |
913 | 913 |
r18114 | r18115 | |
---|---|---|
88 | 88 | virtual void machine_start(); |
89 | 89 | UINT32 screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
90 | 90 | INTERRUPT_GEN_MEMBER(vblank_callback_lgp); |
91 | TIMER_CALLBACK_MEMBER(irq_stop); | |
91 | 92 | }; |
92 | 93 | |
93 | 94 | |
r18114 | r18115 | |
332 | 333 | GFXDECODE_ENTRY("gfx4", 0, lgp_gfx_layout_16x32, 0x0, 0x100) |
333 | 334 | GFXDECODE_END |
334 | 335 | |
335 | ||
336 | TIMER_CALLBACK_MEMBER(lgp_state::irq_stop) | |
336 | 337 | { |
337 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
338 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
338 | 339 | } |
339 | 340 | |
340 | 341 | INTERRUPT_GEN_MEMBER(lgp_state::vblank_callback_lgp) |
r18114 | r18115 | |
350 | 351 | |
351 | 352 | void lgp_state::machine_start() |
352 | 353 | { |
353 | m_irq_timer = machine().scheduler().timer_alloc(FUNC(irq_stop)); | |
354 | m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(lgp_state::irq_stop),this)); | |
354 | 355 | } |
355 | 356 | |
356 | 357 |
r18114 | r18115 | |
---|---|---|
208 | 208 | UINT32 screen_update_zr107(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
209 | 209 | UINT32 screen_update_jetwave(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
210 | 210 | INTERRUPT_GEN_MEMBER(zr107_vblank); |
211 | TIMER_CALLBACK_MEMBER(irq_off); | |
211 | 212 | }; |
212 | 213 | |
213 | 214 | |
r18114 | r18115 | |
677 | 678 | }; |
678 | 679 | |
679 | 680 | |
680 | ||
681 | TIMER_CALLBACK_MEMBER(zr107_state::irq_off) | |
681 | 682 | { |
682 | machine.device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
683 | machine().device("audiocpu")->execute().set_input_line(param, CLEAR_LINE); | |
683 | 684 | } |
684 | 685 | |
685 | 686 | static void sound_irq_callback( running_machine &machine, int irq ) |
686 | 687 | { |
688 | zr107_state *state = machine.driver_data<zr107_state>(); | |
687 | 689 | int line = (irq == 0) ? INPUT_LINE_IRQ1 : INPUT_LINE_IRQ2; |
688 | 690 | |
689 | 691 | machine.device("audiocpu")->execute().set_input_line(line, ASSERT_LINE); |
690 | machine.scheduler().timer_set(attotime::from_usec(1), FUNC(irq_off), line); | |
692 | machine.scheduler().timer_set(attotime::from_usec(1), timer_expired_delegate(FUNC(zr107_state::irq_off),state), line); | |
691 | 693 | } |
692 | 694 | |
693 | 695 | static const k056800_interface zr107_k056800_interface = |
r18114 | r18115 | |
---|---|---|
112 | 112 | DECLARE_DRIVER_INIT(cliff); |
113 | 113 | virtual void machine_start(); |
114 | 114 | virtual void machine_reset(); |
115 | TIMER_CALLBACK_MEMBER(cliff_irq_callback); | |
115 | 116 | }; |
116 | 117 | |
117 | 118 | |
r18114 | r18115 | |
186 | 187 | |
187 | 188 | /********************************************************/ |
188 | 189 | |
189 | ||
190 | TIMER_CALLBACK_MEMBER(cliffhgr_state::cliff_irq_callback) | |
190 | 191 | { |
191 | cliffhgr_state *state = machine.driver_data<cliffhgr_state>(); | |
192 | state->m_phillips_code = 0; | |
192 | m_phillips_code = 0; | |
193 | 193 | |
194 | 194 | switch (param) |
195 | 195 | { |
196 | 196 | case 17: |
197 | | |
197 | m_phillips_code = m_laserdisc->get_field_code(LASERDISC_CODE_LINE17, true); | |
198 | 198 | param = 18; |
199 | 199 | break; |
200 | 200 | |
201 | 201 | case 18: |
202 | | |
202 | m_phillips_code = m_laserdisc->get_field_code(LASERDISC_CODE_LINE18, true); | |
203 | 203 | param = 17; |
204 | 204 | break; |
205 | 205 | } |
206 | 206 | |
207 | 207 | /* if we have a valid code, trigger an IRQ */ |
208 | if ( | |
208 | if (m_phillips_code & 0x800000) | |
209 | 209 | { |
210 | 210 | // printf("%2d:code = %06X\n", param, phillips_code); |
211 | machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
211 | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
212 | 212 | } |
213 | 213 | |
214 | | |
214 | m_irq_timer->adjust(machine().primary_screen->time_until_pos(param * 2), param); | |
215 | 215 | } |
216 | 216 | |
217 | 217 | WRITE_LINE_MEMBER(cliffhgr_state::vdp_interrupt) |
r18114 | r18115 | |
223 | 223 | |
224 | 224 | void cliffhgr_state::machine_start() |
225 | 225 | { |
226 | m_irq_timer = machine().scheduler().timer_alloc(FUNC(cliff_irq_callback)); | |
226 | m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cliffhgr_state::cliff_irq_callback),this)); | |
227 | 227 | } |
228 | 228 | |
229 | 229 | void cliffhgr_state::machine_reset() |
r18114 | r18115 | |
---|---|---|
146 | 146 | UINT32 screen_update_mazerbla(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
147 | 147 | UINT32 screen_update_test_vcu(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
148 | 148 | INTERRUPT_GEN_MEMBER(sound_interrupt); |
149 | TIMER_CALLBACK_MEMBER(deferred_ls670_0_w); | |
150 | TIMER_CALLBACK_MEMBER(deferred_ls670_1_w); | |
151 | TIMER_CALLBACK_MEMBER(delayed_sound_w); | |
149 | 152 | }; |
150 | 153 | |
151 | 154 | |
r18114 | r18115 | |
790 | 793 | return m_ls670_0[offset]; |
791 | 794 | } |
792 | 795 | |
793 | ||
796 | TIMER_CALLBACK_MEMBER(mazerbla_state::deferred_ls670_0_w) | |
794 | 797 | { |
795 | mazerbla_state *state = machine.driver_data<mazerbla_state>(); | |
796 | 798 | int offset = (param >> 8) & 255; |
797 | 799 | int data = param & 255; |
798 | 800 | |
799 | | |
801 | m_ls670_0[offset] = data; | |
800 | 802 | } |
801 | 803 | |
802 | 804 | WRITE8_MEMBER(mazerbla_state::ls670_0_w) |
803 | 805 | { |
804 | 806 | /* do this on a timer to let the CPUs synchronize */ |
805 | machine().scheduler().synchronize(FUNC(deferred_ls670_0_w), (offset << 8) | data); | |
807 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::deferred_ls670_0_w),this), (offset << 8) | data); | |
806 | 808 | } |
807 | 809 | |
808 | 810 | READ8_MEMBER(mazerbla_state::ls670_1_r) |
r18114 | r18115 | |
814 | 816 | return m_ls670_1[offset]; |
815 | 817 | } |
816 | 818 | |
817 | ||
819 | TIMER_CALLBACK_MEMBER(mazerbla_state::deferred_ls670_1_w) | |
818 | 820 | { |
819 | mazerbla_state *state = machine.driver_data<mazerbla_state>(); | |
820 | 821 | int offset = (param >> 8) & 255; |
821 | 822 | int data = param & 255; |
822 | 823 | |
823 | | |
824 | m_ls670_1[offset] = data; | |
824 | 825 | } |
825 | 826 | |
826 | 827 | WRITE8_MEMBER(mazerbla_state::ls670_1_w) |
827 | 828 | { |
828 | 829 | /* do this on a timer to let the CPUs synchronize */ |
829 | machine().scheduler().synchronize(FUNC(deferred_ls670_1_w), (offset << 8) | data); | |
830 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::deferred_ls670_1_w),this), (offset << 8) | data); | |
830 | 831 | } |
831 | 832 | |
832 | 833 | |
r18114 | r18115 | |
955 | 956 | return m_soundlatch; |
956 | 957 | } |
957 | 958 | |
958 | ||
959 | TIMER_CALLBACK_MEMBER(mazerbla_state::delayed_sound_w) | |
959 | 960 | { |
960 | mazerbla_state *state = machine.driver_data<mazerbla_state>(); | |
961 | state->m_soundlatch = param; | |
961 | m_soundlatch = param; | |
962 | 962 | |
963 | 963 | /* cause NMI on sound CPU */ |
964 | | |
964 | m_subcpu->set_input_line(INPUT_LINE_NMI, ASSERT_LINE); | |
965 | 965 | } |
966 | 966 | |
967 | 967 | WRITE8_MEMBER(mazerbla_state::main_sound_w) |
968 | 968 | { |
969 | machine().scheduler().synchronize(FUNC(delayed_sound_w), data & 0xff); | |
969 | machine().scheduler().synchronize(timer_expired_delegate(FUNC(mazerbla_state::delayed_sound_w),this), data & 0xff); | |
970 | 970 | } |
971 | 971 | |
972 | 972 | WRITE8_MEMBER(mazerbla_state::sound_int_clear_w) |
r18114 | r18115 | |
---|---|---|
41 | 41 | virtual void palette_init(); |
42 | 42 | UINT32 screen_update_acefruit(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
43 | 43 | INTERRUPT_GEN_MEMBER(acefruit_vblank); |
44 | TIMER_CALLBACK_MEMBER(acefruit_refresh); | |
44 | 45 | }; |
45 | 46 | |
46 | 47 | |
r18114 | r18115 | |
66 | 67 | } |
67 | 68 | |
68 | 69 | |
69 | ||
70 | TIMER_CALLBACK_MEMBER(acefruit_state::acefruit_refresh) | |
70 | 71 | { |
71 | acefruit_state *state = machine.driver_data<acefruit_state>(); | |
72 | int vpos = machine.primary_screen->vpos(); | |
72 | int vpos = machine().primary_screen->vpos(); | |
73 | 73 | |
74 | machine.primary_screen->update_partial(vpos ); | |
75 | acefruit_update_irq(machine, vpos ); | |
74 | machine().primary_screen->update_partial(vpos ); | |
75 | acefruit_update_irq(machine(), vpos ); | |
76 | 76 | |
77 | 77 | vpos = ( ( vpos / 8 ) + 1 ) * 8; |
78 | 78 | |
79 | | |
79 | m_refresh_timer->adjust( machine().primary_screen->time_until_pos(vpos) ); | |
80 | 80 | } |
81 | 81 | |
82 | 82 | void acefruit_state::video_start() |
83 | 83 | { |
84 | m_refresh_timer = machine().scheduler().timer_alloc(FUNC(acefruit_refresh)); | |
84 | m_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(acefruit_state::acefruit_refresh),this)); | |
85 | 85 | } |
86 | 86 | |
87 | 87 | INTERRUPT_GEN_MEMBER(acefruit_state::acefruit_vblank) |
r18114 | r18115 | |
---|---|---|
33 | 33 | virtual void video_start(); |
34 | 34 | virtual void palette_init(); |
35 | 35 | UINT32 screen_update_cball(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
36 | TIMER_CALLBACK_MEMBER(interrupt_callback); | |
36 | 37 | }; |
37 | 38 | |
38 | 39 | |
r18114 | r18115 | |
74 | 75 | } |
75 | 76 | |
76 | 77 | |
77 | ||
78 | TIMER_CALLBACK_MEMBER(cball_state::interrupt_callback) | |
78 | 79 | { |
79 | cball_state *state = machine.driver_data<cball_state>(); | |
80 | 80 | int scanline = param; |
81 | 81 | |
82 | generic_pulse_irq_line( | |
82 | generic_pulse_irq_line(*m_maincpu, 0, 1); | |
83 | 83 | |
84 | 84 | scanline = scanline + 32; |
85 | 85 | |
86 | 86 | if (scanline >= 262) |
87 | 87 | scanline = 16; |
88 | 88 | |
89 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline); | |
89 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(cball_state::interrupt_callback),this), scanline); | |
90 | 90 | } |
91 | 91 | |
92 | 92 | |
r18114 | r18115 | |
97 | 97 | |
98 | 98 | void cball_state::machine_reset() |
99 | 99 | { |
100 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16); | |
100 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), timer_expired_delegate(FUNC(cball_state::interrupt_callback),this), 16); | |
101 | 101 | } |
102 | 102 | |
103 | 103 |
r18114 | r18115 | |
---|---|---|
39 | 39 | virtual void video_start(); |
40 | 40 | virtual void palette_init(); |
41 | 41 | UINT32 screen_update_mgolf(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
42 | TIMER_CALLBACK_MEMBER(interrupt_callback); | |
42 | 43 | }; |
43 | 44 | |
44 | 45 | |
r18114 | r18115 | |
113 | 114 | } |
114 | 115 | |
115 | 116 | |
116 | ||
117 | TIMER_CALLBACK_MEMBER(mgolf_state::interrupt_callback) | |
117 | 118 | { |
118 | mgolf_state *state = machine.driver_data<mgolf_state>(); | |
119 | 119 | int scanline = param; |
120 | 120 | |
121 | update_plunger(machine); | |
121 | update_plunger(machine()); | |
122 | 122 | |
123 | generic_pulse_irq_line( | |
123 | generic_pulse_irq_line(*m_maincpu, 0, 1); | |
124 | 124 | |
125 | 125 | scanline = scanline + 32; |
126 | 126 | |
127 | 127 | if (scanline >= 262) |
128 | 128 | scanline = 16; |
129 | 129 | |
130 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(scanline), FUNC(interrupt_callback), scanline); | |
130 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(scanline), timer_expired_delegate(FUNC(mgolf_state::interrupt_callback),this), scanline); | |
131 | 131 | } |
132 | 132 | |
133 | 133 | |
r18114 | r18115 | |
316 | 316 | |
317 | 317 | void mgolf_state::machine_reset() |
318 | 318 | { |
319 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), FUNC(interrupt_callback), 16); | |
319 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(16), timer_expired_delegate(FUNC(mgolf_state::interrupt_callback),this), 16); | |
320 | 320 | |
321 | 321 | m_mask = 0; |
322 | 322 | m_prev = 0; |
r18114 | r18115 | |
---|---|---|
78 | 78 | virtual void machine_reset(); |
79 | 79 | virtual void video_start(); |
80 | 80 | UINT32 screen_update_mlanding(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
81 | TIMER_CALLBACK_MEMBER(dma_complete); | |
81 | 82 | }; |
82 | 83 | |
83 | 84 | |
r18114 | r18115 | |
312 | 313 | } |
313 | 314 | } |
314 | 315 | |
315 | ||
316 | TIMER_CALLBACK_MEMBER(mlanding_state::dma_complete) | |
316 | 317 | { |
317 | mlanding_state *state = machine.driver_data<mlanding_state>(); | |
318 | state->m_dma_active = 0; | |
318 | m_dma_active = 0; | |
319 | 319 | } |
320 | 320 | |
321 | 321 | /* TODO: this uses many bits */ |
r18114 | r18115 | |
329 | 329 | if (pixels) |
330 | 330 | { |
331 | 331 | m_dma_active = 1; |
332 | machine().scheduler().timer_set(attotime::from_msec(20), FUNC(dma_complete)); | |
332 | machine().scheduler().timer_set(attotime::from_msec(20), timer_expired_delegate(FUNC(mlanding_state::dma_complete),this)); | |
333 | 333 | } |
334 | 334 | |
335 | 335 | if(!(data & 0x40)) // unknown line used |
r18114 | r18115 | |
---|---|---|
382 | 382 | virtual void machine_start(); |
383 | 383 | virtual void machine_reset(); |
384 | 384 | UINT32 screen_update_missile(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
385 | TIMER_CALLBACK_MEMBER(clock_irq); | |
386 | TIMER_CALLBACK_MEMBER(adjust_cpu_speed); | |
385 | 387 | }; |
386 | 388 | |
387 | 389 | |
r18114 | r18115 | |
436 | 438 | } |
437 | 439 | |
438 | 440 | |
439 | ||
441 | TIMER_CALLBACK_MEMBER(missile_state::clock_irq) | |
440 | 442 | { |
441 | missile_state *state = machine.driver_data<missile_state>(); | |
442 | 443 | int curv = param; |
443 | 444 | |
444 | 445 | /* assert the IRQ if not already asserted */ |
445 | state->m_irq_state = (~curv >> 5) & 1; | |
446 | state->m_maincpu->set_input_line(0, state->m_irq_state ? ASSERT_LINE : CLEAR_LINE); | |
446 | m_irq_state = (~curv >> 5) & 1; | |
447 | m_maincpu->set_input_line(0, m_irq_state ? ASSERT_LINE : CLEAR_LINE); | |
447 | 448 | |
448 | 449 | /* force an update while we're here */ |
449 | machine.primary_screen->update_partial(v_to_scanline( | |
450 | machine().primary_screen->update_partial(v_to_scanline(this, curv)); | |
450 | 451 | |
451 | 452 | /* find the next edge */ |
452 | schedule_next_irq(machine, curv); | |
453 | schedule_next_irq(machine(), curv); | |
453 | 454 | } |
454 | 455 | |
455 | 456 | |
r18114 | r18115 | |
468 | 469 | * |
469 | 470 | *************************************/ |
470 | 471 | |
471 | ||
472 | TIMER_CALLBACK_MEMBER(missile_state::adjust_cpu_speed) | |
472 | 473 | { |
473 | missile_state *state = machine.driver_data<missile_state>(); | |
474 | 474 | int curv = param; |
475 | 475 | |
476 | 476 | /* starting at scanline 224, the CPU runs at half speed */ |
477 | 477 | if (curv == 224) |
478 | | |
478 | m_maincpu->set_unscaled_clock(MASTER_CLOCK/16); | |
479 | 479 | else |
480 | | |
480 | m_maincpu->set_unscaled_clock(MASTER_CLOCK/8); | |
481 | 481 | |
482 | 482 | /* scanline for the next run */ |
483 | 483 | curv ^= 224; |
484 | | |
484 | m_cpu_timer->adjust(machine().primary_screen->time_until_pos(v_to_scanline(this, curv)), curv); | |
485 | 485 | } |
486 | 486 | |
487 | 487 | |
r18114 | r18115 | |
522 | 522 | space.set_direct_update_handler(direct_update_delegate(FUNC(missile_state::missile_direct_handler), this)); |
523 | 523 | |
524 | 524 | /* create a timer to speed/slow the CPU */ |
525 | m_cpu_timer = machine().scheduler().timer_alloc(FUNC(adjust_cpu_speed)); | |
525 | m_cpu_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::adjust_cpu_speed),this)); | |
526 | 526 | m_cpu_timer->adjust(machine().primary_screen->time_until_pos(v_to_scanline(this, 0), 0)); |
527 | 527 | |
528 | 528 | /* create a timer for IRQs and set up the first callback */ |
529 | m_irq_timer = machine().scheduler().timer_alloc(FUNC(clock_irq)); | |
529 | m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(missile_state::clock_irq),this)); | |
530 | 530 | m_irq_state = 0; |
531 | 531 | schedule_next_irq(machine(), -32); |
532 | 532 |
r18114 | r18115 | |
---|---|---|
56 | 56 | DECLARE_MACHINE_RESET(tickee); |
57 | 57 | DECLARE_VIDEO_START(tickee); |
58 | 58 | DECLARE_MACHINE_RESET(rapidfir); |
59 | TIMER_CALLBACK_MEMBER(trigger_gun_interrupt); | |
60 | TIMER_CALLBACK_MEMBER(clear_gun_interrupt); | |
61 | TIMER_CALLBACK_MEMBER(setup_gun_interrupts); | |
59 | 62 | }; |
60 | 63 | |
61 | 64 | |
r18114 | r18115 | |
86 | 89 | * |
87 | 90 | *************************************/ |
88 | 91 | |
89 | ||
92 | TIMER_CALLBACK_MEMBER(tickee_state::trigger_gun_interrupt) | |
90 | 93 | { |
91 | tickee_state *state = machine.driver_data<tickee_state>(); | |
92 | 94 | int which = param & 1; |
93 | int beamx = (machine.primary_screen->hpos()/2)-58; | |
95 | int beamx = (machine().primary_screen->hpos()/2)-58; | |
94 | 96 | |
95 | 97 | /* once we're ready to fire, set the X coordinate and assert the line */ |
96 | | |
98 | m_gunx[which] = beamx; | |
97 | 99 | |
98 | 100 | /* fire the IRQ at the correct moment */ |
99 | machine.device("maincpu")->execute().set_input_line(param, ASSERT_LINE); | |
101 | machine().device("maincpu")->execute().set_input_line(param, ASSERT_LINE); | |
100 | 102 | } |
101 | 103 | |
102 | 104 | |
103 | ||
105 | TIMER_CALLBACK_MEMBER(tickee_state::clear_gun_interrupt) | |
104 | 106 | { |
105 | 107 | /* clear the IRQ on the next scanline? */ |
106 | machine.device("maincpu")->execute().set_input_line(param, CLEAR_LINE); | |
108 | machine().device("maincpu")->execute().set_input_line(param, CLEAR_LINE); | |
107 | 109 | } |
108 | 110 | |
109 | 111 | |
110 | ||
112 | TIMER_CALLBACK_MEMBER(tickee_state::setup_gun_interrupts) | |
111 | 113 | { |
112 | tickee_state *state = machine.driver_data<tickee_state>(); | |
113 | 114 | int beamx, beamy; |
114 | 115 | |
115 | 116 | /* set a timer to do this again next frame */ |
116 | | |
117 | m_setup_gun_timer->adjust(machine().primary_screen->time_until_pos(0)); | |
117 | 118 | |
118 | 119 | /* only do work if the palette is flashed */ |
119 | if (state->m_control) | |
120 | if (!state->m_control[2]) | |
120 | if (m_control) | |
121 | if (!m_control[2]) | |
121 | 122 | return; |
122 | 123 | |
123 | 124 | /* generate interrupts for player 1's gun */ |
124 | get_crosshair_xy(machine, 0, &beamx, &beamy); | |
125 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd, beamx + state->m_beamxadd), FUNC(trigger_gun_interrupt), 0); | |
126 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd + 1, beamx + state->m_beamxadd), FUNC(clear_gun_interrupt), 0); | |
125 | get_crosshair_xy(machine(), 0, &beamx, &beamy); | |
126 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::trigger_gun_interrupt),this), 0); | |
127 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::clear_gun_interrupt),this), 0); | |
127 | 128 | |
128 | 129 | /* generate interrupts for player 2's gun */ |
129 | get_crosshair_xy(machine, 1, &beamx, &beamy); | |
130 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd, beamx + state->m_beamxadd), FUNC(trigger_gun_interrupt), 1); | |
131 | machine.scheduler().timer_set(machine.primary_screen->time_until_pos(beamy + state->m_beamyadd + 1, beamx + state->m_beamxadd), FUNC(clear_gun_interrupt), 1); | |
130 | get_crosshair_xy(machine(), 1, &beamx, &beamy); | |
131 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::trigger_gun_interrupt),this), 1); | |
132 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(beamy + m_beamyadd + 1, beamx + m_beamxadd), timer_expired_delegate(FUNC(tickee_state::clear_gun_interrupt),this), 1); | |
132 | 133 | } |
133 | 134 | |
134 | 135 | |
r18114 | r18115 | |
142 | 143 | VIDEO_START_MEMBER(tickee_state,tickee) |
143 | 144 | { |
144 | 145 | /* start a timer going on the first scanline of every frame */ |
145 | m_setup_gun_timer = machine().scheduler().timer_alloc(FUNC(setup_gun_interrupts)); | |
146 | m_setup_gun_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tickee_state::setup_gun_interrupts),this)); | |
146 | 147 | m_setup_gun_timer->adjust(machine().primary_screen->time_until_pos(0)); |
147 | 148 | } |
148 | 149 |
r18114 | r18115 | |
---|---|---|
59 | 59 | DECLARE_MACHINE_START(alg); |
60 | 60 | DECLARE_MACHINE_RESET(alg); |
61 | 61 | DECLARE_VIDEO_START(alg); |
62 | TIMER_CALLBACK_MEMBER(response_timer); | |
62 | 63 | }; |
63 | 64 | |
64 | static TIMER_CALLBACK( response_timer ); | |
65 | 65 | |
66 | 66 | |
67 | 67 | |
68 | ||
68 | 69 | /************************************* |
69 | 70 | * |
70 | 71 | * Lightgun reading |
r18114 | r18115 | |
115 | 116 | MACHINE_START_MEMBER(alg_state,alg) |
116 | 117 | { |
117 | 118 | |
118 | m_serial_timer = machine().scheduler().timer_alloc(FUNC(response_timer)); | |
119 | m_serial_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(alg_state::response_timer),this)); | |
119 | 120 | m_serial_timer_active = FALSE; |
120 | 121 | } |
121 | 122 | |
r18114 | r18115 | |
133 | 134 | * |
134 | 135 | *************************************/ |
135 | 136 | |
136 | ||
137 | TIMER_CALLBACK_MEMBER(alg_state::response_timer) | |
137 | 138 | { |
138 | alg_state *state = machine.driver_data<alg_state>(); | |
139 | 139 | |
140 | 140 | /* if we still have data to send, do it now */ |
141 | if ( | |
141 | if (m_laserdisc->data_available_r() == ASSERT_LINE) | |
142 | 142 | { |
143 | UINT8 data = | |
143 | UINT8 data = m_laserdisc->data_r(); | |
144 | 144 | if (data != 0x0a) |
145 | 145 | mame_printf_debug("Sending serial data = %02X\n", data); |
146 | amiga_serial_in_w(machine, data); | |
146 | amiga_serial_in_w(machine(), data); | |
147 | 147 | } |
148 | 148 | |
149 | 149 | /* if there's more to come, set another timer */ |
150 | if (state->m_laserdisc->data_available_r() == ASSERT_LINE) | |
151 | state->m_serial_timer->adjust(amiga_get_serial_char_period(machine)); | |
150 | if (m_laserdisc->data_available_r() == ASSERT_LINE) | |
151 | m_serial_timer->adjust(amiga_get_serial_char_period(machine())); | |
152 | 152 | else |
153 | | |
153 | m_serial_timer_active = FALSE; | |
154 | 154 | } |
155 | 155 | |
156 | 156 |
r18114 | r18115 | |
---|---|---|
41 | 41 | virtual void machine_start(); |
42 | 42 | virtual void machine_reset(); |
43 | 43 | UINT32 screen_update_clayshoo(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
44 | TIMER_CALLBACK_MEMBER(reset_analog_bit); | |
44 | 45 | }; |
45 | 46 | |
46 | 47 | |
r18114 | r18115 | |
100 | 101 | * |
101 | 102 | *************************************/ |
102 | 103 | |
103 | ||
104 | TIMER_CALLBACK_MEMBER(clayshoo_state::reset_analog_bit) | |
104 | 105 | { |
105 | clayshoo_state *state = machine.driver_data<clayshoo_state>(); | |
106 | state->m_analog_port_val &= ~param; | |
106 | m_analog_port_val &= ~param; | |
107 | 107 | } |
108 | 108 | |
109 | 109 | |
r18114 | r18115 | |
137 | 137 | static void create_analog_timers( running_machine &machine ) |
138 | 138 | { |
139 | 139 | clayshoo_state *state = machine.driver_data<clayshoo_state>(); |
140 | state->m_analog_timer_1 = machine.scheduler().timer_alloc(FUNC(reset_analog_bit)); | |
141 | state->m_analog_timer_2 = machine.scheduler().timer_alloc(FUNC(reset_analog_bit)); | |
140 | state->m_analog_timer_1 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state)); | |
141 | state->m_analog_timer_2 = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(clayshoo_state::reset_analog_bit),state)); | |
142 | 142 | } |
143 | 143 | |
144 | 144 |
r18114 | r18115 | |
---|---|---|
218 | 218 | DECLARE_READ32_MEMBER(ppc_spu_share_r); |
219 | 219 | DECLARE_WRITE32_MEMBER(ppc_spu_share_w); |
220 | 220 | DECLARE_READ16_MEMBER(spu_unk_r); |
221 | TIMER_CALLBACK_MEMBER(keyboard_timer_callback); | |
221 | 222 | }; |
222 | 223 | |
223 | 224 | |
r18114 | r18115 | |
1475 | 1476 | 0x53, // B2 |
1476 | 1477 | }; |
1477 | 1478 | |
1478 | ||
1479 | TIMER_CALLBACK_MEMBER(firebeat_state::keyboard_timer_callback) | |
1479 | 1480 | { |
1480 | firebeat_state *state = machine.driver_data<firebeat_state>(); | |
1481 | 1481 | static const int kb_uart_channel[2] = { 1, 0 }; |
1482 | 1482 | static const char *const keynames[] = { "KEYBOARD_P1", "KEYBOARD_P2" }; |
1483 | 1483 | int keyboard; |
r18114 | r18115 | |
1485 | 1485 | |
1486 | 1486 | for (keyboard=0; keyboard < 2; keyboard++) |
1487 | 1487 | { |
1488 | UINT32 kbstate = machine.root_device().ioport(keynames[keyboard])->read(); | |
1488 | UINT32 kbstate = machine().root_device().ioport(keynames[keyboard])->read(); | |
1489 | 1489 | int uart_channel = kb_uart_channel[keyboard]; |
1490 | 1490 | |
1491 | if (kbstate != | |
1491 | if (kbstate != m_keyboard_state[keyboard]) | |
1492 | 1492 | { |
1493 | 1493 | for (i=0; i < 24; i++) |
1494 | 1494 | { |
1495 | 1495 | int kbnote = keyboard_notes[i]; |
1496 | 1496 | |
1497 | if (( | |
1497 | if ((m_keyboard_state[keyboard] & (1 << i)) != 0 && (kbstate & (1 << i)) == 0) | |
1498 | 1498 | { |
1499 | 1499 | // key was on, now off -> send Note Off message |
1500 | pc16552d_rx_data(machine, 1, uart_channel, 0x80); | |
1501 | pc16552d_rx_data(machine, 1, uart_channel, kbnote); | |
1502 | pc16552d_rx_data(machine, 1, uart_channel, 0x7f); | |
1500 | pc16552d_rx_data(machine(), 1, uart_channel, 0x80); | |
1501 | pc16552d_rx_data(machine(), 1, uart_channel, kbnote); | |
1502 | pc16552d_rx_data(machine(), 1, uart_channel, 0x7f); | |
1503 | 1503 | } |
1504 | else if (( | |
1504 | else if ((m_keyboard_state[keyboard] & (1 << i)) == 0 && (kbstate & (1 << i)) != 0) | |
1505 | 1505 | { |
1506 | 1506 | // key was off, now on -> send Note On message |
1507 | pc16552d_rx_data(machine, 1, uart_channel, 0x90); | |
1508 | pc16552d_rx_data(machine, 1, uart_channel, kbnote); | |
1509 | pc16552d_rx_data(machine, 1, uart_channel, 0x7f); | |
1507 | pc16552d_rx_data(machine(), 1, uart_channel, 0x90); | |
1508 | pc16552d_rx_data(machine(), 1, uart_channel, kbnote); | |
1509 | pc16552d_rx_data(machine(), 1, uart_channel, 0x7f); | |
1510 | 1510 | } |
1511 | 1511 | } |
1512 | 1512 | } |
1513 | 1513 | else |
1514 | 1514 | { |
1515 | 1515 | // no messages, send Active Sense message instead |
1516 | pc16552d_rx_data(machine, 1, uart_channel, 0xfe); | |
1516 | pc16552d_rx_data(machine(), 1, uart_channel, 0xfe); | |
1517 | 1517 | } |
1518 | 1518 | |
1519 | | |
1519 | m_keyboard_state[keyboard] = kbstate; | |
1520 | 1520 | } |
1521 | 1521 | } |
1522 | 1522 | |
r18114 | r18115 | |
2287 | 2287 | { |
2288 | 2288 | firebeat_state *state = machine.driver_data<firebeat_state>(); |
2289 | 2289 | // set keyboard timer |
2290 | state->m_keyboard_timer = machine.scheduler().timer_alloc(FUNC(keyboard_timer_callback)); | |
2290 | state->m_keyboard_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(firebeat_state::keyboard_timer_callback),state)); | |
2291 | 2291 | state->m_keyboard_timer->adjust(attotime::from_msec(10), 0, attotime::from_msec(10)); |
2292 | 2292 | } |
2293 | 2293 |
r18114 | r18115 | |
---|---|---|
50 | 50 | virtual void machine_reset(); |
51 | 51 | virtual void palette_init(); |
52 | 52 | UINT32 screen_update_tugboat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
53 | TIMER_CALLBACK_MEMBER(interrupt_gen); | |
53 | 54 | }; |
54 | 55 | |
55 | 56 | |
r18114 | r18115 | |
202 | 203 | DEVCB_NULL /* IRQB */ |
203 | 204 | }; |
204 | 205 | |
205 | ||
206 | TIMER_CALLBACK_MEMBER(tugboat_state::interrupt_gen) | |
206 | 207 | { |
207 | machine.device("maincpu")->execute().set_input_line(0, HOLD_LINE); | |
208 | machine.scheduler().timer_set(machine.primary_screen->frame_period(), FUNC(interrupt_gen)); | |
208 | machine().device("maincpu")->execute().set_input_line(0, HOLD_LINE); | |
209 | machine().scheduler().timer_set(machine().primary_screen->frame_period(), timer_expired_delegate(FUNC(tugboat_state::interrupt_gen),this)); | |
209 | 210 | } |
210 | 211 | |
211 | 212 | void tugboat_state::machine_reset() |
212 | 213 | { |
213 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(30*8+4), FUNC(interrupt_gen)); | |
214 | machine().scheduler().timer_set(machine().primary_screen->time_until_pos(30*8+4), timer_expired_delegate(FUNC(tugboat_state::interrupt_gen),this)); | |
214 | 215 | } |
215 | 216 | |
216 | 217 |
r18114 | r18115 | |
---|---|---|
350 | 350 | virtual void machine_reset(); |
351 | 351 | UINT32 screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
352 | 352 | INTERRUPT_GEN_MEMBER(viper_vblank); |
353 | TIMER_CALLBACK_MEMBER(epic_global_timer_callback); | |
354 | TIMER_CALLBACK_MEMBER(ds2430_timer_callback); | |
353 | 355 | }; |
354 | 356 | |
355 | 357 | UINT32 viper_state::screen_update_viper(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
r18114 | r18115 | |
609 | 611 | } |
610 | 612 | #endif |
611 | 613 | |
612 | ||
614 | TIMER_CALLBACK_MEMBER(viper_state::epic_global_timer_callback) | |
613 | 615 | { |
614 | 616 | int timer_num = param; |
615 | 617 | |
r18114 | r18115 | |
627 | 629 | epic.global_timer[timer_num].timer->reset(); |
628 | 630 | } |
629 | 631 | |
630 | mpc8240_interrupt(machine, MPC8240_GTIMER0_IRQ + timer_num); | |
632 | mpc8240_interrupt(machine(), MPC8240_GTIMER0_IRQ + timer_num); | |
631 | 633 | } |
632 | 634 | |
633 | 635 | |
r18114 | r18115 | |
1172 | 1174 | |
1173 | 1175 | static void mpc8240_epic_init(running_machine &machine) |
1174 | 1176 | { |
1175 | epic.global_timer[0].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); | |
1176 | epic.global_timer[1].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); | |
1177 | epic.global_timer[2].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); | |
1178 | epic.global_timer[3].timer = machine.scheduler().timer_alloc(FUNC(epic_global_timer_callback)); | |
1177 | viper_state *state = machine.driver_data<viper_state>(); | |
1178 | epic.global_timer[0].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); | |
1179 | epic.global_timer[1].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); | |
1180 | epic.global_timer[2].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); | |
1181 | epic.global_timer[3].timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::epic_global_timer_callback),state)); | |
1179 | 1182 | } |
1180 | 1183 | |
1181 | 1184 | static void mpc8240_epic_reset(void) |
r18114 | r18115 | |
1606 | 1609 | static UINT8 ds2430_addr; |
1607 | 1610 | |
1608 | 1611 | |
1609 | ||
1612 | TIMER_CALLBACK_MEMBER(viper_state::ds2430_timer_callback) | |
1610 | 1613 | { |
1611 | 1614 | printf("DS2430 timer callback\n"); |
1612 | 1615 | |
r18114 | r18115 | |
1965 | 1968 | |
1966 | 1969 | void viper_state::machine_start() |
1967 | 1970 | { |
1968 | ds2430_timer = machine().scheduler().timer_alloc(FUNC(ds2430_timer_callback)); | |
1971 | ds2430_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(viper_state::ds2430_timer_callback),this)); | |
1969 | 1972 | ds2430_bit_timer = machine().device<timer_device>("ds2430_timer2"); |
1970 | 1973 | mpc8240_epic_init(machine()); |
1971 | 1974 |
r18114 | r18115 | |
---|---|---|
266 | 266 | virtual void palette_init(); |
267 | 267 | UINT32 screen_update_halleys(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
268 | 268 | UINT32 screen_update_benberob(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
269 | TIMER_CALLBACK_MEMBER(blitter_reset); | |
269 | 270 | }; |
270 | 271 | |
271 | 272 | |
r18114 | r18115 | |
1040 | 1041 | } |
1041 | 1042 | |
1042 | 1043 | |
1043 | ||
1044 | TIMER_CALLBACK_MEMBER(halleys_state::blitter_reset) | |
1044 | 1045 | { |
1045 | halleys_state *state = machine.driver_data<halleys_state>(); | |
1046 | state->m_blitter_busy = 0; | |
1046 | m_blitter_busy = 0; | |
1047 | 1047 | } |
1048 | 1048 | |
1049 | 1049 | |
r18114 | r18115 | |
2238 | 2238 | |
2239 | 2239 | init_common(machine()); |
2240 | 2240 | |
2241 | m_blitter_reset_timer = machine().scheduler().timer_alloc(FUNC(blitter_reset)); | |
2241 | m_blitter_reset_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(halleys_state::blitter_reset),this)); | |
2242 | 2242 | } |
2243 | 2243 | |
2244 | 2244 |
r18114 | r18115 | |
---|---|---|
63 | 63 | virtual void machine_start(); |
64 | 64 | virtual void video_start(); |
65 | 65 | UINT32 screen_update_ip204415(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
66 | TIMER_CALLBACK_MEMBER(ip20_timer); | |
66 | 67 | }; |
67 | 68 | |
68 | 69 | |
r18114 | r18115 | |
495 | 496 | { |
496 | 497 | } |
497 | 498 | |
498 | ||
499 | TIMER_CALLBACK_MEMBER(ip20_state::ip20_timer) | |
499 | 500 | { |
500 | ip20_state *state = machine.driver_data<ip20_state>(); | |
501 | ip20_state *state = machine().driver_data<ip20_state>(); | |
501 | 502 | |
502 | 503 | // update RTC every 10 milliseconds |
503 | state->m_RTC.nTemp++; | |
504 | if (state->m_RTC.nTemp >= 10) | |
504 | m_RTC.nTemp++; | |
505 | if (m_RTC.nTemp >= 10) | |
505 | 506 | { |
506 | | |
507 | m_RTC.nTemp = 0; | |
507 | 508 | RTC_HUNDREDTH++; |
508 | 509 | |
509 | 510 | if( ( RTC_HUNDREDTH & 0x0f ) == 0x0a ) |
r18114 | r18115 | |
551 | 552 | } |
552 | 553 | } |
553 | 554 | |
554 | machine.scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer)); | |
555 | machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this)); | |
555 | 556 | } |
556 | 557 | |
557 | 558 | void ip20_state::machine_start() |
r18114 | r18115 | |
568 | 569 | |
569 | 570 | m_RTC.nTemp = 0; |
570 | 571 | |
571 | machine().scheduler().timer_set(attotime::from_msec(1), FUNC(ip20_timer)); | |
572 | machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip20_state::ip20_timer),this)); | |
572 | 573 | } |
573 | 574 | |
574 | 575 | static INPUT_PORTS_START( ip204415 ) |
r18114 | r18115 | |
---|---|---|
49 | 49 | virtual void video_start(); |
50 | 50 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
51 | 51 | DECLARE_DRIVER_INIT(argo); |
52 | TIMER_CALLBACK_MEMBER(argo_boot); | |
52 | 53 | }; |
53 | 54 | |
54 | 55 | // write to videoram if following 'out b9,61' otherwise write to the unknown 'extra' ram |
r18114 | r18115 | |
249 | 250 | |
250 | 251 | |
251 | 252 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
252 | ||
253 | TIMER_CALLBACK_MEMBER(argo_state::argo_boot) | |
253 | 254 | { |
254 | argo_state *state = machine.driver_data<argo_state>(); | |
255 | state->membank("boot")->set_entry(0); | |
255 | membank("boot")->set_entry(0); | |
256 | 256 | } |
257 | 257 | |
258 | 258 | void argo_state::machine_reset() |
259 | 259 | { |
260 | 260 | membank("boot")->set_entry(1); |
261 | machine().scheduler().timer_set(attotime::from_usec(5), FUNC(argo_boot)); | |
261 | machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(argo_state::argo_boot),this)); | |
262 | 262 | } |
263 | 263 | |
264 | 264 | DRIVER_INIT_MEMBER(argo_state,argo) |
r18114 | r18115 | |
---|---|---|
38 | 38 | virtual void machine_reset(); |
39 | 39 | virtual void palette_init(); |
40 | 40 | UINT32 screen_update_scv(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
41 | TIMER_CALLBACK_MEMBER(scv_vb_callback); | |
41 | 42 | }; |
42 | 43 | |
43 | 44 | |
r18114 | r18115 | |
407 | 408 | } |
408 | 409 | |
409 | 410 | |
410 | ||
411 | TIMER_CALLBACK_MEMBER(scv_state::scv_vb_callback) | |
411 | 412 | { |
412 | scv_state *state = machine.driver_data<scv_state>(); | |
413 | int vpos = machine.primary_screen->vpos(); | |
413 | int vpos = machine().primary_screen->vpos(); | |
414 | 414 | |
415 | 415 | switch( vpos ) |
416 | 416 | { |
417 | 417 | case 240: |
418 | machine.device("maincpu")->execute().set_input_line(UPD7810_INTF2, ASSERT_LINE); | |
418 | machine().device("maincpu")->execute().set_input_line(UPD7810_INTF2, ASSERT_LINE); | |
419 | 419 | break; |
420 | 420 | case 0: |
421 | machine.device("maincpu")->execute().set_input_line(UPD7810_INTF2, CLEAR_LINE); | |
421 | machine().device("maincpu")->execute().set_input_line(UPD7810_INTF2, CLEAR_LINE); | |
422 | 422 | break; |
423 | 423 | } |
424 | 424 | |
425 | | |
425 | m_vb_timer->adjust( machine().primary_screen->time_until_pos(( vpos + 1 ) % 262, 0 ) ); | |
426 | 426 | } |
427 | 427 | |
428 | 428 | |
r18114 | r18115 | |
751 | 751 | void scv_state::machine_start() |
752 | 752 | { |
753 | 753 | |
754 | m_vb_timer = machine().scheduler().timer_alloc(FUNC(scv_vb_callback)); | |
754 | m_vb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(scv_state::scv_vb_callback),this)); | |
755 | 755 | } |
756 | 756 | |
757 | 757 |
r18114 | r18115 | |
---|---|---|
66 | 66 | UINT8 m_term_data; |
67 | 67 | virtual void machine_reset(); |
68 | 68 | virtual void video_start(); |
69 | TIMER_CALLBACK_MEMBER(h19_beepoff); | |
69 | 70 | }; |
70 | 71 | |
71 | 72 | |
72 | ||
73 | TIMER_CALLBACK_MEMBER(h19_state::h19_beepoff) | |
73 | 74 | { |
74 | h19_state *state = machine.driver_data<h19_state>(); | |
75 | beep_set_state(state->m_beep, 0); | |
75 | beep_set_state(m_beep, 0); | |
76 | 76 | } |
77 | 77 | |
78 | 78 | READ8_MEMBER( h19_state::h19_80_r ) |
r18114 | r18115 | |
99 | 99 | |
100 | 100 | UINT8 length = (offset & 0x20) ? 200 : 4; |
101 | 101 | beep_set_state(m_beep, 1); |
102 | machine().scheduler().timer_set(attotime::from_msec(length), FUNC(h19_beepoff)); | |
102 | machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(h19_state::h19_beepoff),this)); | |
103 | 103 | } |
104 | 104 | |
105 | 105 | static ADDRESS_MAP_START(h19_mem, AS_PROGRAM, 8, h19_state) |
r18114 | r18115 | |
---|---|---|
108 | 108 | UINT8 tec1_convert_col_to_bin( UINT8 col, UINT8 row ); |
109 | 109 | virtual void machine_reset(); |
110 | 110 | virtual void machine_start(); |
111 | TIMER_CALLBACK_MEMBER(tec1_kbd_callback); | |
111 | 112 | }; |
112 | 113 | |
113 | 114 | |
r18114 | r18115 | |
209 | 210 | return data; |
210 | 211 | } |
211 | 212 | |
212 | ||
213 | TIMER_CALLBACK_MEMBER(tec1_state::tec1_kbd_callback) | |
213 | 214 | { |
214 | 215 | static const char *const keynames[] = { "LINE0", "LINE1", "LINE2", "LINE3" }; |
215 | tec1_state *state = machine.driver_data<tec1_state>(); | |
216 | 216 | UINT8 i; |
217 | 217 | |
218 | 218 | // Display the digits. Blank any digits that haven't been refreshed for a while. |
219 | 219 | // This will fix the problem reported by a user. |
220 | 220 | for (i = 0; i < 6; i++) |
221 | 221 | { |
222 | if (BIT( | |
222 | if (BIT(m_digit, i)) | |
223 | 223 | { |
224 | state->m_refresh[i] = 1; | |
225 | output_set_digit_value(i, state->m_segment); | |
224 | m_refresh[i] = 1; | |
225 | output_set_digit_value(i, m_segment); | |
226 | 226 | } |
227 | 227 | else |
228 | if ( | |
228 | if (m_refresh[i] == 0x80) | |
229 | 229 | { |
230 | 230 | output_set_digit_value(i, 0); |
231 | | |
231 | m_refresh[i] = 0; | |
232 | 232 | } |
233 | 233 | else |
234 | if (state->m_refresh[i]) | |
235 | state->m_refresh[i]++; | |
234 | if (m_refresh[i]) | |
235 | m_refresh[i]++; | |
236 | 236 | } |
237 | 237 | |
238 | 238 | // 74C923 4 by 5 key encoder. |
239 | 239 | // if previous key is still held, bail out |
240 | if (machine.root_device().ioport(keynames[state->m_kbd_row])->read()) | |
241 | if (state->tec1_convert_col_to_bin(machine.root_device().ioport(keynames[state->m_kbd_row])->read(), state->m_kbd_row) == state->m_kbd) | |
240 | if (machine().root_device().ioport(keynames[m_kbd_row])->read()) | |
241 | if (tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row) == m_kbd) | |
242 | 242 | return; |
243 | 243 | |
244 | state->m_kbd_row++; | |
245 | state->m_kbd_row &= 3; | |
244 | m_kbd_row++; | |
245 | m_kbd_row &= 3; | |
246 | 246 | |
247 | 247 | /* see if a key pressed */ |
248 | if (machine.root_device().ioport(keynames[ | |
248 | if (machine().root_device().ioport(keynames[m_kbd_row])->read()) | |
249 | 249 | { |
250 | state->m_kbd = state->tec1_convert_col_to_bin(machine.root_device().ioport(keynames[state->m_kbd_row])->read(), state->m_kbd_row); | |
251 | machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, HOLD_LINE); | |
252 | state->m_key_pressed = TRUE; | |
250 | m_kbd = tec1_convert_col_to_bin(machine().root_device().ioport(keynames[m_kbd_row])->read(), m_kbd_row); | |
251 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, HOLD_LINE); | |
252 | m_key_pressed = TRUE; | |
253 | 253 | } |
254 | 254 | else |
255 | | |
255 | m_key_pressed = FALSE; | |
256 | 256 | } |
257 | 257 | |
258 | 258 | |
r18114 | r18115 | |
264 | 264 | |
265 | 265 | void tec1_state::machine_start() |
266 | 266 | { |
267 | m_kbd_timer = machine().scheduler().timer_alloc(FUNC(tec1_kbd_callback)); | |
267 | m_kbd_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tec1_state::tec1_kbd_callback),this)); | |
268 | 268 | m_kbd_timer->adjust( attotime::zero, 0, attotime::from_hz(500) ); |
269 | 269 | } |
270 | 270 |
r18114 | r18115 | |
---|---|---|
80 | 80 | virtual void video_start(); |
81 | 81 | DECLARE_DRIVER_INIT(okean240); |
82 | 82 | UINT32 screen_update_okean240(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
83 | TIMER_CALLBACK_MEMBER(okean240_boot); | |
83 | 84 | }; |
84 | 85 | |
85 | 86 | // okean240 requires bit 4 to change |
r18114 | r18115 | |
356 | 357 | |
357 | 358 | |
358 | 359 | /* after the first 6 bytes have been read from ROM, switch the ram back in */ |
359 | ||
360 | TIMER_CALLBACK_MEMBER(okean240_state::okean240_boot) | |
360 | 361 | { |
361 | okean240_state *state = machine.driver_data<okean240_state>(); | |
362 | state->membank("boot")->set_entry(0); | |
362 | membank("boot")->set_entry(0); | |
363 | 363 | } |
364 | 364 | |
365 | 365 | void okean240_state::machine_reset() |
366 | 366 | { |
367 | machine().scheduler().timer_set(attotime::from_usec(10), FUNC(okean240_boot)); | |
367 | machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(okean240_state::okean240_boot),this)); | |
368 | 368 | membank("boot")->set_entry(1); |
369 | 369 | m_term_data = 0; |
370 | 370 | m_j = 0; |
r18114 | r18115 | |
---|---|---|
52 | 52 | |
53 | 53 | // timers |
54 | 54 | emu_timer *m_led_refresh_timer; |
55 | TIMER_CALLBACK_MEMBER(led_refresh); | |
55 | 56 | }; |
56 | 57 | |
57 | 58 | |
r18114 | r18115 | |
97 | 98 | PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED ) |
98 | 99 | INPUT_PORTS_END |
99 | 100 | |
100 | ||
101 | TIMER_CALLBACK_MEMBER(amico2k_state::led_refresh) | |
101 | 102 | { |
102 | amico2k_state *state = machine.driver_data<amico2k_state>(); | |
103 | 103 | |
104 | if ( | |
104 | if (m_ls145_p > 3) | |
105 | 105 | { |
106 | output_set_digit_value( | |
106 | output_set_digit_value(m_ls145_p - 4, m_segment); | |
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
r18114 | r18115 | |
206 | 206 | |
207 | 207 | void amico2k_state::machine_start() |
208 | 208 | { |
209 | m_led_refresh_timer = machine().scheduler().timer_alloc(FUNC(led_refresh)); | |
209 | m_led_refresh_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(amico2k_state::led_refresh),this)); | |
210 | 210 | |
211 | 211 | // state saving |
212 | 212 | save_item(NAME(m_ls145_p)); |
r18114 | r18115 | |
---|---|---|
114 | 114 | virtual void machine_reset(); |
115 | 115 | DECLARE_MACHINE_START(a2600); |
116 | 116 | DECLARE_MACHINE_START(a2600p); |
117 | TIMER_CALLBACK_MEMBER(modeDPC_timer_callback); | |
117 | 118 | }; |
118 | 119 | |
119 | 120 | |
r18114 | r18115 | |
959 | 960 | modeDPC_check_flag(data_fetcher ); |
960 | 961 | } |
961 | 962 | |
962 | ||
963 | TIMER_CALLBACK_MEMBER(a2600_state::modeDPC_timer_callback) | |
963 | 964 | { |
964 | a2600_state *state = machine.driver_data<a2600_state>(); | |
965 | 965 | int data_fetcher; |
966 | 966 | for( data_fetcher = 5; data_fetcher < 8; data_fetcher++ ) |
967 | 967 | { |
968 | if ( | |
968 | if ( m_dpc.df[data_fetcher].osc_clk ) | |
969 | 969 | { |
970 | | |
970 | modeDPC_decrement_counter(data_fetcher ); | |
971 | 971 | } |
972 | 972 | } |
973 | 973 | } |
r18114 | r18115 | |
1592 | 1592 | state->m_extra_RAM = machine.memory().region_alloc("user2", 0x8600, 1, ENDIANNESS_LITTLE); |
1593 | 1593 | memset( state->m_riot_ram, 0x00, 0x80 ); |
1594 | 1594 | state->m_current_reset_bank_counter = 0xFF; |
1595 | state->m_dpc.oscillator = machine.scheduler().timer_alloc(FUNC(modeDPC_timer_callback)); | |
1595 | state->m_dpc.oscillator = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(a2600_state::modeDPC_timer_callback),state)); | |
1596 | 1596 | } |
1597 | 1597 | |
1598 | 1598 | MACHINE_START_MEMBER(a2600_state,a2600) |
r18114 | r18115 | |
---|---|---|
93 | 93 | DECLARE_MACHINE_RESET(neogeo); |
94 | 94 | DECLARE_CUSTOM_INPUT_MEMBER(get_memcard_status); |
95 | 95 | |
96 | TIMER_CALLBACK_MEMBER(display_position_interrupt_callback); | |
97 | TIMER_CALLBACK_MEMBER(display_position_vblank_callback); | |
98 | TIMER_CALLBACK_MEMBER(vblank_interrupt_callback); | |
96 | 99 | }; |
97 | 100 | |
98 | 101 | |
r18114 | r18115 | |
171 | 174 | } |
172 | 175 | |
173 | 176 | |
174 | ||
177 | TIMER_CALLBACK_MEMBER(ng_aes_state::display_position_interrupt_callback) | |
175 | 178 | { |
176 | neogeo_state *state = machine.driver_data<neogeo_state>(); | |
177 | 179 | |
178 | if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); | |
180 | if (LOG_VIDEO_SYSTEM) logerror("--- Scanline @ %d,%d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); | |
179 | 181 | |
180 | if ( | |
182 | if (m_display_position_interrupt_control & IRQ2CTRL_ENABLE) | |
181 | 183 | { |
182 | if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); | |
183 | state->m_display_position_interrupt_pending = 1; | |
184 | if (LOG_VIDEO_SYSTEM) logerror("*** Scanline interrupt (IRQ2) *** y: %02x x: %02x\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); | |
185 | m_display_position_interrupt_pending = 1; | |
184 | 186 | |
185 | update_interrupts(machine); | |
187 | update_interrupts(machine()); | |
186 | 188 | } |
187 | 189 | |
188 | if ( | |
190 | if (m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_REPEAT) | |
189 | 191 | { |
190 | 192 | if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_REPEAT "); |
191 | adjust_display_position_interrupt_timer(machine); | |
193 | adjust_display_position_interrupt_timer(machine()); | |
192 | 194 | } |
193 | 195 | } |
194 | 196 | |
195 | 197 | |
196 | ||
198 | TIMER_CALLBACK_MEMBER(ng_aes_state::display_position_vblank_callback) | |
197 | 199 | { |
198 | neogeo_state *state = machine.driver_data<neogeo_state>(); | |
199 | 200 | |
200 | if ( | |
201 | if (m_display_position_interrupt_control & IRQ2CTRL_AUTOLOAD_VBLANK) | |
201 | 202 | { |
202 | 203 | if (LOG_VIDEO_SYSTEM) logerror("AUTOLOAD_VBLANK "); |
203 | adjust_display_position_interrupt_timer(machine); | |
204 | adjust_display_position_interrupt_timer(machine()); | |
204 | 205 | } |
205 | 206 | |
206 | 207 | /* set timer for next screen */ |
207 | | |
208 | m_display_position_vblank_timer->adjust(machine().primary_screen->time_until_pos(NEOGEO_VBSTART, NEOGEO_VBLANK_RELOAD_HPOS)); | |
208 | 209 | } |
209 | 210 | |
210 | 211 | |
211 | ||
212 | TIMER_CALLBACK_MEMBER(ng_aes_state::vblank_interrupt_callback) | |
212 | 213 | { |
213 | neogeo_state *state = machine.driver_data<neogeo_state>(); | |
214 | 214 | |
215 | if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", machine.primary_screen->vpos(), machine.primary_screen->hpos()); | |
215 | if (LOG_VIDEO_SYSTEM) logerror("+++ VBLANK @ %d,%d\n", machine().primary_screen->vpos(), machine().primary_screen->hpos()); | |
216 | 216 | |
217 | 217 | /* add a timer tick to the pd4990a */ |
218 | upd4990a_addretrace( | |
218 | upd4990a_addretrace(m_upd4990a); | |
219 | 219 | |
220 | | |
220 | m_vblank_interrupt_pending = 1; | |
221 | 221 | |
222 | update_interrupts(machine); | |
222 | update_interrupts(machine()); | |
223 | 223 | |
224 | 224 | /* set timer for next screen */ |
225 | | |
225 | m_vblank_interrupt_timer->adjust(machine().primary_screen->time_until_pos(NEOGEO_VBSTART, 0)); | |
226 | 226 | } |
227 | 227 | |
228 | 228 | |
229 | 229 | static void create_interrupt_timers( running_machine &machine ) |
230 | 230 | { |
231 | neogeo_state *state = machine.driver_data<neogeo_state>(); | |
232 | state->m_display_position_interrupt_timer = machine.scheduler().timer_alloc(FUNC(display_position_interrupt_callback)); | |
233 | state->m_display_position_vblank_timer = machine.scheduler().timer_alloc(FUNC(display_position_vblank_callback)); | |
234 | state->m_vblank_interrupt_timer = machine.scheduler().timer_alloc(FUNC(vblank_interrupt_callback)); | |
231 | ng_aes_state *state = machine.driver_data<ng_aes_state>(); | |
232 | state->m_display_position_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::display_position_interrupt_callback),state)); | |
233 | state->m_display_position_vblank_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::display_position_vblank_callback),state)); | |
234 | state->m_vblank_interrupt_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(ng_aes_state::vblank_interrupt_callback),state)); | |
235 | 235 | } |
236 | 236 | |
237 | 237 |
r18114 | r18115 | |
---|---|---|
65 | 65 | UINT8 m_segment; |
66 | 66 | UINT8 m_digit; |
67 | 67 | UINT8 m_keydata; |
68 | TIMER_CALLBACK_MEMBER(mekd2_trace); | |
68 | 69 | }; |
69 | 70 | |
70 | 71 | |
r18114 | r18115 | |
159 | 160 | |
160 | 161 | ************************************************************/ |
161 | 162 | |
162 | ||
163 | TIMER_CALLBACK_MEMBER(mekd2_state::mekd2_trace) | |
163 | 164 | { |
164 | machine.device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); | |
165 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, ASSERT_LINE); | |
165 | 166 | } |
166 | 167 | |
167 | 168 | WRITE_LINE_MEMBER( mekd2_state::mekd2_nmi_w ) |
r18114 | r18115 | |
169 | 170 | if (state) |
170 | 171 | machine().device("maincpu")->execute().set_input_line(INPUT_LINE_NMI, CLEAR_LINE); |
171 | 172 | else |
172 | machine().scheduler().timer_set(attotime::from_usec(18), FUNC(mekd2_trace)); | |
173 | machine().scheduler().timer_set(attotime::from_usec(18), timer_expired_delegate(FUNC(mekd2_state::mekd2_trace),this)); | |
173 | 174 | } |
174 | 175 | |
175 | 176 |
r18114 | r18115 | |
---|---|---|
55 | 55 | virtual void machine_start(); |
56 | 56 | |
57 | 57 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
58 | TIMER_CALLBACK_MEMBER(IOMD_timer0_callback); | |
59 | TIMER_CALLBACK_MEMBER(IOMD_timer1_callback); | |
60 | TIMER_CALLBACK_MEMBER(flyback_timer_callback); | |
58 | 61 | }; |
59 | 62 | |
60 | 63 | |
r18114 | r18115 | |
568 | 571 | m_IOMD_timer[timer]->adjust(attotime::from_usec(val), 0, attotime::from_usec(val)); |
569 | 572 | } |
570 | 573 | |
571 | ||
574 | TIMER_CALLBACK_MEMBER(a7000_state::IOMD_timer0_callback) | |
572 | 575 | { |
573 | a7000_state *state = machine.driver_data<a7000_state>(); | |
574 | state->m_IRQ_status_A|=0x20; | |
575 | if(state->m_IRQ_mask_A&0x20) | |
576 | m_IRQ_status_A|=0x20; | |
577 | if(m_IRQ_mask_A&0x20) | |
576 | 578 | { |
577 | generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); | |
579 | generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); | |
578 | 580 | } |
579 | 581 | } |
580 | 582 | |
581 | ||
583 | TIMER_CALLBACK_MEMBER(a7000_state::IOMD_timer1_callback) | |
582 | 584 | { |
583 | a7000_state *state = machine.driver_data<a7000_state>(); | |
584 | state->m_IRQ_status_A|=0x40; | |
585 | if(state->m_IRQ_mask_A&0x40) | |
585 | m_IRQ_status_A|=0x40; | |
586 | if(m_IRQ_mask_A&0x40) | |
586 | 587 | { |
587 | generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); | |
588 | generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); | |
588 | 589 | } |
589 | 590 | } |
590 | 591 | |
591 | ||
592 | TIMER_CALLBACK_MEMBER(a7000_state::flyback_timer_callback) | |
592 | 593 | { |
593 | a7000_state *state = machine.driver_data<a7000_state>(); | |
594 | state->m_IRQ_status_A|=0x08; | |
595 | if(state->m_IRQ_mask_A&0x08) | |
594 | m_IRQ_status_A|=0x08; | |
595 | if(m_IRQ_mask_A&0x08) | |
596 | 596 | { |
597 | generic_pulse_irq_line(machine.device("maincpu"), ARM7_IRQ_LINE,1); | |
597 | generic_pulse_irq_line(machine().device("maincpu")->execute(), ARM7_IRQ_LINE,1); | |
598 | 598 | } |
599 | 599 | |
600 | | |
600 | m_flyback_timer->adjust(machine().primary_screen->time_until_pos(m_vidc20_vert_reg[VDER])); | |
601 | 601 | } |
602 | 602 | |
603 | 603 | void a7000_state::viddma_transfer_start() |
r18114 | r18115 | |
766 | 766 | |
767 | 767 | void a7000_state::machine_start() |
768 | 768 | { |
769 | m_IOMD_timer[0] = machine().scheduler().timer_alloc(FUNC(IOMD_timer0_callback)); | |
770 | m_IOMD_timer[1] = machine().scheduler().timer_alloc(FUNC(IOMD_timer1_callback)); | |
771 | m_flyback_timer = machine().scheduler().timer_alloc(FUNC(flyback_timer_callback)); | |
769 | m_IOMD_timer[0] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::IOMD_timer0_callback),this)); | |
770 | m_IOMD_timer[1] = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::IOMD_timer1_callback),this)); | |
771 | m_flyback_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a7000_state::flyback_timer_callback),this)); | |
772 | 772 | |
773 | 773 | m_io_id = 0xd4e7; |
774 | 774 | } |
r18114 | r18115 | |
---|---|---|
132 | 132 | virtual void machine_start(); |
133 | 133 | virtual void machine_reset(); |
134 | 134 | INTERRUPT_GEN_MEMBER(ip22_vbl); |
135 | TIMER_CALLBACK_MEMBER(ip22_dma); | |
136 | TIMER_CALLBACK_MEMBER(ip22_timer); | |
135 | 137 | }; |
136 | 138 | |
137 | 139 | |
r18114 | r18115 | |
1073 | 1075 | #define PBUS_DMADESC_BC 0x00003fff |
1074 | 1076 | |
1075 | 1077 | |
1076 | ||
1078 | TIMER_CALLBACK_MEMBER(ip22_state::ip22_dma) | |
1077 | 1079 | { |
1078 | //ip22_state *state = machine.driver_data<ip22_state>(); | |
1079 | machine.scheduler().timer_set(attotime::never, FUNC(ip22_dma)); | |
1080 | machine().scheduler().timer_set(attotime::never, timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); | |
1080 | 1081 | #if 0 |
1081 | if( | |
1082 | if( m_PBUS_DMA.nActive ) | |
1082 | 1083 | { |
1083 | UINT16 temp16 = ( | |
1084 | UINT16 temp16 = ( m_mainram[(m_PBUS_DMA.nCurPtr - 0x08000000)/4] & 0xffff0000 ) >> 16; | |
1084 | 1085 | INT16 stemp16 = (INT16)((temp16 >> 8) | (temp16 << 8)); |
1085 | 1086 | |
1086 | machine.device<dac_device>("dac")->write_signed16(stemp16 ^ 0x8000); | |
1087 | machine().device<dac_device>("dac")->write_signed16(stemp16 ^ 0x8000); | |
1087 | 1088 | |
1088 | | |
1089 | m_PBUS_DMA.nCurPtr += 4; | |
1089 | 1090 | |
1090 | state->m_PBUS_DMA.nWordsLeft -= 4; | |
1091 | if( state->m_PBUS_DMA.nWordsLeft == 0 ) | |
1091 | m_PBUS_DMA.nWordsLeft -= 4; | |
1092 | if( m_PBUS_DMA.nWordsLeft == 0 ) | |
1092 | 1093 | { |
1093 | if( | |
1094 | if( m_PBUS_DMA.nNextPtr != 0 ) | |
1094 | 1095 | { |
1095 | state->m_PBUS_DMA.nDescPtr = state->m_PBUS_DMA.nNextPtr; | |
1096 | state->m_PBUS_DMA.nCurPtr = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4]; | |
1097 | state->m_PBUS_DMA.nWordsLeft = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; | |
1098 | state->m_PBUS_DMA.nNextPtr = state->m_mainram[(state->m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; | |
1096 | m_PBUS_DMA.nDescPtr = m_PBUS_DMA.nNextPtr; | |
1097 | m_PBUS_DMA.nCurPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4]; | |
1098 | m_PBUS_DMA.nWordsLeft = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+1]; | |
1099 | m_PBUS_DMA.nNextPtr = m_mainram[(m_PBUS_DMA.nDescPtr - 0x08000000)/4+2]; | |
1099 | 1100 | } |
1100 | 1101 | else |
1101 | 1102 | { |
1102 | | |
1103 | m_PBUS_DMA.nActive = 0; | |
1103 | 1104 | return; |
1104 | 1105 | } |
1105 | 1106 | } |
1106 | machine.scheduler().timer_set(attotime::from_hz(44100), FUNC(ip22_dma)); | |
1107 | machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); | |
1107 | 1108 | } |
1108 | 1109 | #endif |
1109 | 1110 | } |
r18114 | r18115 | |
1173 | 1174 | //verboselog((machine, 0, " FIFO End: Rowe %04x\n", ( data & PBUS_CTRL_FIFO_END ) >> 24 ); |
1174 | 1175 | if( ( data & PBUS_CTRL_DMASTART ) || ( data & PBUS_CTRL_LOAD_EN ) ) |
1175 | 1176 | { |
1176 | machine().scheduler().timer_set(attotime::from_hz(44100), FUNC(ip22_dma)); | |
1177 | machine().scheduler().timer_set(attotime::from_hz(44100), timer_expired_delegate(FUNC(ip22_state::ip22_dma),this)); | |
1177 | 1178 | m_PBUS_DMA.nActive = 1; |
1178 | 1179 | } |
1179 | 1180 | return; |
r18114 | r18115 | |
1216 | 1217 | ADDRESS_MAP_END |
1217 | 1218 | |
1218 | 1219 | |
1219 | ||
1220 | TIMER_CALLBACK_MEMBER(ip22_state::ip22_timer) | |
1220 | 1221 | { |
1221 | machine.scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer)); | |
1222 | machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this)); | |
1222 | 1223 | } |
1223 | 1224 | |
1224 | 1225 | void ip22_state::machine_reset() |
r18114 | r18115 | |
1230 | 1231 | RTC_REGISTERB = 0x08; |
1231 | 1232 | RTC_REGISTERD = 0x80; |
1232 | 1233 | |
1233 | machine().scheduler().timer_set(attotime::from_msec(1), FUNC(ip22_timer)); | |
1234 | machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(ip22_state::ip22_timer),this)); | |
1234 | 1235 | |
1235 | 1236 | // set up low RAM mirror |
1236 | 1237 | membank("bank1")->set_base(m_mainram); |
r18114 | r18115 | |
---|---|---|
129 | 129 | virtual void palette_init(); |
130 | 130 | UINT32 screen_update_socrates(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
131 | 131 | INTERRUPT_GEN_MEMBER(assert_irq); |
132 | TIMER_CALLBACK_MEMBER(clear_speech_cb); | |
133 | TIMER_CALLBACK_MEMBER(clear_irq_cb); | |
132 | 134 | }; |
133 | 135 | |
134 | 136 | |
r18114 | r18115 | |
331 | 333 | logerror("read from i/o 0x4x of %x\n", temp); |
332 | 334 | return temp; |
333 | 335 | } |
334 | ||
336 | TIMER_CALLBACK_MEMBER(socrates_state::clear_speech_cb) | |
335 | 337 | { |
336 | socrates_state *state = machine.driver_data<socrates_state>(); | |
337 | state->m_speech_running = 0; | |
338 | state->m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? | |
339 | state->m_speech_load_settings_count = 0; | |
338 | m_speech_running = 0; | |
339 | m_speech_load_address_count = 0; // should this be here or in the write functuon subpart which is speak command? | |
340 | m_speech_load_settings_count = 0; | |
340 | 341 | } |
341 | 342 | |
342 | 343 | WRITE8_MEMBER(socrates_state::speech_command)// write 0x4x, some sort of bitfield; speech chip is probably hitachi hd38880 related but not exact, w/4 bit interface |
r18114 | r18115 | |
399 | 400 | { |
400 | 401 | /* write me: start talking */ |
401 | 402 | m_speech_running = 1; |
402 | machine().scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack | |
403 | machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack | |
403 | 404 | } |
404 | 405 | break; |
405 | 406 | case 0x90: // unknown, one of these is probably read and branch |
r18114 | r18115 | |
423 | 424 | if ((data&0xF) == 0) // speak |
424 | 425 | { |
425 | 426 | m_speech_running = 1; |
426 | machine().scheduler().timer_set(attotime::from_seconds(4), FUNC(clear_speech_cb)); // hack | |
427 | machine().scheduler().timer_set(attotime::from_seconds(4), timer_expired_delegate(FUNC(socrates_state::clear_speech_cb),this)); // hack | |
427 | 428 | } |
428 | 429 | else if ((data&0xF) == 8) // reset |
429 | 430 | { |
r18114 | r18115 | |
903 | 904 | /****************************************************************************** |
904 | 905 | Machine Drivers |
905 | 906 | ******************************************************************************/ |
906 | ||
907 | TIMER_CALLBACK_MEMBER(socrates_state::clear_irq_cb) | |
907 | 908 | { |
908 | socrates_state *state = machine.driver_data<socrates_state>(); | |
909 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
910 | state->m_vblankstate = 0; | |
909 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
910 | m_vblankstate = 0; | |
911 | 911 | } |
912 | 912 | |
913 | 913 | INTERRUPT_GEN_MEMBER(socrates_state::assert_irq) |
914 | 914 | { |
915 | 915 | device.execute().set_input_line(0, ASSERT_LINE); |
916 | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(44), FUNC(clear_irq_cb)); | |
916 | machine().scheduler().timer_set(downcast<cpu_device *>(&device)->cycles_to_attotime(44), timer_expired_delegate(FUNC(socrates_state::clear_irq_cb),this)); | |
917 | 917 | // 44 is a complete and total guess, need to properly measure how many clocks/microseconds the int line is high for. |
918 | 918 | m_vblankstate = 1; |
919 | 919 | m_kbmcu_rscount = 0; // clear the mcu poke count |
r18114 | r18115 | |
---|---|---|
141 | 141 | virtual void video_start(); |
142 | 142 | UINT32 screen_update_vii(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
143 | 143 | INTERRUPT_GEN_MEMBER(vii_vblank); |
144 | TIMER_CALLBACK_MEMBER(tmb1_tick); | |
145 | TIMER_CALLBACK_MEMBER(tmb2_tick); | |
144 | 146 | }; |
145 | 147 | |
146 | 148 | enum |
r18114 | r18115 | |
979 | 981 | return IMAGE_INIT_PASS; |
980 | 982 | } |
981 | 983 | |
982 | ||
984 | TIMER_CALLBACK_MEMBER(vii_state::tmb1_tick) | |
983 | 985 | { |
984 | vii_state *state = machine.driver_data<vii_state>(); | |
985 | state->m_io_regs[0x22] |= 1; | |
986 | m_io_regs[0x22] |= 1; | |
986 | 987 | } |
987 | 988 | |
988 | ||
989 | TIMER_CALLBACK_MEMBER(vii_state::tmb2_tick) | |
989 | 990 | { |
990 | vii_state *state = machine.driver_data<vii_state>(); | |
991 | state->m_io_regs[0x22] |= 2; | |
991 | m_io_regs[0x22] |= 2; | |
992 | 992 | } |
993 | 993 | |
994 | 994 | void vii_state::machine_start() |
r18114 | r18115 | |
1012 | 1012 | m_video_regs[0x36] = 0xffff; |
1013 | 1013 | m_video_regs[0x37] = 0xffff; |
1014 | 1014 | |
1015 | m_tmb1 = machine().scheduler().timer_alloc(FUNC(tmb1_tick)); | |
1016 | m_tmb2 = machine().scheduler().timer_alloc(FUNC(tmb2_tick)); | |
1015 | m_tmb1 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb1_tick),this)); | |
1016 | m_tmb2 = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vii_state::tmb2_tick),this)); | |
1017 | 1017 | m_tmb1->reset(); |
1018 | 1018 | m_tmb2->reset(); |
1019 | 1019 | } |
r18114 | r18115 | |
---|---|---|
203 | 203 | UINT32 screen_update_supracan(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
204 | 204 | INTERRUPT_GEN_MEMBER(supracan_irq); |
205 | 205 | INTERRUPT_GEN_MEMBER(supracan_sound_irq); |
206 | TIMER_CALLBACK_MEMBER(supracan_hbl_callback); | |
207 | TIMER_CALLBACK_MEMBER(supracan_line_on_callback); | |
208 | TIMER_CALLBACK_MEMBER(supracan_line_off_callback); | |
209 | TIMER_CALLBACK_MEMBER(supracan_video_callback); | |
206 | 210 | }; |
207 | 211 | |
208 | 212 | |
r18114 | r18115 | |
1488 | 1492 | return data; |
1489 | 1493 | } |
1490 | 1494 | |
1491 | ||
1495 | TIMER_CALLBACK_MEMBER(supracan_state::supracan_hbl_callback) | |
1492 | 1496 | { |
1493 | supracan_state *state = machine.driver_data<supracan_state>(); | |
1494 | 1497 | |
1495 | | |
1498 | m_maincpu->set_input_line(3, HOLD_LINE); | |
1496 | 1499 | |
1497 | | |
1500 | m_hbl_timer->adjust(attotime::never); | |
1498 | 1501 | } |
1499 | 1502 | |
1500 | ||
1503 | TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_on_callback) | |
1501 | 1504 | { |
1502 | supracan_state *state = machine.driver_data<supracan_state>(); | |
1503 | 1505 | |
1504 | | |
1506 | m_maincpu->set_input_line(5, HOLD_LINE); | |
1505 | 1507 | |
1506 | | |
1508 | m_line_on_timer->adjust(attotime::never); | |
1507 | 1509 | } |
1508 | 1510 | |
1509 | ||
1511 | TIMER_CALLBACK_MEMBER(supracan_state::supracan_line_off_callback) | |
1510 | 1512 | { |
1511 | supracan_state *state = machine.driver_data<supracan_state>(); | |
1512 | 1513 | |
1513 | | |
1514 | m_maincpu->set_input_line(5, CLEAR_LINE); | |
1514 | 1515 | |
1515 | | |
1516 | m_line_on_timer->adjust(attotime::never); | |
1516 | 1517 | } |
1517 | 1518 | |
1518 | ||
1519 | TIMER_CALLBACK_MEMBER(supracan_state::supracan_video_callback) | |
1519 | 1520 | { |
1520 | supracan_state *state = machine.driver_data<supracan_state>(); | |
1521 | int vpos = machine.primary_screen->vpos(); | |
1521 | int vpos = machine().primary_screen->vpos(); | |
1522 | 1522 | |
1523 | | |
1523 | m_video_regs[0] &= ~0x0002; | |
1524 | 1524 | |
1525 | 1525 | switch( vpos ) |
1526 | 1526 | { |
1527 | 1527 | case 0: |
1528 | | |
1528 | m_video_regs[0] &= 0x7fff; | |
1529 | 1529 | |
1530 | 1530 | // we really need better management of this |
1531 | mark_active_tilemap_all_dirty(machine, 0); | |
1532 | mark_active_tilemap_all_dirty(machine, 1); | |
1533 | mark_active_tilemap_all_dirty(machine, 2); | |
1534 | mark_active_tilemap_all_dirty(machine, 3); | |
1531 | mark_active_tilemap_all_dirty(machine(), 0); | |
1532 | mark_active_tilemap_all_dirty(machine(), 1); | |
1533 | mark_active_tilemap_all_dirty(machine(), 2); | |
1534 | mark_active_tilemap_all_dirty(machine(), 3); | |
1535 | 1535 | |
1536 | 1536 | |
1537 | 1537 | break; |
1538 | 1538 | |
1539 | 1539 | case 224://FIXME: Son of Evil is pretty picky about this one, a timing of 240 makes it to crash |
1540 | | |
1540 | m_video_regs[0] |= 0x8000; | |
1541 | 1541 | break; |
1542 | 1542 | |
1543 | 1543 | case 240: |
1544 | if( | |
1544 | if(m_irq_mask & 1) | |
1545 | 1545 | { |
1546 | verboselog("maincpu", machine, 0, "Triggering VBL IRQ\n\n"); | |
1547 | state->m_maincpu->set_input_line(7, HOLD_LINE); | |
1546 | verboselog("maincpu", machine(), 0, "Triggering VBL IRQ\n\n"); | |
1547 | m_maincpu->set_input_line(7, HOLD_LINE); | |
1548 | 1548 | } |
1549 | 1549 | break; |
1550 | 1550 | } |
1551 | 1551 | |
1552 | | |
1552 | m_video_regs[1] = machine().primary_screen->vpos()-16; // for son of evil, wants vblank active around 224 instead... | |
1553 | 1553 | |
1554 | state->m_hbl_timer->adjust( machine.primary_screen->time_until_pos( vpos, 320 ) ); | |
1555 | state->m_video_timer->adjust( machine.primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); | |
1554 | m_hbl_timer->adjust( machine().primary_screen->time_until_pos( vpos, 320 ) ); | |
1555 | m_video_timer->adjust( machine().primary_screen->time_until_pos( ( vpos + 1 ) % 256, 0 ) ); | |
1556 | 1556 | } |
1557 | 1557 | |
1558 | 1558 | WRITE16_MEMBER( supracan_state::supracan_video_w ) |
r18114 | r18115 | |
1774 | 1774 | void supracan_state::machine_start() |
1775 | 1775 | { |
1776 | 1776 | |
1777 | m_video_timer = machine().scheduler().timer_alloc(FUNC(supracan_video_callback)); | |
1778 | m_hbl_timer = machine().scheduler().timer_alloc(FUNC(supracan_hbl_callback)); | |
1779 | m_line_on_timer = machine().scheduler().timer_alloc(FUNC(supracan_line_on_callback)); | |
1780 | m_line_off_timer = machine().scheduler().timer_alloc(FUNC(supracan_line_off_callback)); | |
1777 | m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_video_callback),this)); | |
1778 | m_hbl_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_hbl_callback),this)); | |
1779 | m_line_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_on_callback),this)); | |
1780 | m_line_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supracan_state::supracan_line_off_callback),this)); | |
1781 | 1781 | } |
1782 | 1782 | |
1783 | 1783 |
r18114 | r18115 | |
---|---|---|
206 | 206 | DECLARE_DRIVER_INIT(pyuuta); |
207 | 207 | virtual void machine_start(); |
208 | 208 | virtual void machine_reset(); |
209 | TIMER_CALLBACK_MEMBER(tape_interrupt_handler); | |
209 | 210 | }; |
210 | 211 | |
211 | 212 | |
212 | 213 | /* mapper state */ |
213 | 214 | |
214 | 215 | /* tape interface state */ |
215 | static TIMER_CALLBACK(tape_interrupt_handler); | |
216 | 216 | |
217 | 217 | |
218 | ||
218 | 219 | /* parallel interface state */ |
219 | 220 | |
220 | 221 | enum |
r18114 | r18115 | |
226 | 227 | |
227 | 228 | DRIVER_INIT_MEMBER(tutor_state,tutor) |
228 | 229 | { |
229 | m_tape_interrupt_timer = machine().scheduler().timer_alloc(FUNC(tape_interrupt_handler)); | |
230 | m_tape_interrupt_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(tutor_state::tape_interrupt_handler),this)); | |
230 | 231 | |
231 | 232 | membank("bank1")->configure_entry(0, machine().root_device().memregion("maincpu")->base() + basic_base); |
232 | 233 | membank("bank1")->configure_entry(1, memregion("maincpu")->base() + cartridge_base); |
r18114 | r18115 | |
400 | 401 | know their exact meaning. |
401 | 402 | */ |
402 | 403 | |
403 | ||
404 | TIMER_CALLBACK_MEMBER(tutor_state::tape_interrupt_handler) | |
404 | 405 | { |
405 | tutor_state *state = machine.driver_data<tutor_state>(); | |
406 | //assert(state->m_tape_interrupt_enable); | |
407 | machine.device("maincpu")->execute().set_input_line(1, (state->m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); | |
406 | //assert(m_tape_interrupt_enable); | |
407 | machine().device("maincpu")->execute().set_input_line(1, (m_cass->input() > 0.0) ? ASSERT_LINE : CLEAR_LINE); | |
408 | 408 | } |
409 | 409 | |
410 | 410 | /* CRU handler */ |
r18114 | r18115 | |
---|---|---|
100 | 100 | virtual void machine_reset(); |
101 | 101 | virtual void palette_init(); |
102 | 102 | UINT32 screen_update_pv1000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
103 | TIMER_CALLBACK_MEMBER(d65010_irq_on_cb); | |
104 | TIMER_CALLBACK_MEMBER(d65010_irq_off_cb); | |
103 | 105 | }; |
104 | 106 | |
105 | 107 | |
r18114 | r18115 | |
345 | 347 | |
346 | 348 | /* Interrupt is triggering 16 times during vblank. */ |
347 | 349 | /* we have chosen to trigger on scanlines 195, 199, 203, 207, 211, 215, 219, 223, 227, 231, 235, 239, 243, 247, 251, 255 */ |
348 | ||
350 | TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_on_cb) | |
349 | 351 | { |
350 | pv1000_state *state = machine.driver_data<pv1000_state>(); | |
351 | int vpos = state->m_screen->vpos(); | |
352 | int vpos = m_screen->vpos(); | |
352 | 353 | int next_vpos = vpos + 12; |
353 | 354 | |
354 | 355 | /* Set IRQ line and schedule release of IRQ line */ |
355 | state->m_maincpu->set_input_line(0, ASSERT_LINE ); | |
356 | state->m_irq_off_timer->adjust( state->m_screen->time_until_pos(vpos, 380/2 ) ); | |
356 | m_maincpu->set_input_line(0, ASSERT_LINE ); | |
357 | m_irq_off_timer->adjust( m_screen->time_until_pos(vpos, 380/2 ) ); | |
357 | 358 | |
358 | 359 | /* Schedule next IRQ trigger */ |
359 | 360 | if ( vpos >= 255 ) |
360 | 361 | { |
361 | 362 | next_vpos = 195; |
362 | 363 | } |
363 | | |
364 | m_irq_on_timer->adjust( m_screen->time_until_pos(next_vpos, 0 ) ); | |
364 | 365 | } |
365 | 366 | |
366 | 367 | |
367 | ||
368 | TIMER_CALLBACK_MEMBER(pv1000_state::d65010_irq_off_cb) | |
368 | 369 | { |
369 | pv1000_state *state = machine.driver_data<pv1000_state>(); | |
370 | 370 | |
371 | | |
371 | m_maincpu->set_input_line(0, CLEAR_LINE ); | |
372 | 372 | } |
373 | 373 | |
374 | 374 | |
375 | 375 | void pv1000_state::machine_start() |
376 | 376 | { |
377 | 377 | |
378 | m_irq_on_timer = machine().scheduler().timer_alloc(FUNC(d65010_irq_on_cb)); | |
379 | m_irq_off_timer = machine().scheduler().timer_alloc(FUNC(d65010_irq_off_cb)); | |
378 | m_irq_on_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_on_cb),this)); | |
379 | m_irq_off_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pv1000_state::d65010_irq_off_cb),this)); | |
380 | 380 | } |
381 | 381 | |
382 | 382 |
r18114 | r18115 | |
---|---|---|
47 | 47 | virtual void machine_reset(); |
48 | 48 | virtual void video_start(); |
49 | 49 | UINT32 screen_update_sys2900(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
50 | TIMER_CALLBACK_MEMBER(sys2900_boot); | |
50 | 51 | }; |
51 | 52 | |
52 | 53 | |
r18114 | r18115 | |
69 | 70 | |
70 | 71 | |
71 | 72 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
72 | ||
73 | TIMER_CALLBACK_MEMBER(sys2900_state::sys2900_boot) | |
73 | 74 | { |
74 | sys2900_state *state = machine.driver_data<sys2900_state>(); | |
75 | state->membank("boot")->set_entry(0); | |
75 | membank("boot")->set_entry(0); | |
76 | 76 | } |
77 | 77 | |
78 | 78 | void sys2900_state::machine_reset() |
79 | 79 | { |
80 | 80 | membank("boot")->set_entry(1); |
81 | machine().scheduler().timer_set(attotime::from_usec(5), FUNC(sys2900_boot)); | |
81 | machine().scheduler().timer_set(attotime::from_usec(5), timer_expired_delegate(FUNC(sys2900_state::sys2900_boot),this)); | |
82 | 82 | } |
83 | 83 | |
84 | 84 | DRIVER_INIT_MEMBER(sys2900_state,sys2900) |
r18114 | r18115 | |
---|---|---|
71 | 71 | DECLARE_VIDEO_START(swyft); |
72 | 72 | UINT32 screen_update_cat(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
73 | 73 | UINT32 screen_update_swyft(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
74 | TIMER_CALLBACK_MEMBER(keyboard_callback); | |
75 | TIMER_CALLBACK_MEMBER(swyft_reset); | |
74 | 76 | }; |
75 | 77 | |
76 | 78 | WRITE16_MEMBER( cat_state::cat_video_status_w ) |
r18114 | r18115 | |
297 | 299 | INPUT_PORTS_END |
298 | 300 | |
299 | 301 | |
300 | ||
302 | TIMER_CALLBACK_MEMBER(cat_state::keyboard_callback) | |
301 | 303 | { |
302 | machine.device("maincpu")->execute().set_input_line(M68K_IRQ_1, ASSERT_LINE); | |
304 | machine().device("maincpu")->execute().set_input_line(M68K_IRQ_1, ASSERT_LINE); | |
303 | 305 | } |
304 | 306 | |
305 | 307 | static IRQ_CALLBACK(cat_int_ack) |
r18114 | r18115 | |
312 | 314 | { |
313 | 315 | |
314 | 316 | m_duart_inp = 0x0e; |
315 | m_keyboard_timer = machine().scheduler().timer_alloc(FUNC(keyboard_callback)); | |
317 | m_keyboard_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(cat_state::keyboard_callback),this)); | |
316 | 318 | machine().device<nvram_device>("nvram")->set_base(m_p_sram, 0x4000); |
317 | 319 | } |
318 | 320 | |
r18114 | r18115 | |
353 | 355 | return 0; |
354 | 356 | } |
355 | 357 | |
356 | ||
358 | TIMER_CALLBACK_MEMBER(cat_state::swyft_reset) | |
357 | 359 | { |
358 | memset(machine.device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0xe2341), 0xff, 1); | |
360 | memset(machine().device("maincpu")->memory().space(AS_PROGRAM).get_read_ptr(0xe2341), 0xff, 1); | |
359 | 361 | } |
360 | 362 | |
361 | 363 | MACHINE_START_MEMBER(cat_state,swyft) |
r18114 | r18115 | |
364 | 366 | |
365 | 367 | MACHINE_RESET_MEMBER(cat_state,swyft) |
366 | 368 | { |
367 | machine().scheduler().timer_set(attotime::from_usec(10), FUNC(swyft_reset)); | |
369 | machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(cat_state::swyft_reset),this)); | |
368 | 370 | } |
369 | 371 | |
370 | 372 | VIDEO_START_MEMBER(cat_state,swyft) |
r18114 | r18115 | |
---|---|---|
71 | 71 | virtual void machine_reset(); |
72 | 72 | DECLARE_DRIVER_INIT(supercon); |
73 | 73 | virtual void machine_start(); |
74 | TIMER_CALLBACK_MEMBER(mouse_click); | |
75 | TIMER_CALLBACK_MEMBER(update_irq); | |
74 | 76 | }; |
75 | 77 | |
76 | 78 | |
r18114 | r18115 | |
503 | 505 | beep_set_state(m_beep ,0); |
504 | 506 | } |
505 | 507 | |
506 | ||
508 | TIMER_CALLBACK_MEMBER(supercon_state::mouse_click) | |
507 | 509 | { |
508 | supercon_state *state = machine.driver_data<supercon_state>(); | |
509 | 510 | |
510 | if (state->ioport("BUTTON_L")->read_safe(0) ) /* wait for mouse release */ | |
511 | state->m_timer_mouse_click->adjust(state->m_wait_time, 0); | |
511 | if (ioport("BUTTON_L")->read_safe(0) ) /* wait for mouse release */ | |
512 | m_timer_mouse_click->adjust(m_wait_time, 0); | |
512 | 513 | else |
513 | | |
514 | m_selecting=FALSE; | |
514 | 515 | } |
515 | 516 | |
516 | 517 | static TIMER_DEVICE_CALLBACK( update_artwork ) |
r18114 | r18115 | |
518 | 519 | mouse_update(timer.machine()); |
519 | 520 | } |
520 | 521 | |
521 | ||
522 | TIMER_CALLBACK_MEMBER(supercon_state::update_irq) | |
522 | 523 | { |
523 | machine.device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); | |
524 | machine.device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); | |
524 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, ASSERT_LINE); | |
525 | machine().device("maincpu")->execute().set_input_line(M6502_IRQ_LINE, CLEAR_LINE); | |
525 | 526 | } |
526 | 527 | |
527 | 528 | /* Save state call backs */ |
r18114 | r18115 | |
544 | 545 | |
545 | 546 | void supercon_state::machine_start() |
546 | 547 | { |
547 | m_timer_update_irq = machine().scheduler().timer_alloc(FUNC(update_irq)); | |
548 | m_timer_update_irq = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::update_irq),this)); | |
548 | 549 | m_timer_update_irq->adjust( attotime::zero, 0, attotime::from_hz(1000) ); |
549 | m_timer_mouse_click = machine().scheduler().timer_alloc(FUNC(mouse_click),NULL); | |
550 | m_timer_mouse_click = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(supercon_state::mouse_click),this),NULL); | |
550 | 551 | save_item(NAME(m_save_board)); |
551 | 552 | machine().save().register_postload(save_prepost_delegate(FUNC(board_postload),this)); |
552 | 553 | machine().save().register_presave(save_prepost_delegate(FUNC(board_presave),this)); |
r18114 | r18115 | |
---|---|---|
71 | 71 | static const device_timer_id SERIAL_TIMER = 1; |
72 | 72 | UINT8 m_timer_bit; |
73 | 73 | virtual void palette_init(); |
74 | TIMER_CALLBACK_MEMBER(alphatro_beepoff); | |
74 | 75 | }; |
75 | 76 | |
76 | ||
77 | TIMER_CALLBACK_MEMBER(alphatro_state::alphatro_beepoff) | |
77 | 78 | { |
78 | alphatro_state *state = machine.driver_data<alphatro_state>(); | |
79 | beep_set_state(state->m_beep, 0); | |
79 | beep_set_state(m_beep, 0); | |
80 | 80 | } |
81 | 81 | |
82 | 82 | READ8_MEMBER( alphatro_state::port10_r ) |
r18114 | r18115 | |
101 | 101 | |
102 | 102 | if (length) |
103 | 103 | { |
104 | machine().scheduler().timer_set(attotime::from_msec(length), FUNC(alphatro_beepoff)); | |
104 | machine().scheduler().timer_set(attotime::from_msec(length), timer_expired_delegate(FUNC(alphatro_state::alphatro_beepoff),this)); | |
105 | 105 | beep_set_state(m_beep, 1); |
106 | 106 | } |
107 | 107 |
r18114 | r18115 | |
---|---|---|
452 | 452 | DECLARE_MACHINE_RESET(pc8801_dic); |
453 | 453 | DECLARE_MACHINE_RESET(pc8801_cdrom); |
454 | 454 | INTERRUPT_GEN_MEMBER(pc8801_vrtc_irq); |
455 | TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); | |
455 | 456 | }; |
456 | 457 | |
457 | 458 | |
r18114 | r18115 | |
1877 | 1878 | AM_RANGE(0x4000, 0x7fff) AM_RAM |
1878 | 1879 | ADDRESS_MAP_END |
1879 | 1880 | |
1880 | ||
1881 | TIMER_CALLBACK_MEMBER(pc8801_state::pc8801fd_upd765_tc_to_zero) | |
1881 | 1882 | { |
1882 | // pc8801_state *state = machine.driver_data<pc8801_state>(); | |
1883 | 1883 | |
1884 | 1884 | //printf("0\n"); |
1885 | upd765_tc_w(machine.device("upd765"), 0); | |
1885 | upd765_tc_w(machine().device("upd765"), 0); | |
1886 | 1886 | } |
1887 | 1887 | |
1888 | 1888 | WRITE8_MEMBER(pc8801_state::upd765_mc_w) |
r18114 | r18115 | |
1899 | 1899 | |
1900 | 1900 | upd765_tc_w(machine().device("upd765"), 1); |
1901 | 1901 | //TODO: I'm not convinced that this works correctly with current hook-up ... 1000 usec is needed by Aploon, a bigger value breaks Alpha. |
1902 | machine().scheduler().timer_set(attotime::from_usec(750), FUNC(pc8801fd_upd765_tc_to_zero)); | |
1902 | machine().scheduler().timer_set(attotime::from_usec(750), timer_expired_delegate(FUNC(pc8801_state::pc8801fd_upd765_tc_to_zero),this)); | |
1903 | 1903 | return 0xff; // value is meaningless |
1904 | 1904 | } |
1905 | 1905 |
r18114 | r18115 | |
---|---|---|
55 | 55 | DECLARE_DIRECT_UPDATE_MEMBER(psx_setopbase); |
56 | 56 | DECLARE_DRIVER_INIT(psx); |
57 | 57 | DECLARE_MACHINE_RESET(psx); |
58 | TIMER_CALLBACK_MEMBER(psx_pad_ack); | |
58 | 59 | }; |
59 | 60 | |
60 | 61 | |
r18114 | r18115 | |
493 | 494 | #define PAD_DATA_OK ( 0x5a ) /* Z */ |
494 | 495 | #define PAD_DATA_IDLE ( 0xff ) |
495 | 496 | |
496 | ||
497 | TIMER_CALLBACK_MEMBER(psx1_state::psx_pad_ack) | |
497 | 498 | { |
498 | psx1_state *state = machine.driver_data<psx1_state>(); | |
499 | 499 | int n_port = param; |
500 | pad_t *pad = & | |
500 | pad_t *pad = &m_pad[ n_port ]; | |
501 | 501 | |
502 | 502 | if( pad->n_state != PAD_STATE_IDLE ) |
503 | 503 | { |
504 | psx_sio_input( machine, 0, PSX_SIO_IN_DSR, pad->b_ack * PSX_SIO_IN_DSR ); | |
504 | psx_sio_input( machine(), 0, PSX_SIO_IN_DSR, pad->b_ack * PSX_SIO_IN_DSR ); | |
505 | 505 | if( !pad->b_ack ) |
506 | 506 | { |
507 | 507 | pad->b_ack = 1; |
508 | machine.scheduler().timer_set(attotime::from_usec( 2 ), FUNC(psx_pad_ack) , n_port); | |
508 | machine().scheduler().timer_set(attotime::from_usec( 2 ), timer_expired_delegate(FUNC(psx1_state::psx_pad_ack),this) , n_port); | |
509 | 509 | } |
510 | 510 | } |
511 | 511 | } |
r18114 | r18115 | |
650 | 650 | if( b_ack ) |
651 | 651 | { |
652 | 652 | pad->b_ack = 0; |
653 | machine.scheduler().timer_set(attotime::from_usec( 10 ), FUNC(psx_pad_ack), n_port); | |
653 | machine.scheduler().timer_set(attotime::from_usec( 10 ), timer_expired_delegate(FUNC(psx1_state::psx_pad_ack),state), n_port); | |
654 | 654 | } |
655 | 655 | } |
656 | 656 |
r18114 | r18115 | |
---|---|---|
29 | 29 | virtual void video_start(); |
30 | 30 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
31 | 31 | DECLARE_DRIVER_INIT(c10); |
32 | TIMER_CALLBACK_MEMBER(c10_reset); | |
32 | 33 | }; |
33 | 34 | |
34 | 35 | |
r18114 | r18115 | |
51 | 52 | INPUT_PORTS_END |
52 | 53 | |
53 | 54 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
54 | ||
55 | TIMER_CALLBACK_MEMBER(c10_state::c10_reset) | |
55 | 56 | { |
56 | c10_state *state = machine.driver_data<c10_state>(); | |
57 | state->membank("boot")->set_entry(0); | |
57 | membank("boot")->set_entry(0); | |
58 | 58 | } |
59 | 59 | |
60 | 60 | void c10_state::machine_reset() |
61 | 61 | { |
62 | 62 | membank("boot")->set_entry(1); |
63 | machine().scheduler().timer_set(attotime::from_usec(4), FUNC(c10_reset)); | |
63 | machine().scheduler().timer_set(attotime::from_usec(4), timer_expired_delegate(FUNC(c10_state::c10_reset),this)); | |
64 | 64 | } |
65 | 65 | |
66 | 66 | void c10_state::video_start() |
r18114 | r18115 | |
---|---|---|
53 | 53 | virtual void video_start(); |
54 | 54 | virtual void palette_init(); |
55 | 55 | UINT32 screen_update_jr200(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
56 | TIMER_CALLBACK_MEMBER(timer_d_callback); | |
56 | 57 | }; |
57 | 58 | |
58 | 59 | |
r18114 | r18115 | |
283 | 284 | } |
284 | 285 | |
285 | 286 | |
286 | ||
287 | TIMER_CALLBACK_MEMBER(jr200_state::timer_d_callback) | |
287 | 288 | { |
288 | machine.firstcpu->set_input_line(0, HOLD_LINE); | |
289 | machine().firstcpu->set_input_line(0, HOLD_LINE); | |
289 | 290 | } |
290 | 291 | |
291 | 292 | READ8_MEMBER(jr200_state::mn1271_io_r) |
r18114 | r18115 | |
484 | 485 | { |
485 | 486 | beep_set_frequency(machine().device(BEEPER_TAG),0); |
486 | 487 | beep_set_state(machine().device(BEEPER_TAG),0); |
487 | m_timer_d = machine().scheduler().timer_alloc(FUNC(timer_d_callback)); | |
488 | m_timer_d = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(jr200_state::timer_d_callback),this)); | |
488 | 489 | } |
489 | 490 | |
490 | 491 | void jr200_state::machine_reset() |
r18114 | r18115 | |
---|---|---|
194 | 194 | DECLARE_READ16_MEMBER(spc_semaphore_r); |
195 | 195 | DECLARE_DRIVER_INIT(dectalk); |
196 | 196 | virtual void machine_reset(); |
197 | TIMER_CALLBACK_MEMBER(outfifo_read_cb); | |
197 | 198 | }; |
198 | 199 | |
199 | 200 | |
r18114 | r18115 | |
697 | 698 | /****************************************************************************** |
698 | 699 | Machine Drivers |
699 | 700 | ******************************************************************************/ |
700 | ||
701 | TIMER_CALLBACK_MEMBER(dectalk_state::outfifo_read_cb) | |
701 | 702 | { |
702 | 703 | UINT16 data; |
703 | dac_device *speaker = machine.device<dac_device>("dac"); | |
704 | data = dectalk_outfifo_r(machine); | |
704 | dac_device *speaker = machine().device<dac_device>("dac"); | |
705 | data = dectalk_outfifo_r(machine()); | |
705 | 706 | #ifdef VERBOSE |
706 | 707 | if (data!= 0x8000) logerror("sample output: %04X\n", data); |
707 | 708 | #endif |
708 | machine.scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb)); | |
709 | machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this)); | |
709 | 710 | speaker->write_signed16(data); |
710 | 711 | } |
711 | 712 | |
r18114 | r18115 | |
714 | 715 | { |
715 | 716 | dectalk_clear_all_fifos(machine()); |
716 | 717 | m_simulate_outfifo_error = 0; |
717 | machine().scheduler().timer_set(attotime::from_hz(10000), FUNC(outfifo_read_cb)); | |
718 | machine().scheduler().timer_set(attotime::from_hz(10000), timer_expired_delegate(FUNC(dectalk_state::outfifo_read_cb),this)); | |
718 | 719 | } |
719 | 720 | |
720 | 721 | static WRITE8_DEVICE_HANDLER( dectalk_kbd_put ) |
r18114 | r18115 | |
---|---|---|
110 | 110 | DECLARE_DRIVER_INIT(osbexec); |
111 | 111 | virtual void machine_reset(); |
112 | 112 | virtual void palette_init(); |
113 | TIMER_CALLBACK_MEMBER(osbexec_video_callback); | |
113 | 114 | }; |
114 | 115 | |
115 | 116 | |
r18114 | r18115 | |
551 | 552 | }; |
552 | 553 | |
553 | 554 | |
554 | ||
555 | TIMER_CALLBACK_MEMBER(osbexec_state::osbexec_video_callback) | |
555 | 556 | { |
556 | osbexec_state *state = machine.driver_data<osbexec_state>(); | |
557 | int y = machine.primary_screen->vpos(); | |
557 | int y = machine().primary_screen->vpos(); | |
558 | 558 | |
559 | 559 | /* Start of frame */ |
560 | 560 | if ( y == 0 ) |
561 | 561 | { |
562 | 562 | /* Clear CB1 on PIA @ UD12 */ |
563 | | |
563 | m_pia_0->cb1_w(0); | |
564 | 564 | } |
565 | 565 | else if ( y == 240 ) |
566 | 566 | { |
567 | 567 | /* Set CB1 on PIA @ UD12 */ |
568 | state->m_pia_0->cb1_w(1); | |
569 | state->m_rtc++; | |
568 | m_pia_0->cb1_w(1); | |
569 | m_rtc++; | |
570 | 570 | } |
571 | 571 | if ( y < 240 ) |
572 | 572 | { |
573 | 573 | UINT16 row_addr = ( y / 10 ) * 128; |
574 | UINT16 *p = & | |
574 | UINT16 *p = &m_bitmap.pix16(y); | |
575 | 575 | UINT8 char_line = y % 10; |
576 | 576 | |
577 | 577 | for ( int x = 0; x < 80; x++ ) |
578 | 578 | { |
579 | UINT8 ch = state->m_vram[ row_addr + x ]; | |
580 | UINT8 attr = state->m_vram[ 0x1000 + row_addr + x ]; | |
579 | UINT8 ch = m_vram[ row_addr + x ]; | |
580 | UINT8 attr = m_vram[ 0x1000 + row_addr + x ]; | |
581 | 581 | UINT8 fg_col = ( attr & 0x80 ) ? 1 : 2; |
582 | UINT8 font_bits = | |
582 | UINT8 font_bits = m_fontram[ ( ( attr & 0x10 ) ? 0x800 : 0 ) + ( ch & 0x7f ) * 16 + char_line ]; | |
583 | 583 | |
584 | 584 | /* Check for underline */ |
585 | 585 | if ( ( attr & 0x40 ) && char_line == 9 ) |
586 | 586 | font_bits = 0xFF; |
587 | 587 | |
588 | 588 | /* Check for blink */ |
589 | if ( ( attr & 0x20 ) && ( | |
589 | if ( ( attr & 0x20 ) && ( m_rtc & 0x10 ) ) | |
590 | 590 | font_bits = 0; |
591 | 591 | |
592 | 592 | /* Check for inverse video */ |
r18114 | r18115 | |
601 | 601 | } |
602 | 602 | } |
603 | 603 | |
604 | | |
604 | m_video_timer->adjust( machine().primary_screen->time_until_pos( y + 1, 0 ) ); | |
605 | 605 | } |
606 | 606 | |
607 | 607 | |
r18114 | r18115 | |
617 | 617 | memset( m_fontram, 0x00, 0x1000 ); |
618 | 618 | memset( m_vram, 0x00, 0x2000 ); |
619 | 619 | |
620 | m_video_timer = machine().scheduler().timer_alloc(FUNC(osbexec_video_callback)); | |
620 | m_video_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(osbexec_state::osbexec_video_callback),this)); | |
621 | 621 | } |
622 | 622 | |
623 | 623 |
r18114 | r18115 | |
---|---|---|
37 | 37 | * I/O devices * |
38 | 38 | \****************************************************/ |
39 | 39 | |
40 | static TIMER_CALLBACK( avr8_timer0_tick ); | |
41 | static TIMER_CALLBACK( avr8_timer1_tick ); | |
42 | static TIMER_CALLBACK( avr8_timer2_tick ); | |
43 | 40 | |
41 | ||
42 | ||
43 | ||
44 | 44 | class craft_state : public driver_device |
45 | 45 | { |
46 | 46 | public: |
r18114 | r18115 | |
74 | 74 | DECLARE_DRIVER_INIT(craft); |
75 | 75 | virtual void machine_reset(); |
76 | 76 | UINT32 screen_update_craft(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
77 | TIMER_CALLBACK_MEMBER(avr8_timer0_tick); | |
78 | TIMER_CALLBACK_MEMBER(avr8_timer1_tick); | |
79 | TIMER_CALLBACK_MEMBER(avr8_timer2_tick); | |
77 | 80 | }; |
78 | 81 | |
79 | 82 | void craft_state::machine_start() |
80 | 83 | { |
81 | m_timer0_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer0_tick)); | |
82 | m_timer1_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer1_tick)); | |
83 | m_timer2_timer = machine().scheduler().timer_alloc(FUNC(avr8_timer2_tick)); | |
84 | m_timer0_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer0_tick),this)); | |
85 | m_timer1_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer1_tick),this)); | |
86 | m_timer2_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(craft_state::avr8_timer2_tick),this)); | |
84 | 87 | } |
85 | 88 | enum |
86 | 89 | { |
r18114 | r18115 | |
92 | 95 | |
93 | 96 | static const char avr8_reg_name[4] = { 'A', 'B', 'C', 'D' }; |
94 | 97 | |
95 | ||
98 | TIMER_CALLBACK_MEMBER(craft_state::avr8_timer0_tick) | |
96 | 99 | { |
97 | 100 | // TODO |
98 | 101 | } |
99 | 102 | |
100 | ||
103 | TIMER_CALLBACK_MEMBER(craft_state::avr8_timer1_tick) | |
101 | 104 | { |
102 | 105 | /* TODO: Handle comparison, setting OC1x pins, detection of BOTTOM and TOP |
103 | 106 | |
104 | craft_state *state = machine.driver_data<craft_state>(); | |
105 | 107 | UINT16 count = AVR8_TCNT1; |
106 | count += | |
108 | count += m_timer1_increment; | |
107 | 109 | |
108 | 110 | for(INT32 reg = AVR8_REG_A; reg <= AVR8_REG_B; reg++) |
109 | 111 | { |
r18114 | r18115 | |
111 | 113 | switch(mode) |
112 | 114 | { |
113 | 115 | case 0: |
114 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); | |
116 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); | |
115 | 117 | break; |
116 | 118 | |
117 | 119 | case 1: |
r18114 | r18115 | |
128 | 130 | case Avr8::WGM1_PWM_10_PC: |
129 | 131 | case Avr8::WGM1_PWM_PFC_ICR: |
130 | 132 | case Avr8::WGM1_PWM_PC_ICR: |
131 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); | |
133 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Normal port operation (OC1 disconnected)\n"); | |
132 | 134 | break; |
133 | 135 | |
134 | 136 | case Avr8::WGM1_FAST_PWM_ICR: |
135 | 137 | case Avr8::WGM1_FAST_PWM_OCR: |
136 | 138 | case Avr8::WGM1_PWM_PFC_OCR: |
137 | 139 | case Avr8::WGM1_PWM_PC_OCR: |
138 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Toggle OC1A on compare match, OC1B disconnected\n"); | |
140 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Toggle OC1A on compare match, OC1B disconnected\n"); | |
139 | 141 | break; |
140 | 142 | } |
141 | 143 | break; |
r18114 | r18115 | |
146 | 148 | case Avr8::WGM1_NORMAL: |
147 | 149 | case Avr8::WGM1_CTC_OCR: |
148 | 150 | case Avr8::WGM1_CTC_ICR: |
149 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match\n", avr8_reg_name[reg]); | |
151 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match\n", avr8_reg_name[reg]); | |
150 | 152 | break; |
151 | 153 | |
152 | 154 | case Avr8::WGM1_PWM_8_PC: |
r18114 | r18115 | |
156 | 158 | case Avr8::WGM1_PWM_PC_ICR: |
157 | 159 | case Avr8::WGM1_PWM_PFC_OCR: |
158 | 160 | case Avr8::WGM1_PWM_PC_OCR: |
159 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
161 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
160 | 162 | break; |
161 | 163 | |
162 | 164 | case Avr8::WGM1_FAST_PWM_8: |
r18114 | r18115 | |
164 | 166 | case Avr8::WGM1_FAST_PWM_10: |
165 | 167 | case Avr8::WGM1_FAST_PWM_ICR: |
166 | 168 | case Avr8::WGM1_FAST_PWM_OCR: |
167 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match, set at BOTTOM\n", avr8_reg_name[reg]); | |
169 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Clear OC1%c on compare match, set at BOTTOM\n", avr8_reg_name[reg]); | |
168 | 170 | break; |
169 | 171 | } |
170 | 172 | break; |
r18114 | r18115 | |
175 | 177 | case Avr8::WGM1_NORMAL: |
176 | 178 | case Avr8::WGM1_CTC_OCR: |
177 | 179 | case Avr8::WGM1_CTC_ICR: |
178 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match\n", avr8_reg_name[reg]); | |
180 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match\n", avr8_reg_name[reg]); | |
179 | 181 | break; |
180 | 182 | |
181 | 183 | case Avr8::WGM1_PWM_8_PC: |
r18114 | r18115 | |
185 | 187 | case Avr8::WGM1_PWM_PC_ICR: |
186 | 188 | case Avr8::WGM1_PWM_PFC_OCR: |
187 | 189 | case Avr8::WGM1_PWM_PC_OCR: |
188 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on match when up-counting, clear on match when down-counting\n", avr8_reg_name[reg]); | |
190 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on match when up-counting, clear on match when down-counting\n", avr8_reg_name[reg]); | |
189 | 191 | break; |
190 | 192 | |
191 | 193 | case Avr8::WGM1_FAST_PWM_8: |
r18114 | r18115 | |
193 | 195 | case Avr8::WGM1_FAST_PWM_10: |
194 | 196 | case Avr8::WGM1_FAST_PWM_ICR: |
195 | 197 | case Avr8::WGM1_FAST_PWM_OCR: |
196 | //verboselog(machine, 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
198 | //verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Set OC1%c on compare match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
197 | 199 | break; |
198 | 200 | } |
199 | 201 | break; |
200 | 202 | default: |
201 | verboselog(machine, 0, "avr8_update_timer1_compare_mode: Unknown COM1%c mode setting (%d)\n", avr8_reg_name[reg], mode); | |
203 | verboselog(machine(), 0, "avr8_update_timer1_compare_mode: Unknown COM1%c mode setting (%d)\n", avr8_reg_name[reg], mode); | |
202 | 204 | break; |
203 | 205 | } |
204 | 206 | } |
r18114 | r18115 | |
544 | 546 | verboselog(machine, 0, "avr8_update_timer1_input_edge_select: TODO; Clocking edge is %s\n", "test"); |
545 | 547 | } |
546 | 548 | |
547 | ||
549 | TIMER_CALLBACK_MEMBER(craft_state::avr8_timer2_tick) | |
548 | 550 | { |
549 | 551 | /* TODO: Handle comparison, setting OC2x pins, detection of BOTTOM and TOP |
550 | 552 | |
551 | craft_state *state = machine.driver_data<craft_state>(); | |
552 | 553 | UINT16 count = AVR8_TCNT2; |
553 | count += | |
554 | count += m_timer1_increment; | |
554 | 555 | for(INT32 reg = AVR8_REG_A; reg <= AVR8_REG_B; reg++) |
555 | 556 | { |
556 | 557 | UINT8 mode = (reg == AVR8_REG_A) ? AVR8_TCCR2A_COM2A : AVR8_TCCR2A_COM2B; |
r18114 | r18115 | |
558 | 559 | if(!mode) |
559 | 560 | { |
560 | 561 | // Normal port operation, OC2n disconnected |
561 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
562 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
562 | 563 | return; |
563 | 564 | } |
564 | 565 | |
r18114 | r18115 | |
569 | 570 | switch(mode) |
570 | 571 | { |
571 | 572 | case 1: // Toggle OC2n on Compare Match |
572 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
573 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
573 | 574 | break; |
574 | 575 | case 2: // Clear OC2n on Compare Match |
575 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
576 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
576 | 577 | break; |
577 | 578 | case 3: // Set OC2n on Compare Match |
578 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
579 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on Compare Match\n", avr8_reg_name[reg]); | |
579 | 580 | break; |
580 | 581 | } |
581 | 582 | break; |
r18114 | r18115 | |
584 | 585 | switch(mode) |
585 | 586 | { |
586 | 587 | case 1: // Normal port operation, OC2n disconnected |
587 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
588 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
588 | 589 | break; |
589 | 590 | case 2: // Clear OC2n on match when up-counting, set when down-counting |
590 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
591 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
591 | 592 | break; |
592 | 593 | case 3: // Set OC2n on match when up-counting, clear when down-counting |
593 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); | |
594 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); | |
594 | 595 | break; |
595 | 596 | } |
596 | 597 | break; |
r18114 | r18115 | |
599 | 600 | switch(mode) |
600 | 601 | { |
601 | 602 | case 1: // Toggle OC2n on compare match |
602 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); | |
603 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); | |
603 | 604 | break; |
604 | 605 | case 2: // Clear OC2n on match when up-counting, set when down-counting |
605 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
606 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match when up-counting, set when down-counting\n", avr8_reg_name[reg]); | |
606 | 607 | break; |
607 | 608 | case 3: // Set OC2n on match when up-counting, clear when down-counting |
608 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); | |
609 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match when up-counting, clear when down-counting\n", avr8_reg_name[reg]); | |
609 | 610 | break; |
610 | 611 | } |
611 | 612 | break; |
r18114 | r18115 | |
615 | 616 | switch(mode) |
616 | 617 | { |
617 | 618 | case 1: // Normal port operation, OC2n disconnected |
618 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
619 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; OC2%c disconnected, normal port operation\n", avr8_reg_name[reg]); | |
619 | 620 | break; |
620 | 621 | case 2: // Clear OC2n on match, set at BOTTOM |
621 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); | |
622 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); | |
622 | 623 | break; |
623 | 624 | case 3: // Set OC2n on match, clear at BOTTOM |
624 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
625 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
625 | 626 | break; |
626 | 627 | } |
627 | 628 | break; |
r18114 | r18115 | |
630 | 631 | switch(mode) |
631 | 632 | { |
632 | 633 | case 1: // Toggle OC2n on compare match |
633 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); | |
634 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Toggle OC2%c on compare match\n", avr8_reg_name[reg]); | |
634 | 635 | break; |
635 | 636 | case 2: // Clear OC2n on match, set at BOTTOM |
636 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); | |
637 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Clear OC2%c on match, set at BOTTOM\n", avr8_reg_name[reg]); | |
637 | 638 | break; |
638 | 639 | case 3: // Set OC2n on match, clear at BOTTOM |
639 | //verboselog(machine, 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
640 | //verboselog(machine(), 0, "avr8_update_timer2_compare_mode: TODO; Set OC2%c on match, clear at BOTTOM\n", avr8_reg_name[reg]); | |
640 | 641 | break; |
641 | 642 | } |
642 | 643 | break; |
r18114 | r18115 | |
---|---|---|
192 | 192 | DECLARE_DRIVER_INIT(vk100); |
193 | 193 | virtual void machine_reset(); |
194 | 194 | virtual void video_start(); |
195 | TIMER_CALLBACK_MEMBER(execute_vg); | |
195 | 196 | }; |
196 | 197 | |
197 | 198 | // vram access functions: |
r18114 | r18115 | |
250 | 251 | state->m_vram[(EA<<1)] = (block&0xFF00)>>8; // '' |
251 | 252 | } |
252 | 253 | |
253 | ||
254 | TIMER_CALLBACK_MEMBER(vk100_state::execute_vg) | |
254 | 255 | { |
255 | vk100_state *state = machine.driver_data<vk100_state>(); | |
256 | UINT8 thisNyb = vram_read(machine); // read in the nybble | |
256 | UINT8 thisNyb = vram_read(machine()); // read in the nybble | |
257 | 257 | // pattern rom addressing is a complex mess. see the pattern rom def later in this file. |
258 | UINT8 newNyb = | |
258 | UINT8 newNyb = m_pattern[((m_vgPAT&m_vgPAT_Mask)?0x200:0)|((VG_WOPS&7)<<6)|((m_vgX&3)<<4)|thisNyb]; // calculate new nybble based on pattern rom | |
259 | 259 | // finally write the block back to ram depending on the VG_MODE (sort of a hack until we get the vector and synd and dir roms all hooked up) |
260 | switch ( | |
260 | switch (m_VG_MODE) | |
261 | 261 | { |
262 | 262 | case 0: // move; adjusts the x and y but doesn't write anything. do nothing |
263 | 263 | break; |
264 | 264 | case 1: // dot: only write the LAST pixel in the chain? TODO: some fallthrough magic here? |
265 | if (( | |
265 | if ((m_vgDownCount) == 0x00) | |
266 | 266 | { |
267 | vram_write(machine, newNyb); // write out the modified nybble | |
267 | vram_write(machine(), newNyb); // write out the modified nybble | |
268 | 268 | } |
269 | 269 | break; |
270 | 270 | case 2: // vec: draw the vector |
271 | vram_write(machine, newNyb); // write out the modified nybble | |
271 | vram_write(machine(), newNyb); // write out the modified nybble | |
272 | 272 | break; |
273 | 273 | case 3: // er: erase: special case here: wipe the entire screen (except for color/attrib?) and then set done. |
274 | 274 | for (int i = 0; i < 0x8000; i++) |
275 | 275 | { |
276 | 276 | if (!(i&1)) // avoid stomping attribute |
277 | | |
277 | m_vram[i] = m_vram[i]&0xF0; | |
278 | 278 | else // (i&1) |
279 | | |
279 | m_vram[i] = 0; | |
280 | 280 | } |
281 | | |
281 | m_vgGO = 0; // done | |
282 | 282 | break; |
283 | 283 | } |
284 | 284 | /* this is the "DIRECTION ROM" == mb6309 (256x8, 82s135) |
r18114 | r18115 | |
305 | 305 | * \--------- UNUSED, always 0 |
306 | 306 | * The VT125 prom @ E41 is literally identical to this, the same exact part: 23-059B1 |
307 | 307 | */ |
308 | //UINT8 direction_rom = | |
308 | //UINT8 direction_rom = m_dir[]; | |
309 | 309 | // HACK: we need the proper direction rom dump for this! |
310 | switch( | |
310 | switch(VG_DIR&0x7) | |
311 | 311 | { |
312 | 312 | case 0: |
313 | | |
313 | m_vgX++; | |
314 | 314 | break; |
315 | 315 | case 7: |
316 | state->m_vgX++; | |
317 | state->m_vgY++; | |
316 | m_vgX++; | |
317 | m_vgY++; | |
318 | 318 | break; |
319 | 319 | case 6: |
320 | | |
320 | m_vgY++; | |
321 | 321 | break; |
322 | 322 | case 5: |
323 | state->m_vgX--; | |
324 | state->m_vgY++; | |
323 | m_vgX--; | |
324 | m_vgY++; | |
325 | 325 | break; |
326 | 326 | case 4: |
327 | | |
327 | m_vgX--; | |
328 | 328 | break; |
329 | 329 | case 3: |
330 | state->m_vgX--; | |
331 | state->m_vgY--; | |
330 | m_vgX--; | |
331 | m_vgY--; | |
332 | 332 | break; |
333 | 333 | case 2: |
334 | | |
334 | m_vgY--; | |
335 | 335 | break; |
336 | 336 | case 1: |
337 | state->m_vgX++; | |
338 | state->m_vgY--; | |
337 | m_vgX++; | |
338 | m_vgY--; | |
339 | 339 | break; |
340 | 340 | } |
341 | state->m_vgDownCount--; // decrement the down counter | |
342 | if ((state->m_vgDownCount) == 0x00) state->m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. | |
343 | if (((++state->m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed | |
341 | m_vgDownCount--; // decrement the down counter | |
342 | if ((m_vgDownCount) == 0x00) m_vgGO = 0; // check if the down counter hit terminal count (0), if so we're done. | |
343 | if (((++m_vgPMUL_Count)&0xF)==0) // if pattern multiplier counter overflowed | |
344 | 344 | { |
345 | state->m_vgPMUL_Count = state->m_vgPMUL; // reload counter | |
346 | state->m_vgPAT_Mask >>= 1; // shift the mask | |
347 | if (state->m_vgPAT_Mask == 0) state->m_vgPAT_Mask = 0x80; // reset mask if it hits 0 | |
345 | m_vgPMUL_Count = m_vgPMUL; // reload counter | |
346 | m_vgPAT_Mask >>= 1; // shift the mask | |
347 | if (m_vgPAT_Mask == 0) m_vgPAT_Mask = 0x80; // reset mask if it hits 0 | |
348 | 348 | } |
349 | if ( | |
349 | if (m_vgGO) machine().scheduler().timer_set(attotime::from_hz(XTAL_45_6192Mhz/3/12/2), timer_expired_delegate(FUNC(vk100_state::execute_vg),this)); // /3/12/2 is correct. the sync counter is clocked by the dot clock, despite the error on figure 5-21 | |
350 | 350 | } |
351 | 351 | |
352 | 352 | /* ports 0x40 and 0x41: load low and high bytes of vector gen X register */ |
r18114 | r18115 | |
459 | 459 | m_vgDownCount = VG_DU; // set down counter to length of major vector |
460 | 460 | m_VG_MODE = offset&3; |
461 | 461 | m_vgGO = 1; |
462 | machine().scheduler().timer_set(attotime::zero, FUNC(execute_vg)); | |
462 | machine().scheduler().timer_set(attotime::zero, timer_expired_delegate(FUNC(vk100_state::execute_vg),this)); | |
463 | 463 | } |
464 | 464 | |
465 | 465 |
r18114 | r18115 | |
---|---|---|
180 | 180 | emu_timer *m_cassette_timer; |
181 | 181 | public: |
182 | 182 | DECLARE_DRIVER_INIT(sol20); |
183 | TIMER_CALLBACK_MEMBER(sol20_cassette_tc); | |
184 | TIMER_CALLBACK_MEMBER(sol20_boot); | |
183 | 185 | }; |
184 | 186 | |
185 | 187 | |
r18114 | r18115 | |
197 | 199 | |
198 | 200 | |
199 | 201 | // identical to sorcerer |
200 | ||
202 | TIMER_CALLBACK_MEMBER(sol20_state::sol20_cassette_tc) | |
201 | 203 | { |
202 | sol20_state *state = machine.driver_data<sol20_state>(); | |
203 | 204 | UINT8 cass_ws = 0; |
204 | switch ( | |
205 | switch (m_sol20_fa & 0x20) | |
205 | 206 | { |
206 | 207 | case 0x20: /* Cassette 300 baud */ |
207 | 208 | |
208 | 209 | /* loading a tape - this is basically the same as the super80. |
209 | 210 | We convert the 1200/2400 Hz signal to a 0 or 1, and send it to the uart. */ |
210 | 211 | |
211 | | |
212 | m_cass_data.input.length++; | |
212 | 213 | |
213 | cass_ws = ((cassette_device_image(machine))->input() > +0.02) ? 1 : 0; | |
214 | cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0; | |
214 | 215 | |
215 | if (cass_ws != | |
216 | if (cass_ws != m_cass_data.input.level) | |
216 | 217 | { |
217 | state->m_cass_data.input.level = cass_ws; | |
218 | state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 0x6) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0; | |
219 | state->m_cass_data.input.length = 0; | |
220 | ay31015_set_input_pin( state->m_uart, AY31015_SI, state->m_cass_data.input.bit ); | |
218 | m_cass_data.input.level = cass_ws; | |
219 | m_cass_data.input.bit = ((m_cass_data.input.length < 0x6) || (m_cass_data.input.length > 0x20)) ? 1 : 0; | |
220 | m_cass_data.input.length = 0; | |
221 | ay31015_set_input_pin( m_uart, AY31015_SI, m_cass_data.input.bit ); | |
221 | 222 | } |
222 | 223 | |
223 | 224 | /* saving a tape - convert the serial stream from the uart, into 1200 and 2400 Hz frequencies. |
224 | 225 | Synchronisation of the frequency pulses to the uart is extremely important. */ |
225 | 226 | |
226 | state->m_cass_data.output.length++; | |
227 | if (!(state->m_cass_data.output.length & 0x1f)) | |
227 | m_cass_data.output.length++; | |
228 | if (!(m_cass_data.output.length & 0x1f)) | |
228 | 229 | { |
229 | cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO ); | |
230 | if (cass_ws != state->m_cass_data.output.bit) | |
230 | cass_ws = ay31015_get_output_pin( m_uart, AY31015_SO ); | |
231 | if (cass_ws != m_cass_data.output.bit) | |
231 | 232 | { |
232 | state->m_cass_data.output.bit = cass_ws; | |
233 | state->m_cass_data.output.length = 0; | |
233 | m_cass_data.output.bit = cass_ws; | |
234 | m_cass_data.output.length = 0; | |
234 | 235 | } |
235 | 236 | } |
236 | 237 | |
237 | if (!( | |
238 | if (!(m_cass_data.output.length & 3)) | |
238 | 239 | { |
239 | if (!(( | |
240 | if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 4))) | |
240 | 241 | { |
241 | state->m_cass_data.output.level ^= 1; // toggle output state, except on 2nd half of low bit | |
242 | cassette_device_image(machine)->output(state->m_cass_data.output.level ? -1.0 : +1.0); | |
242 | m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit | |
243 | cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0); | |
243 | 244 | } |
244 | 245 | } |
245 | 246 | return; |
246 | 247 | |
247 | 248 | case 0x00: /* Cassette 1200 baud */ |
248 | 249 | /* loading a tape */ |
249 | | |
250 | m_cass_data.input.length++; | |
250 | 251 | |
251 | cass_ws = ((cassette_device_image(machine))->input() > +0.02) ? 1 : 0; | |
252 | cass_ws = ((cassette_device_image(machine()))->input() > +0.02) ? 1 : 0; | |
252 | 253 | |
253 | if (cass_ws != | |
254 | if (cass_ws != m_cass_data.input.level || m_cass_data.input.length == 10) | |
254 | 255 | { |
255 | state->m_cass_data.input.bit = ((state->m_cass_data.input.length < 10) || (state->m_cass_data.input.length > 0x20)) ? 1 : 0; | |
256 | if ( cass_ws != state->m_cass_data.input.level ) | |
256 | m_cass_data.input.bit = ((m_cass_data.input.length < 10) || (m_cass_data.input.length > 0x20)) ? 1 : 0; | |
257 | if ( cass_ws != m_cass_data.input.level ) | |
257 | 258 | { |
258 | state->m_cass_data.input.length = 0; | |
259 | state->m_cass_data.input.level = cass_ws; | |
259 | m_cass_data.input.length = 0; | |
260 | m_cass_data.input.level = cass_ws; | |
260 | 261 | } |
261 | ay31015_set_input_pin( | |
262 | ay31015_set_input_pin( m_uart, AY31015_SI, m_cass_data.input.bit ); | |
262 | 263 | } |
263 | 264 | |
264 | 265 | /* saving a tape - convert the serial stream from the uart, into 600 and 1200 Hz frequencies. */ |
265 | 266 | |
266 | state->m_cass_data.output.length++; | |
267 | if (!(state->m_cass_data.output.length & 7)) | |
267 | m_cass_data.output.length++; | |
268 | if (!(m_cass_data.output.length & 7)) | |
268 | 269 | { |
269 | cass_ws = ay31015_get_output_pin( state->m_uart, AY31015_SO ); | |
270 | if (cass_ws != state->m_cass_data.output.bit) | |
270 | cass_ws = ay31015_get_output_pin( m_uart, AY31015_SO ); | |
271 | if (cass_ws != m_cass_data.output.bit) | |
271 | 272 | { |
272 | state->m_cass_data.output.bit = cass_ws; | |
273 | state->m_cass_data.output.length = 0; | |
273 | m_cass_data.output.bit = cass_ws; | |
274 | m_cass_data.output.length = 0; | |
274 | 275 | } |
275 | 276 | } |
276 | 277 | |
277 | if (!( | |
278 | if (!(m_cass_data.output.length & 7)) | |
278 | 279 | { |
279 | if (!(( | |
280 | if (!((m_cass_data.output.bit == 0) && (m_cass_data.output.length & 8))) | |
280 | 281 | { |
281 | state->m_cass_data.output.level ^= 1; // toggle output state, except on 2nd half of low bit | |
282 | cassette_device_image(machine)->output(state->m_cass_data.output.level ? -1.0 : +1.0); | |
282 | m_cass_data.output.level ^= 1; // toggle output this, except on 2nd half of low bit | |
283 | cassette_device_image(machine())->output(m_cass_data.output.level ? -1.0 : +1.0); | |
283 | 284 | } |
284 | 285 | } |
285 | 286 | return; |
r18114 | r18115 | |
538 | 539 | }; |
539 | 540 | |
540 | 541 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
541 | ||
542 | TIMER_CALLBACK_MEMBER(sol20_state::sol20_boot) | |
542 | 543 | { |
543 | sol20_state *state = machine.driver_data<sol20_state>(); | |
544 | state->membank("boot")->set_entry(0); | |
544 | membank("boot")->set_entry(0); | |
545 | 545 | } |
546 | 546 | |
547 | 547 | void sol20_state::machine_start() |
548 | 548 | { |
549 | m_cassette_timer = machine().scheduler().timer_alloc(FUNC(sol20_cassette_tc)); | |
549 | m_cassette_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(sol20_state::sol20_cassette_tc),this)); | |
550 | 550 | } |
551 | 551 | |
552 | 552 | void sol20_state::machine_reset() |
r18114 | r18115 | |
598 | 598 | |
599 | 599 | // boot-bank |
600 | 600 | membank("boot")->set_entry(1); |
601 | machine().scheduler().timer_set(attotime::from_usec(9), FUNC(sol20_boot)); | |
601 | machine().scheduler().timer_set(attotime::from_usec(9), timer_expired_delegate(FUNC(sol20_state::sol20_boot),this)); | |
602 | 602 | } |
603 | 603 | |
604 | 604 | DRIVER_INIT_MEMBER(sol20_state,sol20) |
r18114 | r18115 | |
---|---|---|
166 | 166 | DECLARE_WRITE8_MEMBER( ngp_tlcs900_to3 ); |
167 | 167 | UINT32 screen_update_ngp(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
168 | 168 | DECLARE_INPUT_CHANGED_MEMBER(power_callback); |
169 | TIMER_CALLBACK_MEMBER(ngp_seconds_callback); | |
169 | 170 | }; |
170 | 171 | |
171 | 172 | |
172 | ||
173 | TIMER_CALLBACK_MEMBER(ngp_state::ngp_seconds_callback) | |
173 | 174 | { |
174 | ngp_state *state = machine.driver_data<ngp_state>(); | |
175 | 175 | |
176 | state->m_io_reg[0x16] += 1; | |
177 | if ( ( state->m_io_reg[0x16] & 0x0f ) == 0x0a ) | |
176 | m_io_reg[0x16] += 1; | |
177 | if ( ( m_io_reg[0x16] & 0x0f ) == 0x0a ) | |
178 | 178 | { |
179 | | |
179 | m_io_reg[0x16] += 0x06; | |
180 | 180 | } |
181 | 181 | |
182 | if ( | |
182 | if ( m_io_reg[0x16] >= 0x60 ) | |
183 | 183 | { |
184 | state->m_io_reg[0x16] = 0; | |
185 | state->m_io_reg[0x15] += 1; | |
186 | if ( ( state->m_io_reg[0x15] & 0x0f ) == 0x0a ) { | |
187 | state->m_io_reg[0x15] += 0x06; | |
184 | m_io_reg[0x16] = 0; | |
185 | m_io_reg[0x15] += 1; | |
186 | if ( ( m_io_reg[0x15] & 0x0f ) == 0x0a ) { | |
187 | m_io_reg[0x15] += 0x06; | |
188 | 188 | } |
189 | 189 | |
190 | if ( | |
190 | if ( m_io_reg[0x15] >= 0x60 ) | |
191 | 191 | { |
192 | state->m_io_reg[0x15] = 0; | |
193 | state->m_io_reg[0x14] += 1; | |
194 | if ( ( state->m_io_reg[0x14] & 0x0f ) == 0x0a ) { | |
195 | state->m_io_reg[0x14] += 0x06; | |
192 | m_io_reg[0x15] = 0; | |
193 | m_io_reg[0x14] += 1; | |
194 | if ( ( m_io_reg[0x14] & 0x0f ) == 0x0a ) { | |
195 | m_io_reg[0x14] += 0x06; | |
196 | 196 | } |
197 | 197 | |
198 | if ( | |
198 | if ( m_io_reg[0x14] == 0x24 ) | |
199 | 199 | { |
200 | | |
200 | m_io_reg[0x14] = 0; | |
201 | 201 | } |
202 | 202 | } |
203 | 203 | } |
r18114 | r18115 | |
603 | 603 | |
604 | 604 | void ngp_state::machine_start() |
605 | 605 | { |
606 | m_seconds_timer = machine().scheduler().timer_alloc(FUNC(ngp_seconds_callback)); | |
606 | m_seconds_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(ngp_state::ngp_seconds_callback),this)); | |
607 | 607 | m_seconds_timer->adjust( attotime::from_seconds(1), 0, attotime::from_seconds(1) ); |
608 | 608 | } |
609 | 609 |
r18114 | r18115 | |
---|---|---|
44 | 44 | virtual void video_start(); |
45 | 45 | UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
46 | 46 | DECLARE_DRIVER_INIT(plan80); |
47 | TIMER_CALLBACK_MEMBER(plan80_boot); | |
47 | 48 | }; |
48 | 49 | |
49 | 50 | READ8_MEMBER( plan80_state::plan80_04_r ) |
r18114 | r18115 | |
140 | 141 | |
141 | 142 | |
142 | 143 | /* after the first 4 bytes have been read from ROM, switch the ram back in */ |
143 | ||
144 | TIMER_CALLBACK_MEMBER(plan80_state::plan80_boot) | |
144 | 145 | { |
145 | plan80_state *state = machine.driver_data<plan80_state>(); | |
146 | state->membank("boot")->set_entry(0); | |
146 | membank("boot")->set_entry(0); | |
147 | 147 | } |
148 | 148 | |
149 | 149 | void plan80_state::machine_reset() |
150 | 150 | { |
151 | 151 | membank("boot")->set_entry(1); |
152 | machine().scheduler().timer_set(attotime::from_usec(10), FUNC(plan80_boot)); | |
152 | machine().scheduler().timer_set(attotime::from_usec(10), timer_expired_delegate(FUNC(plan80_state::plan80_boot),this)); | |
153 | 153 | } |
154 | 154 | |
155 | 155 | DRIVER_INIT_MEMBER(plan80_state,plan80) |
r18114 | r18115 | |
---|---|---|
51 | 51 | void kb_matrix_w(running_machine &machine, UINT8 matrix); |
52 | 52 | UINT16 read_touchscreen(running_machine &machine, UINT8 line); |
53 | 53 | virtual void palette_init(); |
54 | TIMER_CALLBACK_MEMBER(keyboard_timer); | |
54 | 55 | }; |
55 | 56 | |
56 | 57 | static ADDRESS_MAP_START(pb1000_mem, AS_PROGRAM, 16, pb1000_state) |
r18114 | r18115 | |
482 | 483 | port_w //8 bit port write |
483 | 484 | }; |
484 | 485 | |
485 | ||
486 | TIMER_CALLBACK_MEMBER(pb1000_state::keyboard_timer) | |
486 | 487 | { |
487 | machine.device("maincpu")->execute().set_input_line(HD61700_KEY_INT, ASSERT_LINE); | |
488 | machine.device("maincpu")->execute().set_input_line(HD61700_KEY_INT, CLEAR_LINE); | |
488 | machine().device("maincpu")->execute().set_input_line(HD61700_KEY_INT, ASSERT_LINE); | |
489 | machine().device("maincpu")->execute().set_input_line(HD61700_KEY_INT, CLEAR_LINE); | |
489 | 490 | } |
490 | 491 | |
491 | 492 | void pb1000_state::machine_start() |
492 | 493 | { |
493 | 494 | membank("bank1")->set_base(machine().root_device().memregion("rom")->base()); |
494 | 495 | |
495 | m_kb_timer = machine().scheduler().timer_alloc(FUNC(keyboard_timer)); | |
496 | m_kb_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pb1000_state::keyboard_timer),this)); | |
496 | 497 | m_kb_timer->adjust(attotime::from_hz(192), 0, attotime::from_hz(192)); |
497 | 498 | } |
498 | 499 |
r18114 | r18115 | |
---|---|---|
46 | 46 | const UINT8 *m_p_chargen; |
47 | 47 | virtual void machine_reset(); |
48 | 48 | virtual void video_start(); |
49 | TIMER_CALLBACK_MEMBER(zrt80_beepoff); | |
49 | 50 | }; |
50 | 51 | |
51 | 52 | READ8_MEMBER( zrt80_state::zrt80_10_r ) |
r18114 | r18115 | |
55 | 56 | return ret; |
56 | 57 | } |
57 | 58 | |
58 | ||
59 | TIMER_CALLBACK_MEMBER(zrt80_state::zrt80_beepoff) | |
59 | 60 | { |
60 | zrt80_state *state = machine.driver_data<zrt80_state>(); | |
61 | beep_set_state(state->m_beep, 0); | |
61 | beep_set_state(m_beep, 0); | |
62 | 62 | } |
63 | 63 | |
64 | 64 | WRITE8_MEMBER(zrt80_state::zrt80_30_w) |
65 | 65 | { |
66 | machine().scheduler().timer_set(attotime::from_msec(100), FUNC(zrt80_beepoff)); | |
66 | machine().scheduler().timer_set(attotime::from_msec(100), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this)); | |
67 | 67 | beep_set_state(m_beep, 1); |
68 | 68 | } |
69 | 69 | |
70 | 70 | WRITE8_MEMBER(zrt80_state::zrt80_38_w) |
71 | 71 | { |
72 | machine().scheduler().timer_set(attotime::from_msec(400), FUNC(zrt80_beepoff)); | |
72 | machine().scheduler().timer_set(attotime::from_msec(400), timer_expired_delegate(FUNC(zrt80_state::zrt80_beepoff),this)); | |
73 | 73 | beep_set_state(m_beep, 1); |
74 | 74 | } |
75 | 75 |
r18114 | r18115 | |
---|---|---|
103 | 103 | virtual void video_start(); |
104 | 104 | UINT32 screen_update_pc88va(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
105 | 105 | INTERRUPT_GEN_MEMBER(pc88va_vrtc_irq); |
106 | TIMER_CALLBACK_MEMBER(pc8801fd_upd765_tc_to_zero); | |
107 | TIMER_CALLBACK_MEMBER(t3_mouse_callback); | |
106 | 108 | }; |
107 | 109 | |
108 | 110 | |
r18114 | r18115 | |
944 | 946 | floppy_drive_set_ready_state(floppy_get_device(machine(), 1), (data & 2), 0); |
945 | 947 | } |
946 | 948 | |
947 | ||
949 | TIMER_CALLBACK_MEMBER(pc88va_state::pc8801fd_upd765_tc_to_zero) | |
948 | 950 | { |
949 | // pc88va_state *state = machine.driver_data<pc88va_state>(); | |
950 | 951 | |
951 | upd765_tc_w(machine.device("upd765"), 0); | |
952 | upd765_tc_w(machine().device("upd765"), 0); | |
952 | 953 | } |
953 | 954 | |
954 | 955 | READ8_MEMBER(pc88va_state::upd765_tc_r) |
955 | 956 | { |
956 | 957 | |
957 | 958 | upd765_tc_w(machine().device("upd765"), 1); |
958 | machine().scheduler().timer_set(attotime::from_usec(500), FUNC(pc8801fd_upd765_tc_to_zero)); | |
959 | machine().scheduler().timer_set(attotime::from_usec(500), timer_expired_delegate(FUNC(pc88va_state::pc8801fd_upd765_tc_to_zero),this)); | |
959 | 960 | return 0; |
960 | 961 | } |
961 | 962 | |
r18114 | r18115 | |
1038 | 1039 | m_screen_ctrl_reg = data; |
1039 | 1040 | } |
1040 | 1041 | |
1041 | ||
1042 | TIMER_CALLBACK_MEMBER(pc88va_state::t3_mouse_callback) | |
1042 | 1043 | { |
1043 | pc88va_state *state = machine.driver_data<pc88va_state>(); | |
1044 | if(state->m_timer3_io_reg & 0x80) | |
1044 | if(m_timer3_io_reg & 0x80) | |
1045 | 1045 | { |
1046 | pic8259_ir5_w(machine.device("pic8259_slave"), 1); | |
1047 | state->m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (state->m_timer3_io_reg & 3))); | |
1046 | pic8259_ir5_w(machine().device("pic8259_slave"), 1); | |
1047 | m_t3_mouse_timer->adjust(attotime::from_hz(120 >> (m_timer3_io_reg & 3))); | |
1048 | 1048 | } |
1049 | 1049 | } |
1050 | 1050 | |
r18114 | r18115 | |
1533 | 1533 | { |
1534 | 1534 | machine().device("maincpu")->execute().set_irq_acknowledge_callback(pc88va_irq_callback); |
1535 | 1535 | |
1536 | m_t3_mouse_timer = machine().scheduler().timer_alloc(FUNC(t3_mouse_callback)); | |
1536 | m_t3_mouse_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc88va_state::t3_mouse_callback),this)); | |
1537 | 1537 | m_t3_mouse_timer->adjust(attotime::never); |
1538 | 1538 | } |
1539 | 1539 |
r18114 | r18115 | |
---|---|---|
235 | 235 | UINT32 screen_update_pc6001sr(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
236 | 236 | INTERRUPT_GEN_MEMBER(pc6001_interrupt); |
237 | 237 | INTERRUPT_GEN_MEMBER(pc6001sr_interrupt); |
238 | TIMER_CALLBACK_MEMBER(audio_callback); | |
238 | 239 | }; |
239 | 240 | |
240 | 241 | |
r18114 | r18115 | |
1357 | 1358 | m_timer_irq_mask2 = data & 4; |
1358 | 1359 | } |
1359 | 1360 | |
1360 | ||
1361 | TIMER_CALLBACK_MEMBER(pc6001_state::audio_callback) | |
1361 | 1362 | { |
1362 | pc6001_state *state = machine.driver_data<pc6001_state>(); | |
1363 | if(state->m_cas_switch == 0 && ((state->m_timer_irq_mask == 0) || (state->m_timer_irq_mask2 == 0))) | |
1363 | if(m_cas_switch == 0 && ((m_timer_irq_mask == 0) || (m_timer_irq_mask2 == 0))) | |
1364 | 1364 | { |
1365 | if(IRQ_LOG) printf("Timer IRQ called %02x\n",state->m_timer_irq_vector); | |
1366 | state->m_irq_vector = state->m_timer_irq_vector; | |
1367 | machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
1365 | if(IRQ_LOG) printf("Timer IRQ called %02x\n",m_timer_irq_vector); | |
1366 | m_irq_vector = m_timer_irq_vector; | |
1367 | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); | |
1368 | 1368 | } |
1369 | 1369 | } |
1370 | 1370 | |
r18114 | r18115 | |
2106 | 2106 | m_timer_hz_div = 3; |
2107 | 2107 | { |
2108 | 2108 | attotime period = attotime::from_hz((487.5*4)/(m_timer_hz_div+1)); |
2109 | m_timer_irq_timer = machine().scheduler().timer_alloc(FUNC(audio_callback)); | |
2109 | m_timer_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pc6001_state::audio_callback),this)); | |
2110 | 2110 | m_timer_irq_timer->adjust(period, 0, period); |
2111 | 2111 | } |
2112 | 2112 | } |
r18114 | r18115 | |
---|---|---|
167 | 167 | DECLARE_PALETTE_INIT(px4p); |
168 | 168 | UINT32 screen_update_px4(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
169 | 169 | DECLARE_INPUT_CHANGED_MEMBER(key_callback); |
170 | TIMER_CALLBACK_MEMBER(ext_cassette_read); | |
171 | TIMER_CALLBACK_MEMBER(transmit_data); | |
172 | TIMER_CALLBACK_MEMBER(receive_data); | |
170 | 173 | }; |
171 | 174 | |
172 | 175 | |
r18114 | r18115 | |
303 | 306 | } |
304 | 307 | |
305 | 308 | /* external cassette or barcode reader input */ |
306 | ||
309 | TIMER_CALLBACK_MEMBER(px4_state::ext_cassette_read) | |
307 | 310 | { |
308 | px4_state *px4 = machine.driver_data<px4_state>(); | |
309 | 311 | UINT8 result; |
310 | 312 | int trigger = 0; |
311 | 313 | |
312 | 314 | /* sample input state */ |
313 | result = ( | |
315 | result = (m_ext_cas->input() > 0) ? 1 : 0; | |
314 | 316 | |
315 | 317 | /* detect transition */ |
316 | switch (( | |
318 | switch ((m_ctrl1 >> 1) & 0x03) | |
317 | 319 | { |
318 | 320 | case 0: /* trigger inhibit */ |
319 | 321 | trigger = 0; |
320 | 322 | break; |
321 | 323 | case 1: /* falling edge trigger */ |
322 | trigger = | |
324 | trigger = m_ear_last_state == 1 && result == 0; | |
323 | 325 | break; |
324 | 326 | case 2: /* rising edge trigger */ |
325 | trigger = | |
327 | trigger = m_ear_last_state == 0 && result == 1; | |
326 | 328 | break; |
327 | 329 | case 3: /* rising/falling edge trigger */ |
328 | trigger = | |
330 | trigger = m_ear_last_state != result; | |
329 | 331 | break; |
330 | 332 | } |
331 | 333 | |
332 | 334 | /* generate an interrupt if we need to trigger */ |
333 | 335 | if (trigger) |
334 | 336 | { |
335 | px4->m_icrb = px4->m_frc_value; | |
336 | px4->m_isr |= INT2_ICF; | |
337 | gapnit_interrupt(machine); | |
337 | m_icrb = m_frc_value; | |
338 | m_isr |= INT2_ICF; | |
339 | gapnit_interrupt(machine()); | |
338 | 340 | } |
339 | 341 | |
340 | 342 | /* save last state */ |
341 | | |
343 | m_ear_last_state = result; | |
342 | 344 | } |
343 | 345 | |
344 | 346 | /* free running counter */ |
r18114 | r18115 | |
747 | 749 | GAPNIO |
748 | 750 | ***************************************************************************/ |
749 | 751 | |
750 | ||
752 | TIMER_CALLBACK_MEMBER(px4_state::transmit_data) | |
751 | 753 | { |
752 | px4_state *px4 = machine.driver_data<px4_state>(); | |
753 | 754 | |
754 | if (BIT( | |
755 | if (BIT(m_artcr, 0))// ART_TX_ENABLED | |
755 | 756 | { |
756 | 757 | |
757 | 758 | } |
758 | 759 | } |
759 | 760 | |
760 | ||
761 | TIMER_CALLBACK_MEMBER(px4_state::receive_data) | |
761 | 762 | { |
762 | px4_state *px4 = machine.driver_data<px4_state>(); | |
763 | px4_state *px4 = machine().driver_data<px4_state>(); | |
763 | 764 | |
764 | 765 | if (ART_RX_ENABLED) |
765 | 766 | { |
r18114 | r18115 | |
1087 | 1088 | m_alarm_int_enabled = TRUE; |
1088 | 1089 | |
1089 | 1090 | /* art */ |
1090 | m_receive_timer = machine().scheduler().timer_alloc(FUNC(receive_data)); | |
1091 | m_transmit_timer = machine().scheduler().timer_alloc(FUNC(transmit_data)); | |
1091 | m_receive_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::receive_data),this)); | |
1092 | m_transmit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::transmit_data),this)); | |
1092 | 1093 | |
1093 | 1094 | /* printer */ |
1094 | 1095 | m_centronics = machine().device<centronics_device>("centronics"); |
1095 | 1096 | |
1096 | 1097 | /* external cassette or barcode reader */ |
1097 | m_ext_cas_timer = machine().scheduler().timer_alloc(FUNC(ext_cassette_read)); | |
1098 | m_ext_cas_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(px4_state::ext_cassette_read),this)); | |
1098 | 1099 | m_ext_cas = machine().device<cassette_image_device>("extcas"); |
1099 | 1100 | m_ear_last_state = 0; |
1100 | 1101 |
r18114 | r18115 | |
---|---|---|
88 | 88 | DECLARE_READ8_MEMBER ( cassette_r ); |
89 | 89 | DECLARE_WRITE8_MEMBER ( cassette_w ); |
90 | 90 | DECLARE_DRIVER_INIT(vg5k); |
91 | TIMER_CALLBACK_MEMBER(z80_irq_clear); | |
91 | 92 | }; |
92 | 93 | |
93 | 94 | |
r18114 | r18115 | |
274 | 275 | INPUT_PORTS_END |
275 | 276 | |
276 | 277 | |
277 | ||
278 | TIMER_CALLBACK_MEMBER(vg5k_state::z80_irq_clear) | |
278 | 279 | { |
279 | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
280 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); | |
280 | 281 | } |
281 | 282 | |
282 | 283 | |
283 | 284 | static TIMER_DEVICE_CALLBACK( z80_irq ) |
284 | 285 | { |
286 | vg5k_state *state = timer.machine().driver_data<vg5k_state>(); | |
285 | 287 | timer.machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); |
286 | 288 | |
287 | timer.machine().scheduler().timer_set(attotime::from_usec(100), FUNC(z80_irq_clear)); | |
289 | timer.machine().scheduler().timer_set(attotime::from_usec(100), timer_expired_delegate(FUNC(vg5k_state::z80_irq_clear),state)); | |
288 | 290 | } |
289 | 291 | |
290 | 292 | static TIMER_DEVICE_CALLBACK( vg5k_scanline ) |
r18114 | r18115 | |
---|---|---|
60 | 60 | DECLARE_WRITE_LINE_MEMBER( irq13_w ); |
61 | 61 | DECLARE_WRITE_LINE_MEMBER( irq14_w ); |
62 | 62 | DECLARE_WRITE_LINE_MEMBER( irq15_w ); |
63 | TIMER_CALLBACK_MEMBER(pad_func); | |
63 | 64 | }; |
64 | 65 | |
65 | 66 | |
r18114 | r18115 | |
117 | 118 | return res; |
118 | 119 | } |
119 | 120 | |
120 | ||
121 | TIMER_CALLBACK_MEMBER(pcfx_state::pad_func) | |
121 | 122 | { |
122 | pcfx_state *state = machine.driver_data<pcfx_state>(); | |
123 | 123 | const char *const padnames[] = { "P1", "P2" }; |
124 | 124 | |
125 | state->m_pad.latch[param] = machine.root_device().ioport(padnames[param])->read(); | |
126 | state->m_pad.status[param] |= 8; | |
127 | state->m_pad.ctrl[param] &= ~1; // ack TX line | |
125 | m_pad.latch[param] = machine().root_device().ioport(padnames[param])->read(); | |
126 | m_pad.status[param] |= 8; | |
127 | m_pad.ctrl[param] &= ~1; // ack TX line | |
128 | 128 | // TODO: pad IRQ |
129 | // s | |
129 | // set_irq_line(11, 1); | |
130 | 130 | } |
131 | 131 | |
132 | 132 | WRITE16_MEMBER( pcfx_state::pad_w ) |
r18114 | r18115 | |
143 | 143 | */ |
144 | 144 | if(data & 1 && (!(m_pad.ctrl[port_type] & 1))) |
145 | 145 | { |
146 | machine().scheduler().timer_set(attotime::from_msec(1), FUNC(pad_func), port_type); // TODO: time | |
146 | machine().scheduler().timer_set(attotime::from_msec(1), timer_expired_delegate(FUNC(pcfx_state::pad_func),this), port_type); // TODO: time | |
147 | 147 | } |
148 | 148 | |
149 | 149 | m_pad.ctrl[port_type] = data & 7; |
r18114 | r18115 | |
---|---|---|
124 | 124 | virtual void machine_reset(); |
125 | 125 | UINT32 screen_update_pockstat(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
126 | 126 | DECLARE_INPUT_CHANGED_MEMBER(input_update); |
127 | TIMER_CALLBACK_MEMBER(timer_tick); | |
128 | TIMER_CALLBACK_MEMBER(rtc_tick); | |
127 | 129 | }; |
128 | 130 | |
129 | 131 | |
r18114 | r18115 | |
182 | 184 | |
183 | 185 | |
184 | 186 | // Timers |
185 | ||
187 | ||
186 | 188 | static void ps_timer_start(running_machine &machine, int index); |
187 | 189 | |
188 | 190 | |
r18114 | r18115 | |
192 | 194 | |
193 | 195 | |
194 | 196 | // RTC |
195 | static TIMER_CALLBACK( rtc_tick ); | |
196 | 197 | |
197 | 198 | |
198 | 199 | |
200 | ||
199 | 201 | #define PS_INT_BTN_ACTION 0x00000001 // "Action button" |
200 | 202 | #define PS_INT_BTN_RIGHT 0x00000002 // "Right button" |
201 | 203 | #define PS_INT_BTN_LEFT 0x00000004 // "Left button" |
r18114 | r18115 | |
422 | 424 | } |
423 | 425 | } |
424 | 426 | |
425 | ||
427 | TIMER_CALLBACK_MEMBER(pockstat_state::timer_tick) | |
426 | 428 | { |
427 | pockstat_state *state = machine.driver_data<pockstat_state>(); | |
428 | ps_intc_set_interrupt_line(machine, param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); | |
429 | ps_intc_set_interrupt_line(machine(), param == 2 ? PS_INT_TIMER2 : (param == 1 ? PS_INT_TIMER1 : PS_INT_TIMER0), 1); | |
429 | 430 | //printf( "Timer %d is calling back\n", param ); |
430 | state->m_timer_regs.timer[param].count = state->m_timer_regs.timer[param].period; | |
431 | ps_timer_start(machine, param); | |
431 | m_timer_regs.timer[param].count = m_timer_regs.timer[param].period; | |
432 | ps_timer_start(machine(), param); | |
432 | 433 | } |
433 | 434 | |
434 | 435 | static void ps_timer_start(running_machine &machine, int index) |
r18114 | r18115 | |
561 | 562 | } |
562 | 563 | } |
563 | 564 | |
564 | ||
565 | TIMER_CALLBACK_MEMBER(pockstat_state::rtc_tick) | |
565 | 566 | { |
566 | pockstat_state *state = machine.driver_data<pockstat_state>(); | |
567 | 567 | //printf( "RTC is calling back\n" ); |
568 | ps_intc_set_interrupt_line(machine, PS_INT_RTC, ps_intc_get_interrupt_line(machine, PS_INT_RTC) ? 0 : 1); | |
569 | if(!(state->m_rtc_regs.mode & 1)) | |
568 | ps_intc_set_interrupt_line(machine(), PS_INT_RTC, ps_intc_get_interrupt_line(machine(), PS_INT_RTC) ? 0 : 1); | |
569 | if(!(m_rtc_regs.mode & 1)) | |
570 | 570 | { |
571 | state->m_rtc_regs.time++; | |
572 | if((state->m_rtc_regs.time & 0x0000000f) == 0x0000000a) | |
571 | m_rtc_regs.time++; | |
572 | if((m_rtc_regs.time & 0x0000000f) == 0x0000000a) | |
573 | 573 | { |
574 | state->m_rtc_regs.time &= 0xfffffff0; | |
575 | state->m_rtc_regs.time += 0x00000010; | |
576 | if((state->m_rtc_regs.time & 0x000000ff) == 0x00000060) | |
574 | m_rtc_regs.time &= 0xfffffff0; | |
575 | m_rtc_regs.time += 0x00000010; | |
576 | if((m_rtc_regs.time & 0x000000ff) == 0x00000060) | |
577 | 577 | { |
578 | state->m_rtc_regs.time &= 0xffffff00; | |
579 | state->m_rtc_regs.time += 0x00000100; | |
580 | if((state->m_rtc_regs.time & 0x00000f00) == 0x00000a00) | |
578 | m_rtc_regs.time &= 0xffffff00; | |
579 | m_rtc_regs.time += 0x00000100; | |
580 | if((m_rtc_regs.time & 0x00000f00) == 0x00000a00) | |
581 | 581 | { |
582 | state->m_rtc_regs.time &= 0xfffff0ff; | |
583 | state->m_rtc_regs.time += 0x00001000; | |
584 | if((state->m_rtc_regs.time & 0x0000ff00) == 0x00006000) | |
582 | m_rtc_regs.time &= 0xfffff0ff; | |
583 | m_rtc_regs.time += 0x00001000; | |
584 | if((m_rtc_regs.time & 0x0000ff00) == 0x00006000) | |
585 | 585 | { |
586 | state->m_rtc_regs.time &= 0xffff00ff; | |
587 | state->m_rtc_regs.time += 0x00010000; | |
588 | if((state->m_rtc_regs.time & 0x00ff0000) == 0x00240000) | |
586 | m_rtc_regs.time &= 0xffff00ff; | |
587 | m_rtc_regs.time += 0x00010000; | |
588 | if((m_rtc_regs.time & 0x00ff0000) == 0x00240000) | |
589 | 589 | { |
590 | state->m_rtc_regs.time &= 0xff00ffff; | |
591 | state->m_rtc_regs.time += 0x01000000; | |
592 | if((state->m_rtc_regs.time & 0x0f000000) == 0x08000000) | |
590 | m_rtc_regs.time &= 0xff00ffff; | |
591 | m_rtc_regs.time += 0x01000000; | |
592 | if((m_rtc_regs.time & 0x0f000000) == 0x08000000) | |
593 | 593 | { |
594 | state->m_rtc_regs.time &= 0xf0ffffff; | |
595 | state->m_rtc_regs.time |= 0x01000000; | |
594 | m_rtc_regs.time &= 0xf0ffffff; | |
595 | m_rtc_regs.time |= 0x01000000; | |
596 | 596 | } |
597 | 597 | } |
598 | else if(( | |
598 | else if((m_rtc_regs.time & 0x000f0000) == 0x000a0000) | |
599 | 599 | { |
600 | state->m_rtc_regs.time &= 0xfff0ffff; | |
601 | state->m_rtc_regs.time += 0x00100000; | |
600 | m_rtc_regs.time &= 0xfff0ffff; | |
601 | m_rtc_regs.time += 0x00100000; | |
602 | 602 | } |
603 | 603 | } |
604 | 604 | } |
605 | 605 | } |
606 | 606 | } |
607 | 607 | } |
608 | | |
608 | m_rtc_regs.timer->adjust(attotime::from_hz(1)); | |
609 | 609 | } |
610 | 610 | |
611 | 611 | READ32_MEMBER(pockstat_state::ps_rtc_r) |
r18114 | r18115 | |
875 | 875 | int index = 0; |
876 | 876 | for(index = 0; index < 3; index++) |
877 | 877 | { |
878 | m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(FUNC(timer_tick)); | |
878 | m_timer_regs.timer[index].timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::timer_tick),this)); | |
879 | 879 | m_timer_regs.timer[index].timer->adjust(attotime::never, index); |
880 | 880 | } |
881 | 881 | |
882 | 882 | m_rtc_regs.time = 0x01000000; |
883 | 883 | m_rtc_regs.date = 0x19990101; |
884 | 884 | |
885 | m_rtc_regs.timer = machine().scheduler().timer_alloc(FUNC(rtc_tick)); | |
885 | m_rtc_regs.timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(pockstat_state::rtc_tick),this)); | |
886 | 886 | m_rtc_regs.timer->adjust(attotime::from_hz(1), index); |
887 | 887 | |
888 | 888 | save_item(NAME(m_ftlb_regs.control)); |
Previous | 199869 Revisions | Next |