Jump to content
Visual Boy Advance-M
spacy51

Unnecessary double check?

Recommended Posts

gba.cpp, Ln 2645:

case 0xC6:

{

bool start= ((DM1CNT_H ^ value) & 0x8000) ? true : false;

value &= 0xF7E0;

 

DM1CNT_H = value;

UPDATE_REG(0xC6, DM1CNT_H);

 

if(start && (value & 0x8000)) {

dma1Source = DM1SAD_L | (DM1SAD_H << 16);

dma1Dest = DM1DAD_L | (DM1DAD_H << 16);

CPUCheckDMA(0, 2);

}

}

break;

 

My personal logic tells me that the bold part is unneeded.

Share this post


Link to post
Share on other sites

Look at the beginning.

start is only true if bit 15 of value is set, so it does not make sense to seperately check for that again in the bold part.

Share this post


Link to post
Share on other sites

Look at the beginning.

start is only true if bit 15 of value is set, so it does not make sense to seperately check for that again in the bold part.

It tests bit 15 of (DM1CNT_H ^ value) and not just bit 15 of value.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×