










                                    MACQMS

                           A Macintosh To QMS Bitmap
                              Conversion Facility


















                               By: Eric Lavitsky
                               26 December 1984
                 Center For Computer and Information Services
                              Rutgers University
                            Piscataway, New Jersey
Introduction                                                             Page 1


1. Introduction

1.1. Overview

The  Program  is  written  in  Rutgers  Pascal  and  was  inspired and based on
MACIMP.PAS from Ed Pattermann at Stanford  and  MACQMS.C  by  Van  Jacobsen  at
Lawrence  Berkely Laboratory. The latter version would not work at our site, so
I set out to write one in Pascal which  could  also  be  transported  to  other
sites/Pascals.

After a general understanding of the MacPaint and QUIC formats is accquired, it
would be a fairly trivial project to insert Macintosh pictures  into  your  own
documents  for printing on the QMS. The Macintosh image could also be converted
for output on various other devices. The appendices at the end of this document
may  give  you some insights. I would also recommend looking through the source
code to see  how  the  conversion  is  done.  If  these  don't  provide  enough
information,  I  have  found  the  QMS  programmers' manual to be an invaluable
resource in my efforts.

My thanks to Charles Mcgrew for his undying enthusiasm and contributions.

1.2. System Requirements

What you will need:

   - Macintosh computer with or without external disk drive
   - MacTerminal V1.1 or MacKermit
   - Modem or hardwired line to the DEC-20
   - The MODEM or Kermit program on the DEC-20
   - A Mac disk with MacPaint images on it (MacPaint is not needed)
Transferring files to the host computer                                  Page 2


2. Transferring files to the host computer

2.1. Modem and MacTerminal 1.1

2.1.1. Macintosh Settings

Boot up Macterminal V1.1 on a Macintosh that is  connected  by  a  modem  or  a
hardwired line to the DEC-20.

Make sure the following settings exist on MacTerminal:

            Terminal:

                    VT100
                    ANSI

            Compatibility:

                    Baud Rate: set to your line or modem speed
                    Parity: None
                    Bits Per Character: 8
                    Connection: Modem
                    Handshaking: Xon/Xoff
                    Connection Port: Set to where your modem/line is connected

            File-Transfer:

                    XMODEM

                Delays shouldn't be needed. If you think you are retransmitting
                a  lot  of  packets  because  of  noisy lines try fudging these
                yourself.

2.1.2. Transferring the file to the DEC-20

Log on to the DEC-20

On the 20 run the MODEM program:

            @MODEM.EXE

Modem will respond with:

            MODEM>

All 8 bits of every byte in a MacPaint image are significant and therefore must
be  sent to the 20. Normally, the 20 only receives 7 bit bytes. MODEM, however,
will let you transfer 8 bit bytes as well.

            MODEM>RB filename

RB stands for RECEIVE BINARY, which will make sure the 20 receives all  8  bits
Transferring files to the host computer                                  Page 3


of every MacPaint byte.

On  the Macintosh, select Send File from the FILE Menu. The Mac will prompt you
with the filenames on the current disk in the drive. If you want to send a file
from  another disk, select eject and insert the disk of your preference. Select
the file you desire and then choose send (which will appear in the menu next to
the  filename  you select). Of course, if you have two disk drives, you can put
the desired disk for the transfer in the second  drive  and  select  the  Drive
option  when  it asks you for the filename to transfer. You can then select the
file from the other drive. The Mac will then  prompt  you  for  disk  swaps  if
necessary and transfer the file.

When  the transfer is complete, it will return you to MacTerminal, connected to
the 20 and running MODEM. You May now exit MODEM or  repeat  the  procedure  to
transfer more files:

            MODEM>D

(D  is  for  disconnect - Do *NOT* type 'e' or 'exit', or you will get yourself
hung!)

2.2. Kermit

Kermit will also let you transfer full 8 bit bytes to the 20.

2.2.1. Macintosh Settings

Pull down "Mode", select "Controls".

                Set baud rate (for the current version, you have  to  set  some
                OTHER  speed  and  then set it to what you want, due to a funny
                bug that sets the  line  speed  to  1200  no  matter  what  the
                indicator shows.)

                    Bits Sent: 8
                    Stop Bits: 1
                    Parity: None
                    Xon/Xoff Flow: Yes

then click "exit".

2.2.2. Transferring Files To The DEC-20

Pull down "Mode" again and select "Connect".  Start up kermit on the DEC-20:

            @KERMIT.EXE

The 20 will respond with:

            TOPS-20 KERMIT version 4.2(253)

            KERMIT-20>
Transferring files to the host computer                                  Page 4


To send a MacPaint file:

            KERMIT-20>SET FILE BYTESIZE 8

            KERMIT-20>RECEIVE or RECEIVE filename

Return  to  MacKermit.   Now pull down "Mode" once again and select "Transmit".
The host will call the file whatever it is you call the local file (you have no
choice.)
Running MACQMS                                                           Page 5


3. Running MACQMS

The MacPaint image has now been transferred to the 20. You can now go ahead and
convert it to a format suitable  for  printing  on  the  QMS  Lasergrafix  1200
printer.  You  can convert it to be printed as a seperate document (standalone)
or to be inserted in a document (document).

3.1. Converting Images For Standalone Printing

Suppose we called the picture file 'MAC-PICTURE.PIC'.  To  convert  it  to  QMS
format, run MACQMS on the 20:

            @MACQMS.EXE

MACQMS will prompt you for several things:

            MacQMS - A Mac Bitmap File to QMS Conversion Program
            Mac Filename to be Converted > MAC-PICTURE.PIC.1 
            Output filename > MAC-PICTURE.LG1200.1 
            Image Type > STANDALONE
            Enter magnification desired > 4
            Change default positioning parameters? No
            Processing file MAC-PICTURE.PIC.1 [OK]


Normally  you  will  respond  with  'No' to the prompt 'Change default printing
parameters? ' This will produce a  full  page,  1  image  reproduction  of  the
original  mac  picture in portrait mode (vertically oriented on the page). What
happens if you respond with 'Yes' at this prompt? ...

            MacQMS - A Mac Bitmap File to QMS Conversion Program
            Mac Filename to be Converted > MAC-PICTURE.PIC.1 
            Output filename > MAC-PICTURE.LG1200.1 
            Image Type > STANDALONE 
            Change default positioning parameters? Yes
            Enter magnification desired > 4 
            Number of copies > 1 
            Orientation > P 
            Images per page > 1 
            Images per row > 0 
            X-position > 410 
            Y-position > 700 
            Processing file MAC-PICTURE.PIC.1 [OK]


You may enter a value for any of these parameters or enter a carriage return to
use  the  default  value.  The settings shown here are the default values which
will print a full page image as described above. You may type a  question  mark
at any of the prompts for more help.

'[OK]' indicates that the file has been fully processed by MacQms.  If an error
ocurs, you will get the following message instead of the '[OK]' message:
Running MACQMS                                                           Page 6


            [FAILED] File Is Not A Macintosh Bitmap File

If this happens, there are two possible reasons:

   1. The file is really not a Mac bitmap file

   2. The file was not correctly sent to or received by  the  20  -  check
      your communication settings and try uploading the file again.

3.2. The Parameters

3.2.1. Magnification

This parameter can be any integer from 1 to 4. A magnification of 4 in Portrait
mode will yield a full page image. You may experiment with  this  parameter  in
combination  with  the other format parameters to yield the results you desire.
The default is 4.

3.2.2. Copies

This will add a command at the end of the QUIC file telling the QMS  to  repeat
the same pass on a new page. The default is 1.

3.2.3. Orientation

This  will tell the QMS what orientation to print the page. 'P' is for portrait
mode, which is a vertical orientation. 'L' is for landscape mode,  which  is  a
horizontal orientation. The default is P.

3.2.4. Images Per Page

This parameter controls the number of images printed on each page.  If there is
no room to print the image on the page, it will force a page eject and print it
on  the  next  page.  You  should be carefull when you use this setting. If the
magnification is too large and you are printing multiple images  per  row,  you
may get funny results. The default is 1 image per page. More than one image per
page will result in multiple processing of the file (you will see  the  message
'Processing  File  ...'  etc.  once for each of the number of images per page.)
There should be a more efficient way to do this, i.e. - reposition  and  repeat
the  pass. If anyone comes up with the code to do this, feel free to send it to
me and I will add it in!

3.2.5. Images Per Row

This parameter controls the number of images to be printed across on the  page.
If  you  are  printing two images on a page and specify two images per row, the
images will be printed next to each other, rather than one below the other. See
the  section on images per page for some special considerations you should take
into account when using this option. The default is 0 (which is effectively the
same as 1).
Running MACQMS                                                           Page 7


3.2.6. X-Position

This will specify the position from the left side of the page at which to start
printing the image. The value is input in inches * 1000. That is to say, if you
wanted  to start printing .41 inches from the left margin, you would enter 410,
which is the default.

3.2.7. Y-Position

This will specify the position from the top of  the  page  at  which  to  start
printing the image. The value is input in inches * 1000. That is to say, if you
wanted to start printing .71 inches from the left margin, you would eneter 710,
which is the default.

3.3. Printing the picture

You  now  will  have  a file in your directory called MAC-PICTURE.LG1200.1 This
file is suitable for printing on the QMS laser printer:

            @PRINT MAC-PICTURE.LG1200.1 /UNIT:3 or /SITE:QMS

Be sure the toner level in the QMS isn't  low  before  printing  any  pictures.
Also, please refill the QMS with toner after printing several pictures.

3.4. Converting For Use In A Seperate Document

Suppose  you  wanted  to  put  the  picture  into  a text document.  Specifying
'document' to the prompt image type will produce an image  without  positioning
commnands  suitable  for  insertion  in a text document. It is assumed that the
correct positioning will be done from within the text document. For information
on how to use a picture from within SCRIBE, see the next section.

            MacQMS - A Mac Bitmap File to QMS Conversion Program
            Mac Filename to be Converted > MAC-PICTURE.PIC.1
            Output filename > MAC-PICTURE.LG1200.1 
            Image Type > DOCUMENT 
            Enter magnification desired > 2 
            Processing file MAC-PICTURE.PIC.1 [OK]

3.5. Using A Macintosh Picture In Scribe

If  you  want  to  use  the bitmap image from within a scribe document you must
first run MACQMS on the file and specify 'document' as the image type. In  your
SCRIBE source file, include the following where you want the image to appear:

            @picture(size=4.25in,nonscaleablelaser=foo.mss)

Where  'foo.mss'  is  the  name  of  the converted bitmap file.  The size tells
SCRIBE how much space to allow for the picture within the  text.  To  determine
what size you should use, use the following table:
Running MACQMS                                                           Page 8


            MACQMS Magnification                      SCRIBE Size

                    4                                     8.50 in
                    3                                     6.40 in
                    2                                     4.25 in
                    1                                     2.20 in

These  are  only  suggestions,  you  may  get  better results by using slightly
different values.

Mail any bug reports, comments to LAVITSKY@RUTGERS
MacPaint File Format                                                     Page 9


I. MacPaint File Format

The first 512 bytes of the file are the header. The first four  bytes  comprise
the  version  number, followed by 38 * 8 = 304 bytes of patterns. The remaining
204 bytes are reserved for future expansion.  If the version  number  is  zero,
the  patterns are ignored. Hence, programs that wish to create files to be read
into MacPaint can just write out 512 bytes of zero as the header.

Following the header are 720 compressed scanlines of data which  form  the  576
wide  by 720 tall bitmap. The bitmap is compressed as follows: Any run of three
or more equal bytes is compressed into a count byte and  a  single  data  byte.
Runs of unequal bytes are passed on literally, preceeded also by a count byte.

          <count byte> <data byte>

                    count = -1..-127 ==> replicate byte 2..128 times

          <count byte> <n data bytes>

                    count = 0..127 ==> copy 1..128 times uncompressed

                    count = -128 ignored for backward compatibility
QMS Quic Bitmap Format                                                  Page 10


II. QMS Quic Bitmap Format

II.1. General Overview

The  QMS  Lasergrafix  1200  has  its'  own command language called 'QUIC'. The
printer has an actual resolution of 90,000 dots per square inch  and  the  QUIC
language  lets you take full advantage of all the 1200s' graphics capabilities.
The QUIC command language allows selection of fonts and use of downloaded fonts
for  multiple fonts on a page, bar codes, line drwaing, box drawing, horizontal
and vertical form drawing, bar charts,  pie  charts,  raster  graphics,  vector
graphics  and  area fill. QUIC also provides several powerfull page positioning
commands which allow precise plotting of all  QUIC  features  anywhere  on  the
page.

II.2. General QUIC Conventions

                      ^   q...q   p...p  data   ^G    ^-
 QUIC Cntrl Character-|     |       |      |     |    |-Comand/Pass Terminator
  Command ID (1, 2, or 3)---|       |      |     |-General Command Terminator
     Command Params (if applicable)-|      |-Data To Be Printed(if applicable)

The syntax for a QMS Plot/Pixel pass is:

               |- Plot/Pixel Command Indicator
               |
               |    |- Plot/Pixel Mode "Window".
               |    |  Four Digits Required
               |    |
               |    |                  |- Optional Parameters. At Least One Of
               |    |                  |  These Must Be Included
              ---  ----  |--------------------------|
              ^P   nnnn  data  ^Bbbb  ^Dddd  ^Ccccxx  ^G
                           |     |      |       |      |
Hexadecimal Pairs         -|     |      |       |      |
Representing The Bit Map         |      |       |      |
Of The Data Being Defined.       |      |       |      |
                                 |      |       |      |
 Bright Pixel Request. Repeats  -|      |       |      |
 an "f" Hex Digit "bbb" Times.          |       |      |
                                        |       |      |
  Dark Pixel Request. Repeats A "0"    -|       |      |
  Hex Digit "ddd" Times.                        |      |
                                                |      |
    Patterned Pixel Request. Repeats A Hex     -|      |
    Digit Pair (xx) "ccc" Times.                       |
                                                       |
     Command Terminator. Used To Exit Plot/Pixel Mode -|
QMS Quic Bitmap Format                                                  Page 11


II.0.1. MacQms File Format

A standard MacQms file will be in the following format:

       ^PY^-         ! This begins the QUIC pass
       ^ISYNTAX0000  ! Use default syntax for parameter value interpretation
       ^F^-          ! Make sure we are in free format mode
       ^IOx          ! Set the orientation (where x is a P or L)
       ^IPxxxx              ! Set the magnification (4 digits needed)
       ^ITxxxx              ! Set top margin
       ^IJxxxx              ! Set bottom margin
       ^Pxxxx        ! Begin plot pass - followed by 'window' size
       ^Cxxxnn       ! Repeat data nn, xxx times
       ...
       ^G            ! End this pass
       ^DCxxxx       ! Repeat this pass xxxx times (four digits required)
       ^,            ! Eject the page
       ^-^P^N^-      ! End Quic pass, Turn off Quic mode
QMS Quic Bitmap Format                                                  Page 12
Table of Contents                                                        Page i


  Table of Contents

1. Introduction                                                               1

   1.1. Overview                                                              1
   1.2. System Requirements                                                   1

2. Transferring files to the host computer                                    2

   2.1. Modem and MacTerminal 1.1                                             2
       2.1.1. Macintosh Settings                                              2
       2.1.2. Transferring the file to the DEC-20                             2
   2.2. Kermit                                                                3
       2.2.1. Macintosh Settings                                              3
       2.2.2. Transferring Files To The DEC-20                                3

3. Running MACQMS                                                             5

   3.1. Converting Images For Standalone Printing                             5
   3.2. The Parameters                                                        6
       3.2.1. Magnification                                                   6
       3.2.2. Copies                                                          6
       3.2.3. Orientation                                                     6
       3.2.4. Images Per Page                                                 6
       3.2.5. Images Per Row                                                  6
       3.2.6. X-Position                                                      7
       3.2.7. Y-Position                                                      7
   3.3. Printing the picture                                                  7
   3.4. Converting For Use In A Seperate Document                             7
   3.5. Using A Macintosh Picture In Scribe                                   7

I. MacPaint File Format                                                       9

II. QMS Quic Bitmap Format                                                   10

   II.1. General Overview                                                    10
   II.2. General QUIC Conventions                                            10
       II.0.1. MacQms File Format                                            11

                                                                                          