On Sat, Feb 05, 2011 at 01:09:40AM +0100, silverdr@wfmh.org.pl wrote: > If my two pennies are of any value then I find > > > 2. Accept replacement functions using smc, but let them have different > > names, so a programmer must explicitly call the smc version. > > most appealing. Reasons for that: In the current situation, I do also see this as the most appealing approach: - There's a well defined place for contributions, so work is not lost. - Programmers must explicitly choose to use self modifying code, which is hopefully like signing "I know what I do and I promise to be careful". - It is open for future changes, which means we can easily change to option 3 or 4 later, because the code is already there and tested. - It does not interfere with inlining by the compiler, since the names of the functions are different. - Using one define and a few macros (probably in one additional header file) it is possible for a programmer to switch between smc and non smc versions. This allows easier debugging in case of problems[1]. - And it is not too much work for me :-) So how about an include file smc.h and a function prefix of smc_, which would mean functions are named smc_memset() and similar? Platform specific functions should still go into the platform header files, even if they use self modifying code. Usage of smc in platform specific functions should be documented in the function reference. Does that sound ok? I'm not sure about the segment question, Oliver brought up. When choosing option 2, where a programmer must explitly include and call smc functions, I would even find it acceptable to place these functions in the CODE segment. But that doesn't cover target specific functions with smc. We can also use another segment like SMCCODE, but the segment list in the config files is already quite large and it's difficult for a newcomer to understand the purpose of all the segments. Regards Uz [1] I had quite some functions using self modifying code in Elite 128, but removed most of them, because they were ugly to debug. I had a memory overwrite somewhere that freezed the machine sometimes after about 15 minutes of playing and could not find it. VICE is able to break if a write inside a certain address range occurs, but if your whole code is full of writes to itself, the function is of almost no help. -- 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 Sat Feb 5 12:18:38 2011
This archive was generated by hypermail 2.1.8 : 2011-02-05 12:18:41 CET