Joined
·
404 Posts
My VC++7.1 warned me about a problem in the CPULoop function. Is it ok just to replace "tm1d" with "tm1d & 0xFFFF" ?
TM1D has a bigger value than 0xFFFF
TM1D has a bigger value than 0xFFFF
Code:
GBA.cpp
function: CPULoop
CRT-Check: Loss of data because of data type cast
...
if(timer1ClockReload == 1) {
u32 tm1d = TM1D + clockTicks;
if(tm1d > 0xffff) {
tm1d += timer1Reload;
timerOverflow |= 2;
soundTimerOverflow(1);
if(TM1CNT & 0x40) {
IF |= 0x10;
UPDATE_REG(0x202, IF);
}
}
//TODO: Check if we need a bitmask
TM1D = tm1d;
timer1Ticks = 0x10000 - TM1D;
UPDATE_REG(0x104, TM1D);
} else {
timer1Ticks -= clockTicks;
if(timer1Ticks <= 0) {
timer1Ticks += timer1ClockReload;
TM1D++;
...