Re: [Unichrome] Odd code in ViaModePrimaryVGA()
Brought to you by:
dwdeath
From: Barry S. <bar...@on...> - 2006-06-13 12:47:53
|
Clemens Kirchgatterer wrote: > Barry Scott <bar...@on...> wrote: > > >> I found this odd code sequence in ViaModePrimaryVGA() >> >> /* Set Misc Register */ >> temp = 0x23; >> if (mode->Flags & V_NHSYNC) >> temp |= 0x40; >> if (mode->Flags & V_NVSYNC) >> temp |= 0x80; >> temp |= 0x0C; /* Undefined/external clock */ >> hwp->writeMiscOut(hwp, temp); >> >> Having tested Flags to add bits into temp its then >> overwritten with 0x0c. >> >> Either the test of Flags is not required or ORing in 0x0c is >> wrong. >> > > no > > temp := 00100011 (0x23) > > temp |= 01000000 (0x40) > --------------------------------- > temp = 01100011 > > temp |= 00001100 (0xc0) > --------------------------------- > temp = 01101111 > > the only thing is that instead of initialising temp to 0x23 one could > init temp to 0x23 | 0x0c and leave out the last |=. but maybe this is > done for implizit code documentation. > > Oh thanks. Too much hex confused me. I misread 0x0c for 0xc0. To document things it would be great to see symbols used for these bits. Barry |