Does anyone know where to find a list of just which BDOS calls in CP/M 2.2 trash which registers, or should a programmer assume that all registers will be trashed by a BDOS call? I ask because I had some code that was behaving oddly around a BDOS call for the function WRTCHAR (02h) that puts a single character (passed using register E) onto the console.
I knew that my contents in register BC would be trashed, since the 02h code specifying this function is passed via register C, and that my contents in register DE would be trashed, since the character to be output is placed in register E. But I did not expect my contents in register HL to get trashed too. The code would not work until I also saved HL by PUSHing it before the BDOS call and POPping it afterwards.
Is the sensible thing to do just to PUSH everything (A, PSW, B, C, D, E, H, and L) onto the stack before a BDOS call and POP them all back again after? Seems like a pain to have to do this each time.
Regards
Gabriel