ANSI detection

 BBS: Inland Empire Archive
Date: 07-27-92 (00:00)             Number: 171
From: REAL GAGNON                  Refer#: NONE
  To: MARVELL EVANS                 Recvd: NO  
Subj: ANSI detection                 Conf: (1) 80xxx

ME> How would I go about detecting if ANSI.SYS is loaded? The easiest way to detect ANSI.SYS is to set the cursor via the sequence <esc>[x;yH and then read the current cursor position and check if it's ok. I have modified your program to do that (under TASM). PS. I don't check if the cursor is already at 0,0 . ; ANSI.COM detects if ANSY.SYS is active ; compile with TASM ansi ; and then TLINK ansi /t .MODEL tiny .CODE org 100h START: jmp ansidet dsr db 1bh,'[1;1H' ; ANSI sequence HOME cursor yes db 'ANSI DETECTED!$' no db 'NO ANSI$' ansidet: mov ah,3 xor bh,bh int 10h ; get cursor position push dx ; save it ; set cursor position at 0,0 mov dx,offset dsr ;point to DSR routine mov cx,6 ;# of bytes to write mov bx,1 ;device to write to CON mov ah,40h ;write to device int int 21h ; get the cursor position mov ah,3 xor bh,bh int 10h pop bx ; pop old cursor position push dx ; save current position mov dx,bx ; restore original position mov ah,2 xor bh,bh int 10h pop dx ; retrieve old position or dx,dx ; is it 0,0 ? jne noansi ; no -> isansi: mov dx,offset yes ;ansi was detected.tell user jmp bebye noansi: mov dx,offset no ;ANSI not detected.tell user bebye: mov ah,9 ;service 9 int 21h quit: int 20h ;end the program, exit to dos END start Real from Montreal. ... OFFLINE 1.40 * 1992.C: if (QUEBEC && CANADA) yes(); else no(); --- Maximus 2.01wb * Origin: <Le Labo (514)671-7925 Mr. Laforge, step on it !> (1:167/179)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET