4

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.

2
  • 4
    I wouldn’t expect any guaranteed zero values. After all, if the loaded program wants a zero in a register, the xor instruction is just two bytes. Commented Jan 11, 2023 at 17:17
  • What an obscure question!!
    – RonJohn
    Commented Jan 12, 2023 at 17:42

1 Answer 1

9

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).

3
  • I can confirm that OS/2 1.0 running in a virtual machine has SI initialized to 0.
    – pts
    Commented Jan 11, 2023 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.) Commented Jan 11, 2023 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. Commented Jan 11, 2023 at 19:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .