cncst@unix.cis.pitt.edu (Christophe N. Christoff) (09/05/90)
I asked the question about how to empty COM1 before, and the problem I put there was too simple for a correct anwser. Now I'll tell the problem in details. I used PD program "COMM_TP4.TPU" in SIMTEL to read from COM1. if everything is okey, the program works well. But most of time, i.e., every morning I turn on the machine, the program will not work until I empty COM1 before I load the program. Once the program begins to work, another warm boot will cause no problem, but a cold boot will cause the same problem until I reempty the COM1 port. That is also the case I have to empty the port each morning since it is a cold boot, of course. I tried to find the problem and finally found out that each cold boot causes some characters left in the port. So I tried to empty it from within the program, but from that PD program, I cannot figure out how to do it. And I cannot find out one program to do it without human interruption, I mean without pressing any key. I tried every method I can think off my head, and there is no luck. By the way, one simple way to clear that is at the DOS prompt level, I typed: COPY AUTOEXEC.BAT COM1 > NUL DOS responds: Write fault error writing device COM1 Abort, Retry or Ignore I just choose Abort. This will clear COM1 for me and enable my program to run. But the question is that nobody like this ugly message and further, we have to type "A" which has nothing to do with data collection program. I tried to pipe an "A" to that COPY command, but in this case, PIPELINE command does not work!!! I learnt the pipe commands from folks around net. echo y | del subdir where subdir is a subdirectory name and it is not empty. I used echo a | copy autoexec.bat com1 DOS simply ignore all this pipeline!! Any idea why does pipeline not work? and why a cold boot place something in the COM1 port? I get rid of every resident program and the problem still exists: I use: IBM DOS v3.2 IBM AT with EGA monitor.
jrwsnsr@nmt.edu (Jonathan R. Watts) (09/05/90)
From article <34753@unix.cis.pitt.edu>, by cncst@unix.cis.pitt.edu (Christophe N. Christoff): > [...] > I used > > echo a | copy autoexec.bat com1 > > DOS simply ignore all this pipeline!! The reason DOS ignores the pipeline is because it always clears the keyboard buffer when it gives you that infamous error message...you can't type ahead. If you happen to use 4DOS, you could say keystack 0 "a" ^ copy autoexec.bat com1 but that is rather kludgy, and does you no good if you don't use 4DOS. - Jonathan Watts jrwsnsr@jupiter.nmt.edu (Internet address)
dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (09/05/90)
In article <1990Sep5.010347.26099@nmt.edu> jrwsnsr@nmt.edu (Jonathan R. Watts) writes: >From article <34753@unix.cis.pitt.edu>, by cncst@unix.cis.pitt.edu (Christophe N. Christoff): >> [...] >> I used >> >> echo a | copy autoexec.bat com1 >> >> DOS simply ignore all this pipeline!! > >The reason DOS ignores the pipeline is because it always clears the >keyboard buffer when it gives you that infamous error message...you can't >type ahead. If you happen to use 4DOS, you could say > >keystack 0 "a" ^ copy autoexec.bat com1 > >but that is rather kludgy, and does you no good if you don't use 4DOS. I think you can also make the pipe work by redirecting STDERR to STDOUT, because DOS seems to be reading the key on STDERR. I'm not sure, not having done it exactly, but when I ran a little program that redirected STDERR, then caused a critical error, it stopped dead when run alone and went merrily along when piped an "a" as above. Here's the program, in case anyone's interested in experimenting. Duncan Murdoch dmurdoch@watstat.waterloo.edu {$M 4096,0,0} uses dos; const stderr = 2; procedure force_dup(existing,second:word); var r:registers; begin r.ah := $46; r.bx := existing; r.cx := second; msdos(r); if (r.flags and fcarry) <> 0 then writeln('Error ',r.ax,' changing handle ',second); end; var stdfile : text; begin assign(stdfile,''); reset(stdfile); { Redirect STDERR } force_dup(textrec(stdfile).handle,stderr); { Cause a critical error, because there's no disk there } swapvectors; exec(getenv('comspec'),'/c dir a:'); swapvectors; end.
abcscnuk@Twg-S5.uucp (Naoto Kimura (ACM)) (09/05/90)
In article <34753@unix.cis.pitt.edu> cncst@unix.cis.pitt.edu (Christophe N. Christoff) writes: > ... (stuff about getting garbage character in COM port after cold > boot, but not warm boot) ... > I haven't tried this, but what if you read from the port directly ? This should reset the status port. Junk := port[$3f8]; (* COM1 *) Junk := port[$2f8]; (* COM2 *) Junk := port[$3e8]; (* COM3 *) Junk := port[$2e8]; (* COM4 *) //-n-\\ Naoto Kimura _____---=======---_____ (abcscnuk@csuna.csun.edu) ====____\ /.. ..\ /____==== // ---\__O__/--- \\ Enterprise... Surrender or we'll \_\ /_/ send back your *&^$% tribbles !!