문제

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?

도움이 되었습니까?

해결책

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

Check x86 memory segmentation to understand this.

다른 팁

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top