Previous 15994 Revisions Next

r6786 Sunday 27th December, 2009 at 10:04:34 UTC by Wilbert Pol
[GAMEBOY family] Moved video timer allocation to the MACHINE_START phase.
[src/mess/drivers]gb.c
[src/mess/includes]gb.h
[src/mess/machine]gb.c
[src/mess/video]gb.c

src/mess/video/gb.c
r6785r6786
12831283   cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE );
12841284}
12851285
1286void gb_video_init( running_machine *machine, int mode )
1286MACHINE_START( gb_video )
12871287{
1288   gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc, NULL);
1289}
1290
1291MACHINE_START( gbc_video )
1292{
1293   gb_lcd.lcd_timer = timer_alloc(machine, gbc_lcd_timer_proc, NULL);
1294}
1295
1296void gb_video_reset( running_machine *machine, int mode )
1297{
12881298   int   i;
12891299   int vram_size = 0x2000;
12901300   const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM);
1301   emu_timer *old_timer = gb_lcd.lcd_timer;
12911302
12921303   memset( &gb_lcd, 0, sizeof(gb_lcd) );
1304   gb_lcd.lcd_timer = old_timer;
12931305
12941306   if (mode == GB_VIDEO_CGB) vram_size = 0x4000;
12951307
r6785r6786
13281340   switch( mode )
13291341   {
13301342   case GB_VIDEO_DMG:
1331      gb_lcd.lcd_timer = timer_alloc(machine,  gb_lcd_timer_proc , NULL);
13321343      timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 456), 0);
13331344
13341345      /* set the scanline update function */
r6785r6786
13381349
13391350      break;
13401351   case GB_VIDEO_MGB:
1341      gb_lcd.lcd_timer = timer_alloc(machine,  gb_lcd_timer_proc , NULL);
1342
13431352      /* set the scanline update function */
13441353      update_scanline = gb_update_scanline;
13451354      /* Initialize part of VRAM. This code must be deleted when we have added the bios dump */
r6785r6786
13691378
13701379      break;
13711380   case GB_VIDEO_SGB:
1372      gb_lcd.lcd_timer = timer_alloc(machine,  gb_lcd_timer_proc , NULL);
1373
13741381      /* set the scanline update function */
13751382      update_scanline = sgb_update_scanline;
13761383
13771384      break;
13781385
13791386   case GB_VIDEO_CGB:
1380      gb_lcd.lcd_timer = timer_alloc(machine,  gbc_lcd_timer_proc , NULL);
1381
13821387      /* set the scanline update function */
13831388      update_scanline = cgb_update_scanline;
13841389
src/mess/includes/gb.h
r6785r6786
7878extern MACHINE_RESET( sgb );
7979extern WRITE8_HANDLER ( sgb_io_w );
8080
81MACHINE_START( gbc );
8182MACHINE_RESET( gbc );
8283
8384
8485/* -- Megaduck specific -- */
8586extern DEVICE_IMAGE_LOAD(megaduck_cart);
87extern MACHINE_START( megaduck );
8688extern MACHINE_RESET( megaduck );
8789extern  READ8_HANDLER( megaduck_video_r );
8890extern WRITE8_HANDLER( megaduck_video_w );
r6785r6786
120122
121123READ8_HANDLER( gb_video_r );
122124WRITE8_HANDLER( gb_video_w );
123void gb_video_init( running_machine *machine, int mode );
125MACHINE_START( gb_video );
126MACHINE_START( gbc_video );
127void gb_video_reset( running_machine *machine, int mode );
124128UINT8 *gb_get_vram_ptr(running_machine *machine);
125129
126130
src/mess/machine/gb.c
r6785r6786
304304   /* Allocate the serial timer, and disable it */
305305   gb_driver_data.gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
306306   timer_enable( gb_driver_data.gb_serial_timer, 0 );
307
308   MACHINE_START_CALL( gb_video );
307309}
308310
311MACHINE_START( gbc )
312{
313   add_exit_callback(machine, gb_machine_stop);
314
315   /* Allocate the serial timer, and disable it */
316   gb_driver_data.gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
317   timer_enable( gb_driver_data.gb_serial_timer, 0 );
318
319   MACHINE_START_CALL( gbc_video );
320}
321
309322MACHINE_RESET( gb )
310323{
311324   gb_init(machine);
312325
313   gb_video_init( machine, GB_VIDEO_DMG );
326   gb_video_reset( machine, GB_VIDEO_DMG );
314327
315328   gb_rom16_0000( machine, gb_driver_data.ROMMap[gb_driver_data.ROMBank00] );
316329
r6785r6786
324337{
325338   gb_init(machine);
326339
327   gb_video_init( machine, GB_VIDEO_SGB );
340   gb_video_reset( machine, GB_VIDEO_SGB );
328341
329342   gb_init_regs(machine);
330343
r6785r6786
359372{
360373   gb_init(machine);
361374
362   gb_video_init( machine, GB_VIDEO_MGB );
375   gb_video_reset( machine, GB_VIDEO_MGB );
363376
364377   gb_init_regs(machine);
365378
r6785r6786
380393
381394   gb_init(machine);
382395
383   gb_video_init( machine, GB_VIDEO_CGB );
396   gb_video_reset( machine, GB_VIDEO_CGB );
384397
385398   gb_init_regs(machine);
386399
r6785r6786
20262039
20272040 ****************************************************************************/
20282041
2042MACHINE_START( megaduck )
2043{
2044   /* Allocate the serial timer, and disable it */
2045   gb_driver_data.gb_serial_timer = timer_alloc(machine,  gb_serial_timer_proc , NULL);
2046   timer_enable( gb_driver_data.gb_serial_timer, 0 );
2047
2048   MACHINE_START_CALL( gb_video );
2049}
2050
20292051MACHINE_RESET( megaduck )
20302052{
20312053   /* We may have to add some more stuff here, if not then it can be merged back into gb */
20322054   gb_init(machine);
20332055
2034   gb_video_init( machine, GB_VIDEO_DMG );
2056   gb_video_reset( machine, GB_VIDEO_DMG );
20352057}
20362058
20372059/*
src/mess/drivers/gb.c
r6785r6786
629629   MDRV_CPU_PROGRAM_MAP( gbc_map)
630630   MDRV_CPU_CONFIG(cgb_cpu_reset)
631631
632   MDRV_MACHINE_START(gbc)
632633   MDRV_MACHINE_RESET(gbc)
633634
634635   MDRV_PALETTE_LENGTH(32768)
r6785r6786
651652   MDRV_SCREEN_VBLANK_TIME(0)
652653   MDRV_QUANTUM_TIME(HZ(60))
653654
655   MDRV_MACHINE_START( megaduck )
654656   MDRV_MACHINE_RESET( megaduck )
655657
656658   MDRV_VIDEO_START( generic_bitmapped )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team