[hatari-devel] Incorrect register order in DSP_GetRegisterAddress

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


Hi there

DSP_GetRegisterAddress contains a binary search code to find the requested register. Tempted to argue about the need for this function to be "efficient" but I'll spare you that :)

The problem is that register names are not inserted into the table in alphabetical order. I guess some later addition when someone disregarded sorting requirements. As a result, looking up "SSH" register won't work.

Below is the fragment sorted properly.

Best
Mariusz

/* 16-bit DSP R (address) registers */
{ "R0",  &dsp_core.registers[DSP_REG_R0],  32, BITMASK(16) },
{ "R1",  &dsp_core.registers[DSP_REG_R1],  32, BITMASK(16) },
{ "R2",  &dsp_core.registers[DSP_REG_R2],  32, BITMASK(16) },
{ "R3",  &dsp_core.registers[DSP_REG_R3],  32, BITMASK(16) },
{ "R4",  &dsp_core.registers[DSP_REG_R4],  32, BITMASK(16) },
{ "R5",  &dsp_core.registers[DSP_REG_R5],  32, BITMASK(16) },
{ "R6",  &dsp_core..registers[DSP_REG_R6],  32, BITMASK(16) },
{ "R7",  &dsp_core.registers[DSP_REG_R7],  32, BITMASK(16) },

{ "SP",  &dsp_core.registers[DSP_REG_SP],  32, BITMASK(6) },

/* 16-bit status register */
{ "SR",  &dsp_core.registers[DSP_REG_SR],  32, 0xefff },

{ "SSH", &dsp_core.registers[DSP_REG_SSH], 32, BITMASK(16) },
{ "SSL", &dsp_core.registers[DSP_REG_SSL], 32, BITMASK(16) },

/* 48-bit X register */
{ "X0",  &dsp_core.registers[DSP_REG_X0],  32, BITMASK(24) },
{ "X1",  &dsp_core.registers[DSP_REG_X1],  32, BITMASK(24) },

/* 48-bit Y register */
{ "Y0",  &dsp_core.registers[DSP_REG_Y0],  32, BITMASK(24) },
{ "Y1",  &dsp_core.registers[DSP_REG_Y1],  32, BITMASK(24) }


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