The WriteString function
The WriteString function outputs a null-terminated string (\0) to the screen. It supports escape sequences such as \t, \b, \r, \n, \0.
Parameters: AX: Pointer to the string.
Return value: The function does not return a value.
Flag state: The function does not modify the flags.
Program source code (Example 1)
An example program for the Intel 8086 assembler demonstrating the use of the WriteString function to output a string to the screen.
title .model small .stack 100h data segment public string db "Hello, Assembler World!", 0 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 lea ax, ds:[string] ; Load the address of the variable string into the ds:ax register call WriteString ; Call the WriteString procedure (ax:string) xor al, al ; Clear the al register call ExitProcess ; Call the ExitProcess 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
Hello, Assembler World!
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".
Program source code (Example 2)
An example program for the Intel 8086 assembler demonstrating the use of the WriteString function to output a string with control characters to the screen.
title .model small .stack 100h data segment public string db "Hello,\nAssembler World!\0" 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 lea ax, ds:[string] ; Load the address of the variable string into the ds:ax register call WriteString ; Call the WriteString procedure xor al, al ; Clear the al register call ExitProcess ; Call the ExitProcess 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
Hello,
Assembler World!
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".