In machine-language routines to be called via USR function in MSX BASIC, values of which registers should be preserved and which registers can be used without saving their original values?
I tried Google and Perplexity AI, but they didn't work well for me.
After studying a disassembly listing of MSX 1 ROM Basic I found here, I strongly suspect your machine language routine does not need to save any registers. Just make sure not to mess up the stack and the stack pointer. Also leave registers I and R alone, unless you know exactly what you are doing.
HL must not be clobbered as it keeps track of the token stream, but you do not need to save it yourself. It is pushed before jumping to the machine language routine:
and popped immediately upon return from the machine language routine:
I also see no need to save any of the other registers: