For the Spectrum, there's a tool called BASINc that can load a snapshot and save any BASIC listing as text.