IsSpaceEx function
The IsSpaceEx function checks whether the character passed through the stack is whitespace (space, tab, line feed, carriage return). The function automatically aligns the stack to 2 bytes.
Parameters (stack): 1. Character to check.
Return value: ZF = 1 if the character is whitespace; ZF = 0 otherwise.
Flag state: The function affects all processor flags.
Program source code
Intel 8086 assembly program example demonstrating the use of the IsSpaceEx function to check whether a character from the stack is whitespace.
title .286C .model small .stack 100h data segment public msg_true db "TRUE\0" msg_false db "FALSE\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 ' ' ; Push the space character onto the top of the stack call IsSpaceEx ; Call the IsSpaceEx(' ') procedure jne @False ; If ZF=0, jump to the label @False @True: pushs ds:[msg_true] ; Push the address of the msg_true variable onto the top of the stack jmp @Done ; Jump unconditionally to the label @Done @False: pushs ds:[msg_false] ; Push the address of the msg_false variable onto the top of the stack @Done: call WriteStringEx ; Call the WriteStringEx(value from the stack) procedure 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
TRUE
Example taken from the textbook "HANDYFAR - MASM (Evgeny Sergeevich Dovgopolov)".