Previous 15994 Revisions Next

r1446 Friday 28th December, 2007 at 18:37:49 UTC by Wilbert Pol
[GAMEBOY] Improved penalty cycle count for enabled sprites.
[docs]messnew.txt
[src/mess/video]gb.c

src/mess/video/gb.c
r1445r1446
9090   int line_irq;
9191   int mode_irq;
9292   int delayed_line_irq;
93   int sprite_cycles;
9394   int scrollx_adjust;
9495   struct layer_struct   layer[2];
9596   emu_timer   *lcd_timer;
r1445r1446
196197  Select which sprites should be drawn for the current scanline and return the
197198  number of sprites selected.
198199 */
199static int gb_select_sprites( void ) {
200static void gb_select_sprites( void ) {
200201   int   i, yindex, line, height;
201202   UINT8   *oam = gb_oam + 39 * 4;
202203
r1445r1446
223224               gb_lcd.sprCount++;
224225            }
225226         }
227         oam -= 4;
226228      }
227229   }
228   return gb_lcd.sprCount;
229230}
230231
231232INLINE void gb_update_sprites (void)
r1445r1446
12771278
12781279static TIMER_CALLBACK(gb_lcd_timer_proc)
12791280{
1281   static const int sprite_cycles[] = { 0, 8, 20, 32, 44, 52, 64, 76, 88, 96, 108 };
12801282   int mode = param;
1283
12811284   if ( LCDCONT & 0x80 ) {
12821285      switch( mode ) {
12831286      case GB_LCD_STATE_LYXX_PRE_M0:   /* Just before switching to mode 0 */
r1445r1446
13131316         /* Check for HBLANK DMA */
13141317         if( gbc_hdma_enabled )
13151318            gbc_hdma(0x10);
1316         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(196 - gb_lcd.scrollx_adjust - 10 * gb_lcd.sprCount,0), GB_LCD_STATE_LYXX_M0_PRE_INC, attotime_never );
1319         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(196 - gb_lcd.scrollx_adjust - gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_M0_PRE_INC, attotime_never );
13171320         break;
13181321      case GB_LCD_STATE_LYXX_M0_PRE_INC:   /* Just before incrementing the line counter go to mode 2 internally */
13191322         if ( CURLINE < 143 ) {
r1445r1446
13861389         break;
13871390      case GB_LCD_STATE_LYXX_M3:      /* Switch to mode 3 */
13881391         gb_select_sprites();
1392         gb_lcd.sprite_cycles = sprite_cycles[ gb_lcd.sprCount ];
13891393         /* Set Mode 3 lcdstate */
13901394         gb_lcd.mode = 3;
13911395         LCDSTAT = (LCDSTAT & 0xFC) | 0x03;
r1445r1446
13951399         } else {
13961400            gb_lcd.scrollx_adjust = 0;
13971401         }
1398         /* Mode 3 lasts for approximately 172+#sprites*10 clock cycles */
1399         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + 10 * gb_lcd.sprCount,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
1402         /* Mode 3 lasts for approximately 172+cycles needed to handle sprites clock cycles */
1403         timer_adjust( gb_lcd.lcd_timer, ATTOTIME_IN_CYCLES(168 + gb_lcd.scrollx_adjust + gb_lcd.sprite_cycles,0), GB_LCD_STATE_LYXX_PRE_M0, attotime_never );
14001404         gb_lcd.start_x = 0;
14011405         break;
14021406      case GB_LCD_STATE_LY9X_M1:      /* Switch to or stay in mode 1 */
docs/messnew.txt
r1445r1446
2424
2525- [GAMEBOY] Improved handling of OAM locking in certain STAT modes.  [Wilbert Pol]
2626
27- [GAMEBOY] Improved penalty cycle count for enabled sprites.  [Wilbert Pol]
28
2729- [MEPHISTO] Fixed a keyboard mapping bug.  [Dirk Verwiebe]
2830
2931- [QL] Added sound. [Curt Coder]

Previous 15994 Revisions Next


© 1998-2018 The MESS Team