src/mess/video/gb.c
| r1090 | r1091 | |
| 1346 | 1346 | mame_timer_adjust( gb_lcd.lcd_timer, MAME_TIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, time_never ); |
| 1347 | 1347 | } |
| 1348 | 1348 | |
| 1349 | /* Make sure the video information is up to date */ |
| 1350 | void gb_video_up_to_date( void ) { |
| 1351 | mame_timer_set_global_time(mame_timer_get_time()); |
| 1352 | } |
| 1353 | |
| 1349 | 1354 | READ8_HANDLER( gb_video_r ) { |
| 1350 | 1355 | // if ( 0 && activecpu_get_pc() > 0x100 ) { |
| 1351 | 1356 | // logerror("LCDSTAT/LY read, cycles left is %d\n", (int)MAME_TIME_TO_CYCLES(0,mame_timer_timeleft( gb_lcd.lcd_timer )) ); |
| 1352 | 1357 | // } |
| 1353 | | if ( (int)MAME_TIME_TO_CYCLES(0,mame_timer_timeleft( gb_lcd.lcd_timer)) <= 0 ) |
| 1354 | | mame_timer_set_global_time(mame_timer_get_time()); |
| 1358 | gb_video_up_to_date(); |
| 1355 | 1359 | return gb_vid_regs[offset]; |
| 1356 | 1360 | } |
| 1357 | 1361 | |
| 1358 | 1362 | /* Ignore write when LCD is on and STAT is 02 or 03 */ |
| 1359 | 1363 | int gb_video_oam_locked( void ) { |
| 1360 | | if ( (int)MAME_TIME_TO_CYCLES(0,mame_timer_timeleft( gb_lcd.lcd_timer)) <= 0 ) |
| 1361 | | mame_timer_set_global_time(mame_timer_get_time()); |
| 1364 | gb_video_up_to_date(); |
| 1362 | 1365 | if ( ( LCDCONT & 0x80 ) && ( LCDSTAT & 0x02 ) ) { |
| 1363 | 1366 | return 1; |
| 1364 | 1367 | } |
| r1090 | r1091 | |
| 1367 | 1370 | |
| 1368 | 1371 | /* Ignore write when LCD is on and STAT is not 03 */ |
| 1369 | 1372 | int gb_video_vram_locked( void ) { |
| 1370 | | if ( (int)MAME_TIME_TO_CYCLES(0,mame_timer_timeleft( gb_lcd.lcd_timer)) <= 0 ) |
| 1371 | | mame_timer_set_global_time(mame_timer_get_time()); |
| 1373 | gb_video_up_to_date(); |
| 1372 | 1374 | if ( ( LCDCONT & 0x80 ) && ( ( LCDSTAT & 0x03 ) == 0x03 ) ) { |
| 1373 | 1375 | return 1; |
| 1374 | 1376 | } |