Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
01/09/05 09:53
Read: times


 
#84597 - Self-modifying code - good or bad
Responding to: ???'s previous message
Self-modifying code is exactly what makes systematic programmers sick - it is hard to read and understand and easy to go wrong with the slightest change of anything. This is the ultimate example of unmaintainable code.
However, in certain cases it is also the key to extreme efficiency.
When writing a DES algorithm, I was lacking an indirect bit addressing mode, which would make the code much tighter (although a bit slower, but that was no problem in that application). A couple of bytes of code-executable RAM wold do - but there is none in the AT89C2051 - hence the longer code made me to switch to 4051 (higher cost -> less profit :-( ).
But, as mentioned, these are extreme situations and usually one can do better without it.
As a matter of fact, IAP (and in the case of RD2, ISP too) _is_ a self-modifying code, but not in the traditional means, and write-verification and checksums can be easily employed to maintain code integrity.

Jan Waclawek

List of 19 messages in thread
TopicAuthorDate
Use SRAM as code memory.            01/01/70 00:00      
   Yes, but            01/01/70 00:00      
      thanks for answer            01/01/70 00:00      
         ibid            01/01/70 00:00      
         There are so many options...            01/01/70 00:00      
            Answer partially wrong: Can't Write CODE            01/01/70 00:00      
               No need for switching            01/01/70 00:00      
                  Oh yes...            01/01/70 00:00      
                     Take care - wherewer your code is :-)            01/01/70 00:00      
                        Once again thanks            01/01/70 00:00      
                        Self-modifying code            01/01/70 00:00      
                           Self-modifying code - good or bad            01/01/70 00:00      
                              Self-modifying code            01/01/70 00:00      
   90:10 rule            01/01/70 00:00      
   In System Programming Application Note            01/01/70 00:00      
      In-System v. In-Application Programming            01/01/70 00:00      
         IAP v ISP            01/01/70 00:00      
            Philips IAP            01/01/70 00:00      
               It's easier with Atmel            01/01/70 00:00      

Back to Subject List