Mode S was not introduced because of a shortage of Mode A (squawk) codes in congested airspace, but to improve the radar performance.
In congested airspace, a Mode A/C radar suffers from two technical phenomena: garbling and FRUIT.
Garbling occurs when the reply of two transponders overlap, causing the radar to have trouble in distinguishing the replies. This happens when aircraft are nearby each other.
FRUIT (Foreign Replies Unsynchronised in Time) occurs when a radar interprets a transponder's reply to an interrogation by another radar as a reply to its own interrogation.
Mode S (S = Selective) addressed both of these problems by introducing addressed interrogation, allowing radars to selectively solicit for replies of aircraft. For this the ICAO 24-bit address is used, uniquely assigned to each aircraft. Radars have a similar, albeit non-unique address, the IC/II (interrogator code / interrogator identifier).
So why can't the 24-bit address replace the 12 bit squawk code?
not everywhere on earth Mode S radars are used. There are still Mode A/C only radars around. For a long time, it was very common to have Mode A/C only. For the same reason, not every aircraft is equipped with a Mode-S transponder.
the squawk codes have a number of functions, some cannot be replaced by a static 24-bit address.
- correlating the radar track to a flight plan. This could be done based on 24-bit address
- signifying the nature of the flight (e.g. VFR 7000/1200 codes, 2000 code, dedicated codes for Helicopter Emergency Service etc) - this cannot be done based on the 24-bit address
- indicating emergency status (7500, 7600, 7700), this cannot be done based on the 24-bit address either.
In order to address the shortage of squawk codes, one of the approaches taken is to use the Flight ID (call sign) transmitted by the Mode-S transponder in lieu of the Squawk code for associating the radar track to a flight plan. In this case, the squawk code 1000 is used to signal to the flight data processing system that association shall be done base on Flight ID.