WriteStringExD function
The WriteStringExD function prints a string with color highlighting of fragments through the ${} specifier. It returns the number of printed characters in AX. The function automatically aligns the stack to 6 bytes.
Parameters (stack): 1. Pointer to the string. 2. Background color. 3. Text color.
Return value: AX: the number of characters actually printed.
Flag state: The function affects all flags.
Program source code
Intel 8086 assembly program example demonstrating the use of the WriteStringExD function to print a string with color highlighting of fragments through ${}.
title .286C .model small .stack 100h data segment public string db "My ${na}me is ${Evgeny} ${Dov}gopolov!\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 call SetDataSegment ; Call the SetDataSegment procedure push BLACK ; Push the text color value onto the stack push CYAN ; Push the background color value onto the stack pushs ds:[string] ; Push the address of variable string onto the stack call WriteStringExD ; Call procedure WriteStringExD(string, CYAN, BLACK) 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
My name is Evgeny Dovgopolov!
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".