Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!wuarchive!uunet!zephyr.ens.tek.com!uw-beaver!uw-june!dylan From: dylan@cs.washington.edu (Dylan McNamee) Newsgroups: comp.sys.amiga.tech Subject: Re: Whats wrong with self Modifying Code? Keywords: religion, gurus, whats up? Message-ID: <12489@june.cs.washington.edu> Date: 7 Jul 90 18:17:00 GMT References: <1990Jul6.201328.24660@csmil.umich.edu> <1990Jul6.201743.24777@csmil.umich.edu> <11749@netcom.UUCP> Reply-To: dylan@june.cs.washington.edu (Dylan McNamee) Organization: University of Washington, Computer Science, Seattle Lines: 33 In article <11749@netcom.UUCP> mcmahan@netcom.UUCP (Dave Mc Mahan) writes: > > In a previous article, chymes@fribourg.csmil.umich.edu (Charles Hymes) writes: >>Oh great gurus, enlighten this poor soul who hath not programmed in >>Holy Assembler sence the loly 6502 was mighty. >>Yea, I pray that thou dost not blast my humble screen with mighty >>blasts of searing, wrathful flame, but knowest this, that I hath donned >>the sacred absphestos suit, and awaitest thou's marvelous revalation. >> >>I'd really like to know. >> >For one thing, It's not re-entrant. That means you can't let more than one Well, this isn't necessarily so...for example, if the modified code leaves the program in an executable state that doesn't perform the self modification. Then it's reentrant. The other posters mentioned difficulty of debugging such code, and I agree. I was using the 'mon' monitor/disassembler on my copy of SimCity, to see what I could see...and they use self modifying code all over. It plays havoc with mon. If you set a breakpoint in the self modified portion, the progam is in an invalid state when the breakpoint is reached. If you put the breakpoint in a 'stable' piece of code, all's cool. Finally, if you let the whole program run to exit, then select rerun on mon, it runs again without accessing the disk--reentrant(!) Pretty neat stuff to watch. (But kids--don't try this at home!) >>Charlweed Hymerfan A Major (but humble) Dude > > -dave dylan