src/mess/video/gb.c
| r6785 | r6786 | |
| 1283 | 1283 | cputag_set_input_line( machine, "maincpu", VBL_INT, ASSERT_LINE ); |
| 1284 | 1284 | } |
| 1285 | 1285 | |
| 1286 | | void gb_video_init( running_machine *machine, int mode ) |
| 1286 | MACHINE_START( gb_video ) |
| 1287 | 1287 | { |
| 1288 | gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc, NULL); |
| 1289 | } |
| 1290 | |
| 1291 | MACHINE_START( gbc_video ) |
| 1292 | { |
| 1293 | gb_lcd.lcd_timer = timer_alloc(machine, gbc_lcd_timer_proc, NULL); |
| 1294 | } |
| 1295 | |
| 1296 | void gb_video_reset( running_machine *machine, int mode ) |
| 1297 | { |
| 1288 | 1298 | int i; |
| 1289 | 1299 | int vram_size = 0x2000; |
| 1290 | 1300 | const address_space *space = cputag_get_address_space(machine, "maincpu", ADDRESS_SPACE_PROGRAM); |
| 1301 | emu_timer *old_timer = gb_lcd.lcd_timer; |
| 1291 | 1302 | |
| 1292 | 1303 | memset( &gb_lcd, 0, sizeof(gb_lcd) ); |
| 1304 | gb_lcd.lcd_timer = old_timer; |
| 1293 | 1305 | |
| 1294 | 1306 | if (mode == GB_VIDEO_CGB) vram_size = 0x4000; |
| 1295 | 1307 | |
| r6785 | r6786 | |
| 1328 | 1340 | switch( mode ) |
| 1329 | 1341 | { |
| 1330 | 1342 | case GB_VIDEO_DMG: |
| 1331 | | gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc , NULL); |
| 1332 | 1343 | timer_adjust_oneshot(gb_lcd.lcd_timer, cputag_clocks_to_attotime(machine, "maincpu", 456), 0); |
| 1333 | 1344 | |
| 1334 | 1345 | /* set the scanline update function */ |
| r6785 | r6786 | |
| 1338 | 1349 | |
| 1339 | 1350 | break; |
| 1340 | 1351 | case GB_VIDEO_MGB: |
| 1341 | | gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc , NULL); |
| 1342 | | |
| 1343 | 1352 | /* set the scanline update function */ |
| 1344 | 1353 | update_scanline = gb_update_scanline; |
| 1345 | 1354 | /* Initialize part of VRAM. This code must be deleted when we have added the bios dump */ |
| r6785 | r6786 | |
| 1369 | 1378 | |
| 1370 | 1379 | break; |
| 1371 | 1380 | case GB_VIDEO_SGB: |
| 1372 | | gb_lcd.lcd_timer = timer_alloc(machine, gb_lcd_timer_proc , NULL); |
| 1373 | | |
| 1374 | 1381 | /* set the scanline update function */ |
| 1375 | 1382 | update_scanline = sgb_update_scanline; |
| 1376 | 1383 | |
| 1377 | 1384 | break; |
| 1378 | 1385 | |
| 1379 | 1386 | case GB_VIDEO_CGB: |
| 1380 | | gb_lcd.lcd_timer = timer_alloc(machine, gbc_lcd_timer_proc , NULL); |
| 1381 | | |
| 1382 | 1387 | /* set the scanline update function */ |
| 1383 | 1388 | update_scanline = cgb_update_scanline; |
| 1384 | 1389 | |
src/mess/includes/gb.h
| r6785 | r6786 | |
| 78 | 78 | extern MACHINE_RESET( sgb ); |
| 79 | 79 | extern WRITE8_HANDLER ( sgb_io_w ); |
| 80 | 80 | |
| 81 | MACHINE_START( gbc ); |
| 81 | 82 | MACHINE_RESET( gbc ); |
| 82 | 83 | |
| 83 | 84 | |
| 84 | 85 | /* -- Megaduck specific -- */ |
| 85 | 86 | extern DEVICE_IMAGE_LOAD(megaduck_cart); |
| 87 | extern MACHINE_START( megaduck ); |
| 86 | 88 | extern MACHINE_RESET( megaduck ); |
| 87 | 89 | extern READ8_HANDLER( megaduck_video_r ); |
| 88 | 90 | extern WRITE8_HANDLER( megaduck_video_w ); |
| r6785 | r6786 | |
| 120 | 122 | |
| 121 | 123 | READ8_HANDLER( gb_video_r ); |
| 122 | 124 | WRITE8_HANDLER( gb_video_w ); |
| 123 | | void gb_video_init( running_machine *machine, int mode ); |
| 125 | MACHINE_START( gb_video ); |
| 126 | MACHINE_START( gbc_video ); |
| 127 | void gb_video_reset( running_machine *machine, int mode ); |
| 124 | 128 | UINT8 *gb_get_vram_ptr(running_machine *machine); |
| 125 | 129 | |
| 126 | 130 | |
src/mess/machine/gb.c
| r6785 | r6786 | |
| 304 | 304 | /* Allocate the serial timer, and disable it */ |
| 305 | 305 | gb_driver_data.gb_serial_timer = timer_alloc(machine, gb_serial_timer_proc , NULL); |
| 306 | 306 | timer_enable( gb_driver_data.gb_serial_timer, 0 ); |
| 307 | |
| 308 | MACHINE_START_CALL( gb_video ); |
| 307 | 309 | } |
| 308 | 310 | |
| 311 | MACHINE_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 | |
| 309 | 322 | MACHINE_RESET( gb ) |
| 310 | 323 | { |
| 311 | 324 | gb_init(machine); |
| 312 | 325 | |
| 313 | | gb_video_init( machine, GB_VIDEO_DMG ); |
| 326 | gb_video_reset( machine, GB_VIDEO_DMG ); |
| 314 | 327 | |
| 315 | 328 | gb_rom16_0000( machine, gb_driver_data.ROMMap[gb_driver_data.ROMBank00] ); |
| 316 | 329 | |
| r6785 | r6786 | |
| 324 | 337 | { |
| 325 | 338 | gb_init(machine); |
| 326 | 339 | |
| 327 | | gb_video_init( machine, GB_VIDEO_SGB ); |
| 340 | gb_video_reset( machine, GB_VIDEO_SGB ); |
| 328 | 341 | |
| 329 | 342 | gb_init_regs(machine); |
| 330 | 343 | |
| r6785 | r6786 | |
| 359 | 372 | { |
| 360 | 373 | gb_init(machine); |
| 361 | 374 | |
| 362 | | gb_video_init( machine, GB_VIDEO_MGB ); |
| 375 | gb_video_reset( machine, GB_VIDEO_MGB ); |
| 363 | 376 | |
| 364 | 377 | gb_init_regs(machine); |
| 365 | 378 | |
| r6785 | r6786 | |
| 380 | 393 | |
| 381 | 394 | gb_init(machine); |
| 382 | 395 | |
| 383 | | gb_video_init( machine, GB_VIDEO_CGB ); |
| 396 | gb_video_reset( machine, GB_VIDEO_CGB ); |
| 384 | 397 | |
| 385 | 398 | gb_init_regs(machine); |
| 386 | 399 | |
| r6785 | r6786 | |
| 2026 | 2039 | |
| 2027 | 2040 | ****************************************************************************/ |
| 2028 | 2041 | |
| 2042 | MACHINE_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 | |
| 2029 | 2051 | MACHINE_RESET( megaduck ) |
| 2030 | 2052 | { |
| 2031 | 2053 | /* We may have to add some more stuff here, if not then it can be merged back into gb */ |
| 2032 | 2054 | gb_init(machine); |
| 2033 | 2055 | |
| 2034 | | gb_video_init( machine, GB_VIDEO_DMG ); |
| 2056 | gb_video_reset( machine, GB_VIDEO_DMG ); |
| 2035 | 2057 | } |
| 2036 | 2058 | |
| 2037 | 2059 | /* |