Pregunta

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?

¿Fue útil?

Solución

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

Check x86 memory segmentation to understand this.

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top