While homing cycle is in process, it is possible to interrupt it programmatically in the middle of the process?
I’m not exactly sure what you mean by programatically, you want to code this behavior?
If ! does not stop a homing cycle, then all I can suggest is to hit the tinyG reset button.
A [ctrl+x] from the command line (a command line reset) might work too, never tried.
That will stop all current motion, and will result in a new (0,0,0) location wherever the machine is when you do it.