Question

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?

Was it helpful?

Solution

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

Check x86 memory segmentation to understand this.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top