Mixing C with Assembler: Assembly code before push instructions in a function

GreyGnome:

Register r0 may be freely used by your assembler code and need not be restored at the end of your code. It's a good idea to use tmp_reg and zero_reg instead of r0 or r1, just in case a new compiler version changes the register usage definitions.

So I believe I can safely use r0. All I need is to use the in instruction, then save that register to RAM, and I should be good to go.

No, you are in an ISR. The main code might be using r0 temporarily when your ISR gets called - if you touch r0, you mess up the main code.

I once tried doing a similar thing with r1, thinking that because it should always be 0 I could quickly use it in an ISR and zero it again afterward - and it didn't work either. Turns out the zero register wasn't always zero!