The SetDataSegment function

The SetDataSegment function sets the data segment (DS) and the extra segment (ES) to the value corresponding to the data segment of the program. This allows the processor to access the data located in these segments correctly.

Parameters: The function takes no parameters.

Return value: The function does not return a value.

Flag state: The function does not modify the flags.

Program source code

An example program for the Intel 8086 assembler demonstrating the use of the SetDataSegment function to set the data segment.

title Author: Evgeny Sergeevich Dovgopolov

.model small
.stack 100h

data segment public
data ends

code segment public             ; Start of the code segment
    assume  ds:data, cs:code
    include Handyfar.inc        ; Include the file with functions

    main proc                   ; Start of the main procedure
        call    SetDataSegment  ; Call the SetDataSegment procedure

    main endp                   ; End of the main procedure

code ends                       ; End of the code segment
end main                        ; End of file. The main procedure is the entry point

The example code demonstrates the basic structure of a program.

Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".