MS_DOS preserved all registers, thus DR-DOS can not have preserved more.
It sounds much like memory blurred by time.
Was this true,
Seems hard to believe. Hard to answer as well, as no further data about what versions of DOS (and DR-DOS) this is about. Different versions may have behaved quite differently.
But while early MS-DOS was quite minimalist, it did save all registers. Easy to spot when looking at the MS-DOS 2.0 function scheduler (*1), located in the file MSCODE.ASM:
- After entering via entry point
COMMAND (line 96)
- a check for max function number (
MAXCOM) is done (line 105)
- if below, label
SAVREGS (line 123) is jumped to
- which as very first action calls a procedure named
save_world (line 124)
save_world (line 237) which stores all registers as
- ES, DS ,BP, DI, SI, DX, CX, BX, AX
The subroutine is used for all other entry points, like CALL CS:5 or some of the other ints. Some use their own method (*2)
and what would have been any advantage of doing this?
Doing what? Saving all registers?
I have a hard time to come up with any reasoning why it should not preserve everything. At least for any system past trivial, which a DOS certainly is.
- It's the very foundation of multitasking (*3)
- It minimizes OS use of user side resources (*4)
- It simplifies function design by having all input registers in a defined structure (*5)
- The same structure can be used for output/return values (*6)
*1 - I selected MS-DOS 2.0 here, as it (or even 3.x) would have been contemporary to the mentioned DR DOS Plus 1.2 mentioned in a comment. MS-DOS 1.25 did work exactly the same, at least as far as it's about register saving. See MSDOS.ASM line 228 after the
*2 - INT 25h, Direct Disk Read, for example splits this in two parts. The entry point is at ABSDRD (MSDOS.ASM line 508), short after followed by saving all segment registers and then calling DSKREAD, located in DISK.ASM at line 623. This function uses DI, CX and AX as return value, all other registers are preserved. This is different from DOS 1.25 where all registers are saved and restored (except for AX which is modified as return code).
*3 - Which DOS 2.0 was prepared for, see comment at line 140/141
*4 - When for example doing a loop around WriteChar (21h/02h), it's quite handy if the OS would not destroy a string pointer in DI or a character count in CX, wouldn't it?
*5 - After pushing them to the user stack, SS:SP can be saved as a pointer to this structure. Even better, doing so is close to being the most performant way to do so.
*6 - DOS functions can write whatever they return to this structure without any need to care about how it finally gets returned, avoiding complicated register juggling.