Domanda

Why do we copy CS into DS in 8086?

Copy CS into DS:

    MOV AX,CS;
    MOV DS,AX;

Why do we need to do that?

È stato utile?

Soluzione

Short answer is: to avoid using cs: prefix when we accessing code memory as data memory.

Check x86 memory segmentation to understand this.

Altri suggerimenti

This is normally done in "tiny" model, which in DOS is a .COM program (the program starts at offset hex 100). Both code and data share the same segment space, although the code may change this later. For other models ("small", "medium", "large"), which in DOS is a .EXE program, there are separate segments, so DS is loaded with a value that corresponds to the data segment of a program.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top