Complex sentence: SHAM used computer code that was called on selected scan lines, or all of them, that changed the palette during the HBI, so that every line could have its own set of 16 base colors.
Split into simpler sentences: SHAM used computer code that was called on selected scan lines, or all of them, that changed the palette during the HBI. This meant that every scan line could have its own set of 16 base colors.