There's no software involved. There is a selectable AID, Aircraft Installation Delay, that is a discrete. The 737, for example, uses a 57 foot AID. That's the distance from the transmit port of the transceiver, through the cable and antenna, to the ground at touchdown angle, and back through the receive antenna and cable to the receive port of the transceiver. Therefore, these are critical length cables, and any extra cable length needed to make the correct 0 feet is coiled in the belly of the plane.
When the radio altimeter starts reading -20 feet, it is because of signal leakage across the fuselage between antennas, or leakage at the mating connector to the transceiver. It can be a distance shorter than the indicated -20 feet, but that's the indicator limit.
The radio altimeter system is a good belly corrosion detector.
GB