@neauoire My first exposure to self modifying code was the CHRGET routine which is part of C64 BASIC, but located in zero-page RAM since the 16bit next character pointer (TXTPTR) is the operand of an LDA instruction in the middle of this routine.

c64-wiki.com/wiki/115-138