Previous 15994 Revisions Next

r1091 Monday 8th October, 2007 at 19:28:17 UTC by Wilbert Pol
[GAMEBOY] Added a function to make sure the video hardware state is up to date.
[src/mess/includes]gb.h
[src/mess/machine]gb.c
[src/mess/video]gb.c

src/mess/includes/gb.h
r1090r1091
7272void gb_video_init( void );
7373void sgb_video_init( void );
7474void gbc_video_init( void );
75void gb_video_up_to_date( void );
7576
7677EXTERN double lcd_time;
7778/* Custom Sound Interface */
src/mess/video/gb.c
r1090r1091
13461346   mame_timer_adjust( gb_lcd.lcd_timer, MAME_TIME_IN_CYCLES(80,0), GB_LCD_STATE_LYXX_M3, time_never );
13471347}
13481348
1349/* Make sure the video information is up to date */
1350void gb_video_up_to_date( void ) {
1351   mame_timer_set_global_time(mame_timer_get_time());
1352}
1353
13491354READ8_HANDLER( gb_video_r ) {
13501355//   if ( 0 && activecpu_get_pc() > 0x100 ) {
13511356//      logerror("LCDSTAT/LY read, cycles left is %d\n", (int)MAME_TIME_TO_CYCLES(0,mame_timer_timeleft( gb_lcd.lcd_timer )) );
13521357//   }
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();
13551359   return gb_vid_regs[offset];
13561360}
13571361
13581362/* Ignore write when LCD is on and STAT is 02 or 03 */
13591363int 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();
13621365   if ( ( LCDCONT & 0x80 ) && ( LCDSTAT & 0x02 ) ) {
13631366      return 1;
13641367   }
r1090r1091
13671370
13681371/* Ignore write when LCD is on and STAT is not 03 */
13691372int 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();
13721374   if ( ( LCDCONT & 0x80 ) && ( ( LCDSTAT & 0x03 ) == 0x03 ) ) {
13731375      return 1;
13741376   }
src/mess/machine/gb.c
r1090r1091
12641264         return gb_io[offset];
12651265      case 0x0F:
12661266         /* Make sure the internal states are up to date */
1267         mame_timer_set_global_time(mame_timer_get_time());
1267         gb_video_up_to_date();
12681268         return 0xE0 | cpunum_get_reg( 0, Z80GB_IF );
12691269      default:
12701270         /* It seems unsupported registers return 0xFF */

Previous 15994 Revisions Next


© 1998-2018 The MESS Team