[comp.sys.ibm.pc] Help with ANSI escape sequences

rassilon@eddie.MIT.EDU (Brian Preble) (07/23/87)

I am writing a program in Turbo Pascal in which I need to read in lines of
text containing ANSI escape sequences.  I have no problem reading these,
however, WRITELN will not behave correctly.  Instead of clearing the screen,
or changing the text colors, or whatever, ESCAPE is displayed as a left
arrow.  How do I get Turbo to do the right thing?  (Do I need to send the
text in raw mode or something?)

					-- Rassilon
-- 
Rassilon (Brian Preble)
UUCP: ...{ihnp4 | decvax!genrad}!mit-eddie!rassilon
Internet: rassilon@eddie.mit.edu

ayac071@ut-ngp.UUCP (William T. Douglass) (07/23/87)

In article <6365@eddie.MIT.EDU> rassilon@eddie.MIT.EDU (Brian Preble) writes:
>I am writing a program in Turbo Pascal in which I need to read in lines of
>text containing ANSI escape sequences.  I have no problem reading these,
>however, WRITELN will not behave correctly.  Instead of clearing the screen,
>or changing the text colors, or whatever, ESCAPE is displayed as a left
>arrow.  How do I get Turbo to do the right thing?  (Do I need to send the
>text in raw mode or something?)

If you are using the PC-DOS version of TP, then write (should avoid writeln,
unless you want a CR-LF written to the screen) is being implemented through 
the bios screen handler, bypassing DOS and the ANSI.SYS driver.  I suggest
trying the {$P1} compiler directive, which appears to force TP to use the
DOS i/o calls for screen output.

I ran into this when trying to implement a ^C handler in a TP program.  Seems
that the IBM-PC version gets its input without consulting DOS, and handles
the ^C character itself.  Therefore, setting the int23h address did nothing, 
as DOS never saw the break character.  Re-compiling with the {$Gn} and {$Pn}
directives cleared this up.  Also, using the generic MS-DOS version proved
successful, but left me without all the PC-specific goodies.

Hope this is some help.

Bill Douglass
ayac071@ngp.UUCP  (or whatever)