Yes, this will be needed - in some form - for the CP/M 3 BIOS. We could just eliminate the serial interrupts and these routines for the loader.
The problem is that the byte used in the CP instruction is *relocatable* - meaning that it's value will change depending on where the starting address of LDRBIOS lands at LINK time. If it were a constant, it would not cause a problem. I seem to recall this same problem from "the old days" - REL file format did not support 8-bit relocatable items. It would be interesting to see how support was added, but if any of the DRI tools are involved (i.e. LINK.COM) then we need to avoid this sort of expression.
There is also a linker program mentioned in the ZMAC docs, I'll see if that could be used. You'll still have to do the final stage of the CP/M 3 build in CP/M, unless you are going to write your own GENCPM program.
A couple ways to avoid the 8-bit relocatable objects by changing the code:
Code:
bufAend DW serABuf+SER_BUFSIZE
...
LD A,(bufAend)
CP L
JR NZ,...
or...detect the end of the buffer without using the address (i.e. use an index value for the current position, which is a constant ranging 0 thru SER_BUFSIZE-1, instead of using a pointer). Using an index might not be any less efficient, and might actually be faster (you only have to manipulate 16-bit values at the end, when you access the character, so most instructions are working on bytes - and if you make SER_BUFSIZE a power of 2 then the math becomes even simpler).
or...align serABuf (and serBBuf) on a 256-byte boundary so that the (8-bit) end address is a constant. Although, that is tricky in a relocatable file since the starting address may not be aligned on 256-byte pages.