core: Clamp BLDY to 0..16

As per the GBATEK docs. Fixes the fadeout animations in Ice Age.

Former-commit-id: 0bc54ab594ba19347a4b6d1b681ccf37da4d7910
Former-commit-id: 33b732e7f990c312bf92bcc21797df35b3d2ce56
This commit is contained in:
Tibor Nagy 2020-05-16 11:30:16 +02:00 committed by MishMish
parent 9bb39fe135
commit db3be711ae

View file

@ -1,3 +1,5 @@
use std::cmp;
use super::dma::DmaController; use super::dma::DmaController;
use super::gpu::regs::WindowFlags; use super::gpu::regs::WindowFlags;
use super::gpu::*; use super::gpu::*;
@ -216,7 +218,7 @@ impl Bus for IoDevices {
REG_MOSAIC => io.gpu.mosaic.0 = value, REG_MOSAIC => io.gpu.mosaic.0 = value,
REG_BLDCNT => io.gpu.bldcnt.0 = value, REG_BLDCNT => io.gpu.bldcnt.0 = value,
REG_BLDALPHA => io.gpu.bldalpha.0 = value, REG_BLDALPHA => io.gpu.bldalpha.0 = value,
REG_BLDY => io.gpu.bldy = value & 0b11111, REG_BLDY => io.gpu.bldy = cmp::min(value & 0b11111, 16),
REG_IME => io.intc.interrupt_master_enable = value != 0, REG_IME => io.intc.interrupt_master_enable = value != 0,
REG_IE => io.intc.interrupt_enable.0 = value, REG_IE => io.intc.interrupt_enable.0 = value,