CapitalizeEx function
The CapitalizeEx function converts the first character of each sentence in a string to uppercase. Sentences are separated by the characters '.', '!', '?'. It keeps the pointer on the stack and in AX. It does not align the stack.
Parameters (stack): 1. Pointer to the string.
Return value: AX: pointer to the converted string (it also remains on the stack).
Flag state: The function does not modify the flags.
Program source code
Intel 8086 assembly program example demonstrating the use of the CapitalizeEx function to capitalize sentences in a string.
title .286C .model small .stack 100h data segment public string db "Enter several sentences: \0" buffer db 255 dup(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 pushs ds:[string] ; Push the address of the string variable onto the top of the stack call WriteStringEx ; Call the WriteStringEx(string) procedure pushs ds:[buffer] ; Push the address of the buffer variable onto the top of the stack call ReadStringEx ; Call the ReadStringEx(buffer) procedure call PrintNewLine ; Call the PrintNewLine() procedure pushs ds:[buffer] ; Push the address of the buffer variable onto the top of the stack call CapitalizeEx ; Call the CapitalizeEx(buffer) procedure call WriteStringEx ; Call the WriteStringEx procedure (value from the stack) push 0 ; Push the byte value of the return code onto the top of the stack . call ExitProcessEx ; Call the ExitProcessEx(0) procedure main endp code ends end main
Hello, World of 8086 Assembler. How are you? Are you okay? Yes, thanks!
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".