Most of these are taken from https://cc65.github.io/doc/customizing.html, but modified to suit this setup.
Was missing some things like initializing the stack pointer, clearing BSS, and things like that