Fortunately self-modifying code is rarely necessary or useful. AI seems to be the area where it's most useful (aside from viruses). Newer processors throw exceptions when memory marked "code" is modified, and memory marked "data" is executed, so it's becoming harder to write native self modifying code. Still, interpretted languages don't receive any benefit to either protection so they may still be self modifying. (Actually there is nothing to flag "code" and "data", but the processor can have fine grain memory block read, write, and execute exceptions that when handled by a good OS will yield the same effective result) I do recall one GWBASIC program that truly was self modifying - it located the area the code was stored in memory and altered itself as it was running, nevermind the aformentioned goto x, a, b, c commands (which are really nothing more than switch and select case control statements anyway) IIRC, it was a proof of concept, rather than fulfilling a useful need in the program. -Adam On 8/18/06, David VanHorn wrote: > > > > Reminds me of an old version of basic that could do self modifying code. > > Sort of. Normally Goto needs a line number (or label), but this one could > > have a variable, the contents of the variable determine the jump line. So > > "Goto X" depended on what X equaled. Scary stuff. Gosub too, so "Gosub > > X, > > A, B, C" was possible. Ha, debug that! > > > > Piffle.. > > Go to Verifone's page, and pull the docs for their TCL language. > I used to write, and debug self-modifying code written in that, by people > who weren't programmers! > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist