26-Jan-85 11:32:13,3388;000000000005 Return-Path: Received: from AMSAA by DEC-MARLBORO.ARPA with TCP; Sat 26 Jan 85 11:32:03-EST Received: From xerox.arpa.ARPA by AMSAA via smtp; 26 Jan 85 11:15 EST Received: from Aurora.ms by ArpaGateway.ms ; 26 JAN 85 07:25:54 PST From: SMERESKI.WBST@XEROX.ARPA Date: 26 Jan 85 10:23:11 EST Subject: Re: Turbo Pascal output To: info-cpm@AMSAA.ARPA, Pascal/Turbo^.X@XEROX.ARPA, db21%ihuxk.uucp@BRL-TGR.ARPA Re: ---------------------------------------------------------- >> Subject: Turbo Pascal output >> >> Is there a method that enables program output to be sent >> to the screen and printer??? Cntrl-P works when running >> CPM, but from Turbo Pascal, it doesn't. (at least not on >> my machine.) Do I make the pr^ram a .COM file and use Cntrl-P?? >> Thanks in advance for any help Oiven. >> Mark Faleroni >> TRW >> Ogden,Ut. >> (mdf) >> > In order to print output to both the screen and the line >printer in Turbo Pascal under CP/M you must include a second >writeln statement which directs its output to the Lst device. >For example, to print the string 'Hello There!' on both the >screen and printer, you would include the following lines in >your program: > > writeln ('Hello There!'); { print on screen } > writeln (Lst,'Hello There!'); { print on printer } > > This is discussed beginning in section 14.5, Text Files, >of my Turbo manual. There is a program with examples in >section 14.5.1, and a description of the logical devices given >in section 14.5.2. > > Dave Beyerl > ihuxk!db21 > AT&T Bell Labs, Naperville, IL > ---------------------------------------------------------------- Because of the good documentation and careful construction of Turbo-Pascal it is possible to make it do almost anything you wish. For instance if you really want to echo all console output to the printer the following program will do it. The information needed to set it up can be found in the Turbo Pascal manual in section A.12 for CPM systems and B2.3 for 8086 based systems. Program ControlpTest; Var Ch : Char; SaveAddress : Integer; Procedure PWrite (Ch : Char); Var CB : Byte Absolute Ch; Begin {PWrite} Bios (4, CB); Bios (3, CB); End; {PWrite} Begin {ControlpTest} SaveAddress := ConOutPtr; {Save address of default routine} ConOutPtr := Addr (PWrite); {turn on printer echo} Read (Kbd, Ch); While Ch <> ^Z Do {test the echo until control-Z} Begin Write (Ch); Read (Kbd, Ch); End; ConOutPtr := SaveAddress; {turn off printer echo} End. If you really want to simulate control-P in all its glory then simply patch into the console input routine in a similar fashion (ConInPtr := address of your own Procedure). Your procedure can then scan all console input for a control-P and turn the echo on or off as shown above. I hope this technique is useful to some of you. /Dave