Article View: comp.sys.atari.st
Article #5339Re: Self-Modifying Code
From: Steve Yelvington
Date: Fri, 27 Oct 1989 16:28
Date: Fri, 27 Oct 1989 16:28
37 lines
2388 bytes
2388 bytes
In article <8910270333.AA14741@cscwam.UMD.EDU>,
dmb@wam.UMD.EDU (David M. Baggett) writes ...
>Richard Covert writes:
<bunch of stuff about configuration files and self-modifying code deleted>
>>3) Write to the PRG file. Best of all since you need it to
>>run his program!!
>
>No offense, but I really think this is a "sleazy hack". What's the point of
>doing this? Then you have to worry about what happens when you
>(heaven forbid) modify the source code and recompile, thereby changing
>the size of the executable. And, as you pointed out, you have to come
>up with some "clever" scheme to make sure you don't clobber something
>useful (like executable code) in your binary. Whatever you come up
>with will likely be non-portable as well.
I use MicroEMACS 2.19, a small, fast text editor. I wanted to save the
margin settings and a few other characteristics, but having to load a
configuration file (a) slows down program invocation, and (b) provides yet
another opportunity for something to go wrong, i.e., the configuration
file gets lost.
I remembered an old CP/M communications program called MEX that had the
ability to "clone" itself -- to write a modified version of the running
program back to disk.
So I whined at Dale Schumacher, who was handling the MicroEMACS
modifications, until I got him to add such a feature. I assume that it
indeed is nonportable, but is set off by #ifdef ATARI_ST in the source
code. I don't know any details about the technique. Perhaps Dale can be
persuaded to describe it.
Steve Yelvington, up at the lake in Minnesota
... pwcs.StPaul.GOV!stag!thelake!steve (Usenet)
... {playgrnd,moundst,class68}!thelake!steve (Citadel)
Technical Details
Message-ID:
<0927891128429423@thelake.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uwvax!umn-d-ub!umn-cs!thelake!steveReferences:
<8910270333.AA14741@cscwam.UMD.EDU>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!uwm.edu!uwvax!umn-d-ub!umn-cs!thelake!steve From: steve@thelake.UUCP (Steve Yelvington) Newsgroups: comp.sys.atari.st Subject: Re: Self-Modifying Code Message-ID: <0927891128429423@thelake.UUCP> Date: 27 Oct 89 16:28:42 GMT References: <8910270333.AA14741@cscwam.UMD.EDU> Reply-To: pwcs.StPaul.GOV!stag!thelake!steve Followup-To: comp.sys.atari.st Organization: Otter Lake Leisure Society (MN-USA) Lines: 37 X-Mailer: UUMAIL/Atari ST/TOS 1.0 X-Member-Of: STdNet, the ST Developers' Network X-Snail-Mail: 1392 Brandlwood, White Bear Lake, MN 55110 USA