Well, not having comments to understand what you are doing is pretty tough when you don't have the time to analyze the code line by line. But IIRC, the common way to check for the presence of an ANSI device driver was to check via an INT 2Fh (multiplexer) call (don't recall the exact call value (AX/AH)).

Will take a closer look at this later this evening when I am back, I am heading out to this year's SCaLE conference... ;-)

Ralf

On 7/29/2022 2:14 AM, Jerome Shidel wrote:
Hi All,

While recently performing a re-install of everything (System Commander Multiple DOS, Windows, Linux booting) on my Pentium Pro, I discovered a minor compatibility issue regarding ANSI.SYS support. Without digging into it more, I cannot say if the issue is NANSI.SYS or elsewhere in FreeDOS.

Basically, one of the versions of my ancient (written back in the early 90’s) Turbo Pascal directory listing programs used ANSI escape sequences to provide color. Instead of blindly assuming ANSI support is present, it first probes DOS to verify the functionality. It performs the probe through standard DOS I/O function calls and works on other DOS platforms (such as MS-DOS, PC-DOS and DR-DOS). However, the test fails under FreeDOS.

  function DetectAnsi : boolean; assembler;
    asm
      MOV  DI, OFFSET @AnsiTestStr
    @2:
      MOV  DL, CS:[DI]
      INC  DI
      CMP  DL, 0
      JE   @3
      MOV  AH, $02
      INT  $21
      JMP  @2
    @3:
      MOV  AH, $06
      MOV  DL, $FF
      INT  $21
      JZ   @5
      CMP  AL, 27
      JNE  @5
      MOV  AH, $06
      MOV  DL, $FF
      INT  $21
      JZ   @5
      CMP  AL, '['
      JNE  @5
    @4:
      MOV  AH, $06
      MOV  DL, $FF
      INT  $21
      JZ   @5
      CMP  AL,'R'
      JNE  @4
    @5:
      MOV  AH, $06
      MOV  DL, $FF
      INT  $21
      JZ   @6
      CMP  AL,13
      JNE  @5
      MOV  AL, True
      JMP  @Done
    @6: { Not Found }
      MOV  DI, OFFSET @AnsiTestStr
    @7:
      MOV  DL, CS:[DI]
      INC  DI
      CMP  DL, 0
      JE   @8
      MOV  AH, $02
      MOV  DL, 8
      INT  $21
      MOV  AH, $02
      MOV  DL, 32
      INT  $21
      MOV  AH, $02
      MOV  DL, 8
      INT  $21
      JMP  @7
    @8:
      MOV  AL, False
      JMP  @Done
@AnsiTestStr:
      DB 27,'[6n',0
    @Done:
      MOV  AnsiFound, AL
    end;

/Sorry, I was never one for doing a lot of code comments. And yes, it is far from efficient, elegant or pretty. But, the snippet of code is roughly 30 years old./
/
/
:-)

As you can see, it sends an escape sequence to request information. If it receives the data, the test passes. Otherwise, it cleans up the displayed garbage and moves along without ANSI support.

I wouldn’t call it a serious compatibility issue. Even this ancient directory lister provides support to bypass the probe and force ANSI support OFF or ON.
dir l:

Interestingly, this same program reveals a couple other cross DOS compatibility issues as well. For example, under MSDOS using MSCDEX + OAKCDROM driver, the CD can be listed. It also likes NWCDEX + OAKCDROM under DR-DOS. However, not under FreeDOS using our supplied drivers (invalid drive reported) and crashes (divide by zero) when accessing the CD under PC-DOS with IBMIDECD + MSCDEX.

Anyhow, the program source is available on GitHub under https://github.com/shidel/DustyTP7/tree/master/D and a precompiled binary at https://github.com/shidel/DustyTP7/blob/master/bin/D.EXE

:-)

Jerome







_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

_______________________________________________
Freedos-devel mailing list
Freedos-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/freedos-devel

Reply via email to