What are the initial contents of CPU registers at OS/2 1.x program startup? I know that CS, IP, DS, SS and SP are initialized based on the NE header. But what about the other registers? Are they documented to have an initial value? I'm especially interested in guaranteed 0 values.
1 Answer
My OS/2 manuals are currently in storage, but based on 2ine:
- AX points to the environment segment,
- BX gives the command-line offset,
- CX gives the size of the auto data segment,
- ES, DX, SI, DI, and BP are zero.
RBIL mentions that ES and BP are zero on startup for new executables (the format of 16-bit OS/2 binaries, as used on OS/2 1.x).
-
I can confirm that OS/2 1.0 running in a virtual machine has SI initialized to 0.– ptsJan 11 at 17:50
-
3@pts Doesn’t mean it’s guaranteed. You may have checked it to be zero, but that may be just because of your particular circumstances (compare the initial value of AX for DOS executables <fd.lod.bz/rbil/interrup/dos_kernel/214b.html>; most of the time it’s zero, but it can legitimately be −1 instead). It may even be always zero in practice, but reserved for future uses, making it still imprudent to rely on. (Though given that OS/2 1.x has no future to speak of, that is a rather pedantic point here.) Jan 11 at 18:55
-
2@user3840170 that reference mentions that ES and BP are 0 for NEs, but doesn’t say anything about DX, SI and DI; that’s why I wanted to check OS/2 manuals. The MS-DOS Encyclopedia explicitly states that, on MS-DOS, registers other than those explicitly defined contain undefined values. Jan 11 at 19:35
xor
instruction is just two bytes.