diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-05-06 09:55:36 +0300 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2025-05-07 16:58:12 +0300 |
commit | d4b8634136355205591131be6d0df52b85f04879 (patch) | |
tree | 8bad60c7692d181380de9bb82a3320dbba5c0558 /tecterm.c | |
parent | 50f07cbee2da2a71a49d99ee2723a182cc3d86b4 (diff) | |
download | videoteco-fork-7.0.tar.gz |
DOS: detect ANSIPLUS driverv7.0
Actually, we cannot (easily) detect NANSI.SYS, so we don't enable optimizations by default.
You will have to `set TECO_TERM=nansi.sys` to enable optimizations.
Of course you can also still set the TERMCAP variable.
Diffstat (limited to 'tecterm.c')
-rw-r--r-- | tecterm.c | 42 |
1 files changed, 32 insertions, 10 deletions
@@ -1073,7 +1073,7 @@ term_flush() static int term_isvga(void) { - union REGS regs; + union REGS regs = {0}; regs.x.ax = 0x1a00; int86(VIDEO, ®s, ®s); return regs.h.al == 0x1a && regs.h.bl > 6; @@ -1082,7 +1082,7 @@ term_isvga(void) static int term_isega(void) { - union REGS regs; + union REGS regs = {0}; if(term_isvga()) return 0; regs.h.ah = 0x12; regs.h.bl = 0x10; @@ -1090,16 +1090,38 @@ term_isega(void) return regs.h.bl != 0x10; } +#if 0 /** - * Detect NANSI.SYS (4.0c or later). + * Returns true if any of ANSI.SYS, NANSI.SYS (4.0c or later) + * or ANSIPLUS (2.0 or later) are detected. */ static inline int -term_have_nansi(void) +term_have_ansi_driver(void) { - union REGS regs; + union REGS regs = {0}; regs.x.ax = 0x1a00; int86(0x2f, ®s, ®s); - return regs.h.al == 0xFF; + return regs.h.al == 0xff; +} +#endif + +/** + * Returns true if ANSIPLUS driver is installed. + */ +static inline int +term_have_ansiplus(void) +{ + union REGS regs = {0}; + regs.x.ax = 0x1a00; + regs.x.bx = ('A' << 8) | 'N'; + regs.x.cx = ('S' << 8) | 'I'; + regs.x.dx = ('+' << 8) | '+'; + int86(0x2f, ®s, ®s); + /* + * NOTE: The ANSIPLUS documentation is wrong. + * AL won't be 0. + */ + return regs.h.al == 0xff && regs.x.cx != (('S' << 8) | 'I'); } #endif /* MSDOS */ @@ -1410,8 +1432,8 @@ char *termcap = */ ":cd=\\E[2J:te=\\E[2J:" /* - * Some NANSI.SYS extensions, i.e. not supported by MS-DOS ANSI.SYS. - * They are enabled dynamically by overwriting the leading null byte. + * Some NANSI.SYS/ANSIPLUS extensions, i.e. not supported by MS-DOS ANSI.SYS. + * They may be enabled dynamically by overwriting the leading null byte. */ "\0al=\\E[1L:AL=\\E[%dL:dl=\\E[1M:DL=\\E[%dM:ic=\\E[1@:dc=\\E[1P:"; #endif /* MSDOS */ @@ -1459,8 +1481,8 @@ FILE *fd; if(cp == NULL){ cp = termcap; #ifdef MSDOS - /* enable extended NANSI.SYS definitions */ - if(term_have_nansi()) *strchr(cp, '\0') = ':'; + /* enable extended ANSIPLUS definitions */ + if(!strcmp(term_name,"nansi.sys") || term_have_ansiplus()) *strchr(cp, '\0') = ':'; #endif } dp = current_termcap_description = buffer; |