本文介绍了为什么不MS-DOS初始化DS和ES寄存器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 DS的初始化 ES 寄存器已手动由程序员完成?

Why does the initialization of the DS and ES registers has to be done manually by the programmer?

例如:

MOV AX,DTSEG

MOV DS,AX

MOV DS,AX

在另一方面,在 CS SS 寄存器由操作系统初始化(在 MS-DOS )。为什么会这样?

On the other hand, the CS and SS registers are initialized by the operating system (in MS-DOS). Why is this so?

推荐答案

由于 CS SS 寄存器是必不可少的在对比程序执行 DS ES 寄存器这点用户定义的数据段。默认情况下没有数据是在执行程序present这个没什么初始化 DS ES 用。作为一个作家的程序你可以指定你的数据是通过设置数据段寄存器。

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.

修改:如正确按@FrankKotler,指出 .COM 文件(整个程序大小不超过单段), DS ES 被初始化,等于 CS 。对于其他的执行模型, DS ES 通过指针被初始化为 PSP (这不是指针实际用户数据)。

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

这篇关于为什么不MS-DOS初始化DS和ES寄存器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-17 16:11