Self-modifying code: Difference between revisions

Content deleted Content added
No edit summary
Minor spelling etc
Line 1:
In [[computer programming]], '''self-modifying code''' is code that modifies itself. This is straightforward to write when using [[assembly language]] and is also supported by some high level language interpreters such as [[SNOBOL4]]. It is more difficult to implement on compilers but compilers such as [[Clipper programming language|Clipper]] and [[Spitbol]] make a fair attempt at it. Batch programming scripts often involve self modifying code as well. Use of self-modifying code is not recommended where alternatives exist. This is because such code can be difficult to understand and maintain.
 
Self -modifying code was used in the early days of computers in order to save memory space in computers with very small main memory sizes.
 
Self -modifying code was used to hide copy protection instructions in 1980s MS DosDOS based games. The floppy disk drive access instruction 'int 0x13' would not appear in the executable program's image but it would be written into the executable's memory image after the program startsstarted executing.
 
example algorithm (theoretictheoretical!)
Start: