IsCntrlEx function
The IsCntrlEx function checks whether the character passed through the stack is a control character (00h-1Fh, 7Fh). The function automatically aligns the stack to 2 bytes.
Parameters (stack): 1. Character to check.
Return value: ZF = 1 if the character is a control character; ZF = 0 otherwise.
Flag state: The function affects all processor flags.
Program source code
Intel 8086 assembly program example demonstrating the use of the IsCntrlEx function to check whether a character from the stack is a control character.
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 9h ; Push the tab character onto the top of the stack call IsCntrlEx ; Call the IsCntrlEx(9h) 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)".