Why doesn't MS-DOS initialize the DS and ES registers?

六眼飞鱼酱① 提交于 2019-11-29 06:52:15

Because CS and SS registers are essential for program execution in contrast to DS and ES registers which point to user-defined data segments. By default no data is present in the executing program this nothing to initialize the DS and ES with. As a program writer you can specify where your data is by setting the data segments registers.

Edit: as was correctly noted by @FrankKotler, in .com file (the entire program size doesn't exceed single segment), DS and ES are initialized and equal to CS. For other execution models, DS and ES are initialized by pointer to PSP (which isn't the pointer to real user data).

The correct answer to your question (which i believe master V.Aghazarian has asked you in college) is not because CS ans SS are essential for program execution.

The problem in MS-DOS was with Program Segment Prefix

From wikipedia:

The segment address of the PSP is passed in the DS register when the program is executed. It can also be determined later by using Int 21h function 51h or Int 21h function 62h. Either function will return the PSP address in register BX.1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!