SetCursorPositionEx function

The SetCursorPositionEx function sets the cursor position on the screen. The coordinates (column, row) are passed through the stack. The function automatically aligns the stack to 4 bytes.

Parameters (stack): 1. Column number. 2. Row number.

Return value: The function does not return a value.

Flag state: The function does not modify the flags.

Program source code

Intel 8086 assembly program example demonstrating the use of the SetCursorPositionEx function to set the cursor position. The coordinates are passed through the stack.

title Author: Evgeny Sergeevich Dovgopolov

.286C
.model small
.stack 100h

data segment public
    string db "Hello, assembly language\0"
data ends

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

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

        push    8                    ; 2nd: Push 8 onto the stack
        push    2                    ; 1st: Push 2 onto the stack
        call    SetCursorPositionEx  ; Call procedure SetCursorPositionEx(2, 8)

        pushs   ds:[string]          ; Push the address of variable string onto the stack
        call    WriteStringEx        ; Call procedure WriteStringEx(string)

        push    0                    ; Push the byte return code onto the top of the stack
        call    ExitProcessEx        ; Call the ExitProcessEx(0) procedure
    main endp

code ends
end main

(The cursor moves to row 3, column 9 before the string is output)

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