Search code examples
ansidosboxquickbasic

Detect ANSI in QB45 in DOSBOX


I have been using DOSbox and ANSI with some success, but I want to detect ANSI installed.

Ralf Brown description for detecting ANSI is:

--------V-2F1A00-----------------------------
INT 2F - DOS 4.0+ ANSI.SYS - INSTALLATION CHECK
    AX = 1A00h
Return: AL = FFh if installed
Notes:  AVATAR.SYS also responds to this call
   documented for DOS 5+, but undocumented for DOS 4.x

And my code to detect ANSI is:

' detect ansi
InregsX.AX = &H1A00
CALL InterruptX(&H2F, InregsX, OutregsX)
PRINT "AX="; HEX$(OutregsX.AX)
IF (OutregsX.AX AND &HFF) = &HFF THEN
   Ansi.Installed = -1
ELSE
   Ansi.Installed = 0
END IF
IF Ansi.Installed THEN
   PRINT "Ansi installed."
ELSE
   PRINT "Ansi not installed."
END IF

which always displays "Ansi not installed." is there some other way to detect ANSI??


Solution

  • I wrote this code to detect ANSI:

    Cls
    Const A$ = "alpha"
    Const B$ = "beta"
    Open "CONS:" For Output As #1
    Print #1, A$
    Z$ = Chr$(27) + "[2J" ' ansi cls
    Print #1, Z$; B$;
    Close #1
    For T = 1 To Len(B$)
       T$ = T$ + Chr$(Screen(1, T))
    Next
    If T$ = B$ Then Print "ANSI detected."