I have yet to
see a good use for self-modifying code. Other than
subroutines and interupts placing data into a code segement the only
self modifying code I have seen was for the 8088.
Self-modifying code was somewhat common in the 6502 world. I have seen
(and written) several examples for the PET, VIC-20, C-64, and Apple II.
I was about to say that very thing. Due to the paucity of registers and the
crammed zero page in the 6502 architecture, I often wrote pointers in-line
in my programs (i.e. with absolute or absolute-indexed addressing), and
updated them directly in place rather than the classic way of indirect
indexed addressing where you have a pointer outside of the program that is
updated. In fact, this is still a habit of mine, even when it's not
strictly speaking necessary or elegant.
--
---------------------------------- personal:
http://www.armory.com/~spectre/ --
Cameron Kaiser, Floodgap Systems Ltd * So. Calif., USA * ckaiser(a)floodgap.com
-- An apple every eight hours will keep three doctors away. -------------------