For the purpose of testing I just had it go into an endless loop in the subroutine.
I've just added one in after "GOTO $" to rule that out but it's still resetting.