[comp.sys.cbm] printing in direct mode?

ewm@cbnews.att.com (edward.w.mcfarland) (03/14/91)

     I work with a system that uses C64s to control it. (they were the 
cheapest option when the system was manufactured) Occasionally we have
to use them in the direct mode. I have made a little sheet for users to
follow for disk formating, disk directories, and printing when not under
program control.
     For printing I am using the method that is mentioned in the C64
owners manual, ie.  OPEN4,4,4 <return>
                    CMD4:<command>  <return>
                    CLOSE4,4,4  <return>

I seem to recall a better method for printing in direct mode that someone
I know used which he derived from the C64 Programmer's Reference manual.
The above method will continue to send output to the printer for one more
return keystroke after giving the CLOSE4,4,4 command. I recall that the
other method did not do this and thus is much better for those not familiar
with the C64 "operating system."

Anyone know a better method than the above for printing in direct mode?

Thanks,
       Ed McFarland
       ewm@mvuzr.att.com

rknop@nntp-server.caltech.edu (Robert Andrew Knop) (03/14/91)

ewm@cbnews.att.com (edward.w.mcfarland) writes:
>     For printing I am using the method that is mentioned in the C64
>owners manual, ie.  OPEN4,4,4 <return>
>                    CMD4:<command>  <return>
>                    CLOSE4,4,4  <return>

You can actually slightly improve on this.  First of all, you don't need
to have the full "4,4,4" in the close statement; just CLOSE4 is fine.  Also,
I believe you can avoid the problem with one more return being printed
by using this construction:

OPEN4,4,4 <return>
CMD4:<command> <return>
PRINT#4:CLOSE4 <return>

Actually, since you've given the CMD4, you could probably get away with
"PRINT:CLOSE4".

-Rob Knop
rknop@tybalt.caltech.edu

andy@ccwf.cc.utexas.edu (Andrew Hackard) (03/14/91)

In article <1991Mar13.161420.28673@cbnews.att.com> ewm@cbnews.att.com (edward.w.mcfarland) writes:

[stuff deleted]
>     For printing I am using the method that is mentioned in the C64
>owners manual, ie.  OPEN4,4,4 <return>
>                    CMD4:<command>  <return>
>                    CLOSE4,4,4  <return>
>
[more stuff deleted]
>Anyone know a better method than the above for printing in direct mode?
>
>Thanks,
>       Ed McFarland
>       ewm@mvuzr.att.com

Looks good, except that you have to remember to close out the channel properly,
something I've only seen explained clearly a couple of times.  What this boils
down to is that you have to send a blank line after you have finished printing
your text, which somehow tells the printer you're through with it. (Also, if
you're shooting for lowercase, Commodore printers use a 7 as the last digit in
the OPEN; your interface may be different if you're using a non-CBM printer.)

Couple of examples:1)Listing a file to the printer
			OPEN 4,4,7:CMD4:LIST
			PRINT#4:CLOSE4
		   2)Printing
			OPEN 4,4,7:CMD4
			PRINT"Your message here..."
			PRINT#4:CLOSE4

Hope this helps.
--Andrew Hackard
  andy@ccwf.cc.utexas.edu

P.S. Remember, PRINT# is abbreviated pR (p SHIFT-r), not ?#.

bhelf@athena.mit.edu (Bill Helfinstine) (03/15/91)

In article <1991Mar13.201004.3965@nntp-server.caltech.edu> rknop@nntp-server.caltech.edu (Robert Andrew Knop) writes:

>I believe you can avoid the problem with one more return being printed
>by using this construction:
>
>OPEN4,4,4 <return>
>CMD4:<command> <return>
>PRINT#4:CLOSE4 <return>
>
>Actually, since you've given the CMD4, you could probably get away with
>"PRINT:CLOSE4".

Actually, you can't get away with just doing a PRINT, since the printer
could care less about that last line, it is the computer that needs it.
When you use PRINT#4, it essentially cancels the effect of the CMD4
command, and tells further PRINT statements to go to the screen, rather
than the printer.  The computer gets a little confused if it thinks it
is still printing to file number 4, when that file has already been
closed.

Therefore, if you want to keep from sending that blank line to the
printer, change that last line to:

PRINT#4,"";:CLOSE4


>
>-Rob Knop
>rknop@tybalt.caltech.edu


Bill Helfinstine
bhelf@athena.mit.edu

dattier@vpnet.chi.il.us (David W. Tamkin) (03/15/91)

rknop@nntp-server.caltech.edu (Robert Andrew Knop) wrote in
<1991Mar13.201004.3965@nntp-server.caltech.edu>:

| ewm@cbnews.att.com (edward.w.mcfarland) writes:
| >     For printing I am using the method that is mentioned in the C64
| >owners manual, ie.  OPEN4,4,4 <return>
| >                    CMD4:<command>  <return>
| >                    CLOSE4,4,4  <return>

| You can actually slightly improve on this.  First of all, you don't need
| to have the full "4,4,4" in the close statement; just CLOSE4 is fine.

True so far.

| Also, I believe you can avoid the problem with one more return being
| printed by using this construction:

Not quite.  It's not one more blank line that is necessary; it is a switch
back from PRINT (or LIST) to PRINT# so that BASIC will send an unlisten
signal down the serial bus to the output device (in this case, to the
printer).  Andrew Hackard's response made one of the same errors (knowing
that the PRINT# was needed but thinking a blank line was required also).

| OPEN4,4,4 <return>
| CMD4:<command> <return>
| PRINT#4:CLOSE4 <return>
| 
| Actually, since you've given the CMD4, you could probably get away with
| "PRINT:CLOSE4".

No, you couldn't.  BASIC won't send an unlisten signal after PRINT.  If the
device is still listening, the file cannot be closed properly.

PRINT#4:CLOSE4 will work.  If you don't want the extra blank line, you can
use PRINT#4,"";:CLOSE4 (or just PRINT#4;:CLOSE4) instead.  You don't need a
blank line (it doesn't hurt if you want it); you do need to use PRINT# at
least once between CMD and CLOSE.

There's nothing magical about the blank line.  What Edward McFarland needs is
an unlisten signal for the printer (or the printer interface).

David Tamkin  PO Box 7002  Des Plaines IL  60018-7002  dattier@vpnet.chi.il.us
GEnie:D.W.TAMKIN  CIS:73720,1570  MCIMail:426-1818  708 518 6769  312 693 0591

cs4344af@evax.arl.utexas.edu (Fuzzy Fox) (03/15/91)

In article <1991Mar13.201004.3965@nntp-server.caltech.edu> rknop@nntp-server.caltech.edu (Robert Andrew Knop) writes:
>
>OPEN4,4,4 <return>
>CMD4:<command> <return>
>PRINT#4:CLOSE4 <return>
>
>Actually, since you've given the CMD4, you could probably get away with
>"PRINT:CLOSE4".

Sorry, that's not right, that last part.  The closing of the print
channel is not cancelled by sending out a blank line (with PRINT), but
by the use of the PRINT# command itself.  Any sort of PRINT# would
cancel the effect of the CMD command.  As it is, usually there is
nothing more to be printed, so PRINT#4 by itself is used.

Now I think I'll go out on a limb and say, if you don't want there to be
a return mark after the final PRINT#4 command, just use PRINT#4,;
instead, which prints nothing at all, but does close the channel.

-- 
David DeSimone, aka "Fuzzy Fox" on some networks.          /!/!
INET:    an207@cleveland.freenet.edu                      /  ..
Q-Link:  Fuzzy Fox                                        /   --*
Quote:   "Foxes are people too!  And vice versa."         /  ---

Dave.Warren@p0.f178.n221.z1.fidonet.org (Dave Warren) (03/22/91)

If you enter print#4,chr$(12)
 
You can get yoursef a form feed
and I usually enter 2 chr$(12) 
so when I'm done and suppose I 
don't use up all the paper using 
2 jumps to the next paper plus 
forms up the next one...but 
that's good if you've got a 
mps1000 model...



--  
Dave Warren - via FidoNet node 1:221/171
UUCP    : watmath!xenitec!zswamp!178.0!Dave.Warren
Internet: Dave.Warren@p0.f178.n221.z1.fidonet.org