File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -313,17 +313,21 @@ impl LCD {
313
313
314
314
self . scanline_cycle_count = LCD :: SCANLINE_CYCLE_TOTAL ;
315
315
match self . lcd_y {
316
- 0 ..=SCREEN_HEIGHT if self . lcd_y < SCREEN_HEIGHT => self . draw_scanline ( ) ,
317
- SCREEN_HEIGHT => ih. set_interrupt ( Interrupt :: VBlank ) ,
316
+ 0 ..=SCREEN_HEIGHT if self . lcd_y < SCREEN_HEIGHT => {
317
+ self . draw_scanline ( ) ;
318
+ self . lcd_y += 1 ;
319
+ } ,
320
+ SCREEN_HEIGHT => {
321
+ ih. set_interrupt ( Interrupt :: VBlank ) ;
322
+ self . lcd_y += 1 ;
323
+ } ,
318
324
// TODO: pad this out to reduce lag?
319
325
// (give the emulated cpu more time than
320
326
// the actual hardware cpu would have had
321
327
// to process each frame)
322
328
LCD :: VBLANK_HEIGHT => self . lcd_y = 0 ,
323
- _ => ( ) ,
329
+ _ => self . lcd_y += 1 ,
324
330
}
325
-
326
- self . lcd_y += 1 ;
327
331
}
328
332
329
333
pub fn vblank_reached ( & mut self ) -> bool {
@@ -510,7 +514,7 @@ impl LCD {
510
514
511
515
// calculate the line within the sprite that the current LCD line intersects
512
516
let sprite_line = if sprite. attributes . y_flip ( ) {
513
- y_size - ( self . lcd_y + 16 - y_pos)
517
+ 7 - ( self . lcd_y + 16 - y_pos)
514
518
} else {
515
519
self . lcd_y + 16 - y_pos
516
520
} ;
You can’t perform that action at this time.
0 commit comments