This is a fun thing to try as a "1st year" programming assignment.
As far as making it standard, there's too many possible output formats
to try to anticipate. Know the format that you plan use and the complexity
of the program falls away. Try to be aware of null suppression and other
output compression defaults and turn them off.
I grabbed a copy of KERMIT.EXE for VAX in ~1983 by capturing a $DUMP
stream and deformatting it in this way. Very gratifying.
John A.