Re: [hatari-devel] Removing magic values from PSG?

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Am Fri, 03 Feb 2012 23:48:22 +0100
schrieb Nicolas Pomarède <npomarede@xxxxxxxxxxxx>:

> On 03/02/2012 23:32, Eero Tamminen wrote:
> > Hi,
> >
> > On lauantai 04 helmikuu 2012, Nicolas Pomarède wrote:
> >>> memset(PSGRegisters, 0, sizeof(PSGRegisters));
> >>> - for ( i=0 ; i<14 ; i++ ) /* Update sound's emulation registers
> >>> */
> >>> + /* Update sound's emulation registers */
> >>> + for ( i=0 ; i<  NUM_PSG_SOUND_REGISTERS; i++ )
> >>> Sound_WriteReg ( i , 0 );
> > ...
> >> By the way eero, you should use PSG_REG_IO_PORTA (=14) instead of
> >> NUM_PSG_SOUND_REGISTERS. Only sound related psg's registers should
> >> be sent to Sound_WriteReg (values above 14 will be ignored, but
> >> it's useless to send them anyway)
> >
> > NUM_PSG_SOUND_REGISTERS is 14.  (It was already in the psg.h header,
> > I didn't need to add that, just use it everywhere it's appropriate.)
> 
> My mistake, I mised it with NUM_PSG_REGISTERS that was added to the 
> enum. So it's ok.

Having two defines that nearly look the same can be quite confusing.
Maybe you could rename the new entry in the enum? MAX_PSG_REGISTERS or
something similar?

 Thomas



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/