When reading assembler sources, self modifying code is often hard to identify and applying it needs a lot of discipline.
Since the cacheless 6502 is a thankful target of such kind of code, the macro package will not only reduce this complexness, but also document the use. The resulting source is more self-explanatory and so easier to maintain.
While for general purposes SMC is not a desired form for implementations, it can be quite useful for a small range of scenarios. Normally SMC will be introduced when optimizing code in respect to:
Please mind that SMC can only be applied for code in RAM, which means that a general purpose library with SMC excludes ROM targets!
The ca65 SMC macro package consists of two files:
The latter is only needed if you also plan to modify opcodes and not only data within your code.