Code does not deteriorate
If code was error free decades ago, it is still error free. If there are bugs in there they were there in 1980. However, NASA spends a lot of time and money on testing – the kind of time and money most projects don't have.
So it is not surprising that code written and working in 1980 still works today. Hardware deteriorates, so that is the miracle that the hardware still worked.
This illustrates a difference between software and hardware. But bespoke hardware built and thoroughly tested for NASA at great expense would be much more rugged than modern off-the-shelf hardware that most of us use and can afford.