[net.micro.amiga] problem with escape codes to the printer

john13@garfield.UUCP (06/09/86)

<guru meditation #00000004.00000000 : is this the lowest of all time?>

the cast: an amiga 1000 and a panasonic kx-p1080 printer.

the victim: an amiga owner (not me, someone i know) who is *not* a computer
            science student/graduate. a guy who just wanted to print some
            escape sequences, until his luck ran out.

the culprit: ???

sorry if this question has come up before, but i don't remember seeing it and
it does seem like the sort of thing new owners should know about.

this fellow (let's call him, oh, chris) has been unable to get escape chars
or sequences out to his printer from amiga basic. using both lprint and
print # he can get any character (eg 15, for compressed) *but* chr$(27) to
be recognized. in fact, an esc sent out is not only ignored, but the character
after it is also gobbled.

when he came to me with his problem, and i verified its existence, i suggested
printing sample escape sequences and text to a disk file, then using cli to
print it, just to see whether or not something deep in the amiga was stripping
the characters, or if amiga basic did not like esc's. the problem didn't go
away, but it occurred to me that the esc's might not have been making it to
the disk file.

any ideas, fixesthe Basic's so far are batting 1000: Abasic's little
demo program for printing didn't work properly either.

P.S. this occurred with 2 amigas, 2 printers, and 2 cables. notepad, etc were
sending out their graphics commands without difficulty (although notepad would
always print a solid line before a graphics output). we tried epson, mps-1000
and generic printer files without success.

John Russell

Disclaimer: any opinions contained herein are my own, not those of any
            company or university. (OK, guys, you can relax now.)

mark@ncsu.UUCP (Mark Lanzo) (06/14/86)

For that matter, I did not seem to have any success printing escape codes to 
screen either when using BASIC.  Attempts to print the escape character just
put a little square symbol up.  Apparently the writers of AmigaBasic didn't 
seem fit to support the standard console device driver (?).
I believe certain other control characters also printed the box symbol.
Oddly enough, some things were allowed through though.  A ctrl-L caused a 
clear screen, for instance.  

I admit that I haven't used the BASIC much though (I was just playing with
it at the time...I usually do my hacking in C), so maybe I just didn't know
what I was doing.  Still, I should think "PRINT CHR$(27)" should have given
me an escape char, not a box.

Any suggestions?  (polite ones please :-)

carolyn@cbmvax.cbm.UUCP (Carolyn Scheppner) (06/16/86)

In article <3088@ncsu.UUCP> mark@ncsu.UUCP (Mark Lanzo) writes:
>
>For that matter, I did not seem to have any success printing escape codes to 
>screen either when using BASIC.  Attempts to print the escape character just
>put a little square symbol up.  Apparently the writers of AmigaBasic didn't 
>seem fit to support the standard console device driver (?).
>I believe certain other control characters also printed the box symbol.
>Oddly enough, some things were allowed through though.  A ctrl-L caused a 
>clear screen, for instance.  
>
>Any suggestions?  (polite ones please :-)

   I'm always polite.  Well ... almost always.

   You're right.  Basic eats most console ESC sequences and instead gives
you the little box.  

   But you CAN send the standard ISO escape sequences to the printer from
AmigaBasic.  (See RKM Vol. 2  printer.doc  for ISO sequences)
Basic's printer device (LPT1: which is used by LPRINT) is flakey.
It tends to munch on initial escape sequences.  If you must use LPRINT,
you can often get the ESC sequences thru by printing something (like a space)
prior to the sequence.

   But there's a better way.  Open a PRT: file and PRINT# to it.
This example prints "hello" in NLQ mode and then in normal mode.
(Note:  DEN2 (NLQ on) = ESC[2"z    DEN1 (NLQ off) = ESC[1"z )

-------------------------------------------------------------------------

OPEN "prt:" FOR OUTPUT AS #4

esc$ = CHR$(27)+"["
den2$ = esc$+"2"+chr$(34)+"z"
den1$ = esc$+"1"+chr$(34)+"z"
test$ = "hello"

PRINT#4, den2$;test$
PRINT#4, den1$;test$

CLOSE 4

-------------------------------------------------------------------------

-- 
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Carolyn Scheppner -- CBM   >>Amiga Technical Support<<
                     UUCP  ...{allegra,caip,ihnp4,seismo}!cbmvax!carolyn 
                     PHONE 215-431-9180
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=