Self Modifing Code was RE: Harvard vs. vonNeuman

From: Dave Dunfield <>
Date: Tue Sep 28 13:36:40 2004

I used to use a lot more self-modifying code in my early days then I do now,
you could save precious bytes of memory by storing data values into the
immediate operand of instuctions which used them --- I recall a "turning point"
when one day I spent a fair bit of time debugging a problem which was related
to two level deep self-modifying code - ie: Modified an instruction so that
it would subsequently modify another instruction differently - I started to
believe some of the nay-sayers about the evils of SM code after that :-)

Case where I've *HAD* to use SM code: 8080 general purpose monitor - no way
to read/write arbitrary I/O ports - have implemented it both as directly SM
code in RAM based monitor, and as a "built" subroutine in RAM for ROM based
monitor. Same for 8051 (except you have to overlay CODE and DATA address
spaces obviously - this is fairly normal for a debugging environment).

dave04a (at)    Dave Dunfield
dunfield (dot)  Firmware development services & tools:
com             Vintage computing equipment collector.
Received on Tue Sep 28 2004 - 13:36:40 BST

This archive was generated by hypermail 2.3.0 : Fri Oct 10 2014 - 23:37:32 BST