IsGraphEx function

The IsGraphEx function checks whether the character passed through the stack is a graphic character (printable except for the space). The function automatically aligns the stack to 2 bytes.

Parameters (stack): 1. Character to check.

Return value: ZF = 1 if the character is a graphic 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 IsGraphEx function to check whether a character from the stack is a graphic character.

title Author: Evgeny Sergeevich Dovgopolov

.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 character '>' onto the top of the stack
        call    IsGraphEx       ; Call the IsGraphEx('>') 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)".