It costs more to write new software than to maintain old hardware
Mission critical software developers only write around 6 lines of working code each day. It is usually cheaper to spend £50,000 a Year on maintaining an ancient mainframe than writing a million lines of new code.
An important consideration is that legacy software will usually work just as effectively on a simulation of an old computer as on the computer itself. Many legacy computers can be simulated on a PC and will run faster than they did on the original hardware. I know of two different companies who have replaced a Vax minicomputer by a HP supported Vax simulator for a PC.
Many people run Commodore 64, ZX Spectrum, Atari St and console games on their PCs with no problem.