/*
 *
 * loadsave  Version 0.0  28NOV83
 *
 * This is the load/save subtree. It should be processor independent.
 *
 */

/*
 * TNIX/Unix/VMS Version
 * Keyshell Version Number 1
 */

loadsave
{
			>
			>\kload\e - Loads a program from a specified file with symbols, if desired.
			>
			>\ksave\e - Saves a program in memory to a specified file.
			f1;load; [loadmem];
			f2;save; {
				>
				cmd (^sav ), msg (^From addr: %P), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (sav);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				msg ( through addr: %P), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (sav);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				cmd (>), msg ( to file: %F), next;
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
#ifdef _UNIX
				f6;listfiles; call, cmd (^ls),
#else
#ifdef _VMS
				f6;listfiles; call, cmd (^dir),
#else
Error!  No operating system specified.
#endif
#endif
					msg (^), exec, return;
				f7;manual; man (sav);
				f8;done; msg (^), cmd (^), break;
			}, {
				>
				msg ( transfer addr: %p), exec,
					msg (^), cmd (^), break (2);
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
				f6;; hist;
				f7;manual; man (sav);
				f8;done; msg (^), cmd (^), break;
			};
			f8;done; msg (^), cmd (^), break;
}

/*
 * This is the load subtree.  It is generic and emulator independent.
 */

loadmem
{
>
>\kcode\e - Loads program only.
>
>\ksymbols\e - Loads symbols only.
>
>\kboth\e - Loads the symbols with the program.
			msg (^Type of load?);
			f1;code; {
				>
#ifndef _VMS
				cmd (^lo <), msg (^Filename: %f), exec,
#else
				cmd (^icom lo <), msg (^Filename: %f), exec,
#endif
					msg (^), break (2);
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
#ifdef _UNIX
				f6;listfiles; call, cmd (^ls),
#else
#ifdef _VMS
				f6;listfiles; call, cmd (^dir),
#else
Error!  No operating system specified.
#endif
#endif
					msg (^), exec, return;
				f7;manual; man (lo); 
				f8;done; msg (^), cmd (^), break (2);
			};
			f2;symbols; {
				>
				cmd (^symd on; ), cmd (^symlo <),
					msg (^Filename: %f), exec,
					msg (^), break (2);
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
#ifdef _UNIX
				f6;listfiles; call, cmd (^ls),
#else
#ifdef _VMS
				f6;listfiles; call, cmd (^dir),
#else
Error!  No operating system specified.
#endif
#endif
					msg (^), exec, return;
				f7;manual; man (symlo); 
				f8;done; msg (^), cmd (^), break (2);
			};
			f3;both; {
				>
				cmd (^symd on; ), cmd ( lo <),
					msg (^Filename: %f), cmd (; symlo <$2),
					exec, msg (^), break (2);
				f1;; hist;
				f2;; hist;
				f3;; hist;
				f4;; hist;
				f5;; hist;
#ifdef _UNIX
				f6;listfiles; call, cmd (^ls),
#else
#ifdef _VMS
				f6;listfiles; call, cmd (^dir),
#else
Error!  No operating system specified.
#endif
#endif
					msg (^), exec, return;
				f7;manual; man (lo); 
				f8;done; msg (^), cmd (^), break (2);
			};
			f8;done; msg (^), cmd (^), break;
}
