home *** CD-ROM | disk | FTP | other *** search
/ Old Hackers Atari User Group Newsletter / Old_Hackers_Atari_User_Group_Newsletter_OHMJ92B.atr / cprinter.txt < prev    next >
Text File  |  2023-02-26  |  12KB  |  1 lines

  1.              +*+*+*+*+*¢         YOUR OTHER COMPUTER¢          by John Picken  GCACE¢           from PSAN April 1990¢ (Reprinted  with  permission  and with¢ THANKS   by   the   OL'HACKERS  ATARI¢ U.G.Inc., Oceanside, NY¢¢ Do you neglect your other computer --¢  the  one  at  the end of the printer¢ cable? Today's low cost,  dot  matrix¢ printers   contain   at   least   one¢ microprocessor, a ROM  with  multiple¢ character  sets,  and  sufficient RAM¢ for   buffers   and   user   designed¢ characters. This makes them computers¢ --  in  fact  it  makes  them  pretty¢ powerful   text    processors.    The¢ majority  of  owners, however, rarely¢ do anything with their printers  that¢ can't  be  done  as part of some pre-¢ packaged software.¢¢ A few years ago,  you  couldn't  gain¢ much  by learning to talk directly to¢ your   printer   --   you  could  get¢ commercial or PD software to  exploit¢ nearly  all  of  its  features.   But¢ improvements  in  printer  ROM's have¢ given the latest models  capabilities¢ that  were unknown when programs such¢ as "The PrintShop" and even  some  of¢ the  most  recently   released   word¢ processors were authored. If you want¢ to access these features, there's  no¢ way  around the necessity of learning¢ how to talk to your printer.¢¢ Talking to  your  printer  is  not  a¢ terribly complex task. Unfortunately,¢ however, many printer manuals  appear¢ to  have  been  written  by  the same¢ people   who   wrote   the  "manuals"¢ packaged with the 800XL. While it  is¢ possible  to  puzzle  through   them,¢ assuming  you  have some knowledge of¢ BASIC (MicroSoft variety),  it  isn't¢ easy.  To make matters worse, I'm not¢ sure that  the  authors  of  some  of¢ these  manuals have much knowledge of¢ BASIC (ANY variety).¢¢ Assuming you want to learn to control¢ your  printer,  what can you do about¢ it?¢ First, read all/anything  you can lay¢ hands  on  concerning  printers.   My¢ printer is a Roland but I have picked¢ up tips from manuals for  both  Apple¢ and Star printers. The "Epson Printer¢ User's   Handbook",   published    by¢ Ballantine  Books  with a cover price¢ of $9.95 (US)  is  a  good  place  to¢ start,  but  it's  only  a start: the¢ Raven (and its Panasonic  equivalent,¢ the  KX-P1180)  has many features not¢ mentionned in the book  and  lacks  a¢ few that are.¢¢ Don't  forget  computer magazines. It¢ doesn't   imply  disloyalty  to  your¢ favourite  brand  to  read  magazines¢ written for other makes of  computer.¢ Regardless  of  computer  brand,  the¢ odds  are  that the printers referred¢ to can be and  are  used  with  Atari¢ systems.¢¢ There are two other important ways to¢ learn how to talk  to  your  printer.¢ The  first  is  to  ask  questions --¢  that's what user groups are for! The¢ other  method,  one  you will have to¢ use     at     some     point,     is¢ experimentation.    Flash    up   the¢ printer, sit down with  your  printer¢ manual and start trying out ideas.¢¢ Here's a few hints to get you started¢ or to stimulate more ideas.  All  are¢ based  on  my experience with various¢ Roland and Panasonic  printers.  They¢ should  work on most Epson compatible¢ units   depending   on   the  printer¢ features included.¢¢ HINT #1: Read and re-read the  manual¢ to    ensure   you   know   all   the¢ implications of each command you wish¢ to  use:  Some commands cause loss of¢ the data in the print buffer  (eg.  a¢ margin  change);  others   effect   a¢ carriage  return;  some  change  page¢ formatting settings (tabs, etc.); and¢ some may even be ignored depending on¢ previous  commands.  The  only way to¢ learn to make effective  use  of  the¢ various  commands  is to try them out¢ in   different    combinations    and¢ sequences.¢¢ HINT  #2: None of the sample programs¢ in the Roland manual work with  8-bit¢ machines -- even after you change the¢ string definitions to  Atari  format.¢ But,  if  you  OPEN  a  channel   and¢ replace  the  LPRINT's  with PRINT #,¢ the   samples   work  correctly.  The¢ lesson here is: learn enough BASIC to¢ be able to send output to the printer¢ without use of LPRINT.  Depending  on¢ the  computer  and  the  BASIC  used,¢ LPRINT   produces   results   ranging¢ anywhere from what you  want  to  the¢ totally unpredictable. From what I've¢ read,   it   appears   this  is  more¢ important with  8-bit's  than  it  is¢ with ST's and up.¢¢ HINT  #3:  Leave  your  printer's DIP¢ switches   in   the   "as    shipped"¢ condition  and  leave  the   exterior¢ switches   in   the   "Standard"   or¢ "Program" mode -- you get better  and¢ more    precise    control    through¢ software.  With 8-bit computers, this¢ advice also applies to  any  switches¢ on  the  printer  interface  (another¢ manual to read -- groan).¢¢ HINT  #4:  If  you're  using  a  word¢ processor and not getting the results¢ you   want,   check    the    program¢ documentation  to ensure it's capable¢ of doing what you're asking and  that¢ you're  asking   correctly.   (Proper¢ commands   and   a   proper   printer¢ "driver" or "CNF" file.) Then try the¢ "Print  to  disk" option. This allows¢ you  to  examine  the  actual  output¢ going to the printer using  a  sector¢ editor,  a  screen  dump of the file,¢ etc. On the 8-bit, a good way to  use¢ this  technique  is with TextPro: you¢ "print" to a disk or RAMdisk file and¢ then  load  the  new  file  back into¢ TextPro.¢¢ HINT #5: Experimenting can take a lot¢ of  paper,   especially   if   you're¢ playing  with  page formatting. Cheap¢ paper is not  necessarily  a  bargain¢ here.  Lightweight  paper   is   less¢ expensive,  but you can normally only¢ use one side. The extra  few  dollars¢ spent  on  20  lb. paper are worth it¢ when   you   consider  that  you  can¢ usually use both sides,  if  not  for¢ printing, then at least, as "scratch"¢ paper. Also, you can save  a  lot  of¢ paper  (or  a  lot  of  rewinding) by¢ ending a file with an "Off  Line"  or¢ "Remote  Deselect" command (19). This¢ causes   the    printer    to    quit¢ immediately    --   before   a   word¢ processor can issue  a  "Form  Feed".¢ You'll  then  have  to  issue  an "On¢ Line" (17)  command  or  re-boot  the¢ printer before its next use.¢¢ GRAPHICS:  Without  getting into "Bit¢ Image Graphics", it is possible, with¢ Roland and Panasonic printers, to use¢ character graphics. The Raven  allows¢ you  to  switch  between  Italic  and¢ Graphic character sets on the fly. In¢ fact, it is possible to use  both  at¢ once:  you enable the Graphic set and¢ get your graphics  by  sending  bytes¢ greater  than 127 while you can still¢ obtain   italics   using  the  ESC  4¢ sequence.   With  older  models,  you¢ might have to set  the  DIP  switches¢ and  put the printer into "IBM" mode.¢ This entails writing  a  new  printer¢ driver  for  your  word processor and¢ sacrificing the use of  italics,  but¢ the  graphics can really dress up the¢ output.¢¢ This is an area where you have to  be¢ familiar  with   documentation.   For¢ example, PaperClip will not allow you¢ to enter inverse (greater  than  127)¢ bytes,  so   how   do   you   include¢ graphics?  Simple,  the  printer  has¢ commands    to    force    the   most¢ signifigant bit (msb) either high  or¢ low and another to tell it to receive¢ all bytes as  sent.  With  PaperClip,¢ set  one of the four "user definable"¢ commands   in   the   CNF  to  enable¢ graphics and set the MSB  high.  From¢ then  on, all normal bytes will print¢ as graphics until you  use  a  second¢ "user  definable"  command to receive¢ the bytes as sent.¢¢ TEXT PROCESSING:  Ever  dump  a  text¢ file  to  the printer direct from DOS¢ or from a terminal  program?  If  you¢ did,  you  probably  weren't   overly¢ ecstatic  with  the  output:  margins¢ only  1/4"  wide, words broken at the¢ end of lines, etc. If you want better¢ results,  you  usually end up loading¢ the file into a  word  processor  and¢ formatting  it. How would you like to¢ be able to dump files directly to the¢ printer and have the results come out¢ already formatted with word wrap  and¢ proper margins on all four sides?¢¢ It's  easy  if  your printer includes¢ commands  for  perforation  skip  and¢ auto   justification.  The  following¢ program produces a  short  file  that¢ can be sent to the printer prior to a¢ dump. RUN it once and save  the  file¢ it produces. To use it, set the print¢ head at the  perforation,  then  COPY¢ PRINTER.DAT to the printer before you¢ send it a  text  file.  Your  printer¢ will output right justified text with¢ 1" margins all  around  (the  printer¢ handles  the  pagination),  with word¢ wrap,   and   in   highly   readable,¢ proportional  text. The program is in¢ Atari BASIC, but the DATA  statements¢ can  be  just as easily used with any¢ variety of BASIC, 8-bit or ST.¢¢ 10 OPEN #1,8,0,"D1:PRINTER.DAT"¢ 20 TRAP 60         Just loop 'til¢ 30 READ BYTE       out of data¢ 40 PUT #1,BYTE     error occurs¢ 50 GOTO 30¢ 60 END¢ 70 REM ---------------------------¢ 100 DATA 17,13,13,13,13¢ 110 DATA 27,64,27,77¢ 120 DATA 27,108,9,27,81,87¢ 130 DATA 27,112,1¢ 140 DATA 27,97,3¢ 150 DATA 27,67,66¢ 160 DATA 27,78,12¢ 170 DATA 27,107,0¢ 180 DATA 27,120,0¢¢ Here's the explanation for the  bytes¢ in the DATA lines:¢ 100  We  start  with  an  "On   Line"¢ command  (just  in  case)  and   four¢ carriage  returns  (if the 13's don't¢ work   with   your  8-bit  interface,¢ change them to 155's).¢ 110 Next we issue a "Reset"  just  to¢ clear  any  previous   settings   and¢ select  "Elite"  or 12 cpi. (Makes it¢ easier to calculate the  3/4"  needed¢ below).¢ 120  Now,  set left and right margins¢ at 3/4" each.  With  standard  paper,¢ this produces actual margins of 1".¢ 130  We  enable  Proportional   print¢ (this  overrides  Elite  but  doesn't¢ change the margins).¢ 140  Now  we  select  right-justified¢ output  which  ensures  word wrap and¢ microspacing. Note that this  command¢ always produces a carriage return.¢ 150  Designate  page  length  of   66¢ lines.  This  is  not done for length¢ since 66 is the default,  but  it  is¢ needed  to reset the printer's top of¢ page indicator. Reset would  also  do¢ this  but  would  cancel our previous¢ commands.¢ 160 Here we enable  a  12  line  (2")¢ skip  perforation  which produces the¢ 1" vertical margins.¢ 170 This command selects one of  four¢ NLQ  fonts.  The  final  byte in this¢ line can be 0 (default), 1, 3, or  6.¢ If your printer only has a single NLQ¢ font, just omit this line. (The  TRAP¢ technique  ensures  we  don't have to¢ count bytes).¢ 180 The final  command  selects  NLQ.¢ The last byte can be 0 for "OFF" or 1¢ to enable it.  Optionally  just  skip¢ the line.¢¢ It's  easy  to  modify  the  left and¢ right margins -- just remember  that,¢ with  standard paper, you always have¢ 1/4"  on  either  side  to  start  no¢ matter what you do.  But  what  about¢ the top and bottom margins? The trick¢ is to get the print head down to  the¢ first  line we want to print on. Then¢ RESET   THE  TOP  OF  PAGE  INDICATOR¢ BEFORE DESIGNATING A SKIP PERFORATION¢ VALUE.  The  skip value must be equal¢ to twice the vertical margins. So for¢ 2"  margins,  we'd  have  to  add six¢ carriage returns and designate a skip¢ perforation  value  of 24 lines (4").¢ It's easier than it sounds; play with¢ it.¢¢ CONCLUSION:    Since    I've    begun¢ experimenting    with   the   various¢ printer features, I've  found  I  get¢ better  output  than  I  can with any¢ word   processor.   The    techniques¢ outlined    above    can    be   most¢ effectively used with a program  such¢ as TextPro which allows you to insert¢ and edit printer commands directly in¢ the  text. This means you can't use a¢ word processor to  "Print"  since  it¢ would  confuse  the   commands   with¢ printable  characters;  instead   you¢ "Save"  to  a file and then "Copy" it¢ to   the   printer   or  even  "Save"¢ directly to the printer. I  think  if¢ you try some of the ideas here you'll¢ be   pleasantly   surprised   --  the¢ operative word is "try".¢¢            +*+*+ end +*+*+*¢