Re: [cc65] Support for runtime / libs with self-modifying-code?

From: Ullrich von Bassewitz <uz1musoftware.de>
Date: 2010-01-26 11:37:12
On Tue, Jan 26, 2010 at 10:51:58AM +0100, Oliver Schmidt wrote:
> The cc65 C library in fact contains both in the shared part (i.e.
> runtime/callirq.s) and in several target specific parts (i.e.
> apple2/mcbdefault.s) SMC. I added some myself and didn't have any
> issues. Therefore I'm having a hard time understanding your concern.

The parts you're talking about are small parts that are placed in the data
segment because what they must do is almost impossible to achieve without self
modifying code. As far as I understand it, Christian talks about large
portions of self modifying code. Almost all functions from string.h could be
rewritten saving a few bytes and cycles. 

The problem with it is similar to Christians stack proposal: The new functions
would be a special case. We cannot remove the current functions, because
they're necessary if the code goes into a ROM. So this would have a high
impact on maintainability.

Besides that, debugging is more problematic than before. I once had an ugly
memory overwrite condition in Elite that happened once every 20-30 minutes of
game play. I wasn't able to track it down for months, because it happened so
rarely. At that time I was using self modifying code in the game. When I
removed the self moidying code, I was able to mark the code segment as "write
only" in VICE and found the bug on the next occurance.

So while I can understand the reasons, I'm not very happy about the
implications. 

Regards


        Uz


-- 
Ullrich von Bassewitz                                  uz@musoftware.de
----------------------------------------------------------------------
To unsubscribe from the list send mail to majordomo@musoftware.de with
the string "unsubscribe cc65" in the body(!) of the mail.
Received on Tue Jan 26 11:37:19 2010

This archive was generated by hypermail 2.1.8 : 2010-01-26 11:37:22 CET