______________ / \ / \ | o o | | | | ^ | | * * | | \_______/ | \ / \______________/ DMPLAS Written by Martin L. Waldman A program to convert Dot Matrix Printer Controls to Laser Printer Control Sequences Version 1.1 Copyright 1991 All rights reserved TABLE OF CONTENTS Page PART 1. OVERVIEW 1.1 Introduction ..................... 1 1.2 Installing DMPLAS ................ 1 1.3 Page Size and Printer Modes ...... 2 1.4 Laser Printer Controls ........... 2 1.5 Printer Reset..................... 3 1.6 Printing a File .................. 3 1.7 Testing DMPLAS ................... 4 PART 2. CONVERTED PRINTER CONTROLS 2.1 Pitch Control .................... 5 2.2 Print Style ...................... 5 2.3 Special Effects .................. 6 2.4 Line Spacing ..................... 6 2.5 Vertical Movement ................ 6 2.6 Margin Control ................... 7 2.7 Horizontal Movement .............. 7 2.8 Dot Graphics ..................... 7 PART 3. PRINTER CONTROL CODE TABLE 8 PART 4. SOME HINTS AND TIPS 4.1 Screen Dumps .................... 11 4.2 Line drawing characters ......... 11 4.3 Using DMPLAS with a spooler ..... 12 4.4 Using DMPLAS on a LAN ........... 12 4.5 Using DMPLAS with Windows 3 ..... 12 DMPLAS Version 1.1 1 ====================================================================== PART 1. OVERVIEW 1.1 INTRODUCTION Some of your software may have the capability of being installed for a laser printer -- but what about the other stuff ? The programs that you've used so often that your fingers do the walking by themselves -- especially your favorite graphics programs designed for a dot matrix printer ? DON'T THROW THEM AWAY -- Smile -- now you have DMPLAS ! Now you can make your laser printer hum along using software designed for a dot matrix printer -- just install DMPLAS and activate it when you need it. DMPLAS is a program that converts dot matrix printer control characters (00h to 1Fh) and printer control escape sequences (1Bh + character string) to the equivalent printer control commands used by HP LaserJet compatible printers. The program is written in 8088/8086 assembly language and will run on any computer system that operates using DOS 2.x or higher. Part 2 of this manual lists the dot matrix printer controls, by functional group, that are converted to equivalent laser printer controls by DMPLAS. Part 3 contains a complete list, in ASCII value order, of the control codes and escape sequences that DMPLAS recognizes and evaluates. Those that have no equivalents or have conflicting meanings are trapped so that your documents don't get messed up and your laser printer doesn't start to spit paper. 1.2 INSTALLING DMPLAS DMPLAS can be used in two different ways -- as a permanently installed TSR (less than 6K) that can be activated and deactivated, and to print files containing printer control data and text (see paragraph 1.6). To install DMPLAS as a TSR, the command line to be placed in your AUTOEXEC.BAT file must contain the drive and pathname where DMPLAS is stored plus one of the following: "DMPLAS /A" -- installs and/or activates DMPLAS. "DMPLAS /D" -- installs and/or deactivates DMPLAS. The first time either command line is executed, DMPLAS will be installed as a TSR and remains in memory until the system is rebooted. Subsequent entry of a command line will only turn DMPLAS on or off -- it will not be removed from memory and not be installed a second time. Using /A switch with additional parameters (see 1.3 below) changes the parameters in the installed program. The /D switch only deactivates. 2 DMPLAS Version 1.1 ====================================================================== 1.3 PAGE SIZE AND PRINTER MODES Laser printers print on only 10" (e.g. 60 lines at 6 lpi) of an 11" letter size page. If your software expects to use all 11" (66 lines), enter "DMPLAS /AF" (full) as an intitial or subsequent command line. DMPLAS then adjusts the space between lines (leading) to accomadate the extra lines -- the adjustment works with whatever line spacing you have programmed (i.e. 8 lpi yields 88 lines, etc). To return to a normal (10") page, enter the command "DMPLAS /AN". The page size adjustment is not effective until DMPLAS receives a line spacing or printer reset command (ESC '@') -- see para. 1.5 Many dot matrix printers have a set of mechanical (DIP) switches or setup panel buttons that set power-on defaults, some of which can be changed by software commands -- see your printer manual. Often one of the switches sets the printer to either the so-called Standard (Epson) mode or the so-called IBM (Proprinter) mode and cannot be changed by software. The exact way in which some of the print controls from these printers work is different depending on how the mode switch has been set -- again see your printer manual. DMPLAS defaults to the Standard mode. Where no conflict exists between the two modes, DMPLAS ignores the mode. In Parts 2 and 3 those commands that depend on the mode are flagged. You can set the IBM mode by an additional parameter to the /A switch either at the initial command in your AUTOEXEC.BAT file or when issuing subsequent activation command lines. The formats are: "DMPLAS /ANI" sets IBM mode and normal page (10") "DMPLAS /AFI" sets IBM mode and full page (11") (The page size parameter must be included for the mode to be set) On some printers setting the mode to IBM causes the printer to accept FS (1Ch) as a substitute for ESC (1Bh) in some control sequences -- the remainder of the sequence is the same. DMPLAS therefore also accepts FS as being the same as ESC without further ado. 1.4 LASER PRINTER CONTROLS DMPLAS can send unaltered control sequences directly to the laser printer. To do so send the leading ESC character (1Bh) twice followed by the rest of the sequence. ~~~~~ For example, to set the end-of-line wrap around function you would normally send ESC + the characters "&s0C" to the laser printer. If DMPLAS is actvated you can send ESC + ESC + "&s0C" to achieve the same result. See DLTEST-4 for other examples. DMPLAS Version 1.1 3 ====================================================================== 1.5 PRINTER RESET ESC '@' (Reset printer) is used by most dot matrix printers to reset the printer to the power-on status defined by the settings of mechanical (DIP) switches. Some word processors take advantage of this by sending ESC '@' and other condition resets at the beginning of a document to establish a known base from which to proceed with formatting commands. To emulate ESC '@', DMPLAS sets the following default parameters: Pitch Pica (10 cpi) Line Spacing 1/6" (6 lpi) Auto Linefeed off Left/Right margins cleared Superscript/Subscript off Horizontal Tabs set to every 8 columns and a carriage return (0Dh) is sent to the printer. The mode (STD or IBM) and page factor (10" or 11") are NOT changed. To avoid the ejection of an empty sheet of paper from the laser printer, DMPLAS does NOT send the laser printer soft reset (ESC 'E'). You may eject the current page by entering the command "DMPLAS /F". This will send a formfeed (0Ch) to the printer whether or not DMPLAS is active. 1.6 PRINTING A FILE Some programs can create ASCII files that contain both the text to be printed and the printer control data to format the printout. Such files can be printed on your laser printer even if DMPLAS has not been installed or activated. Enter the folllowing command (entries inside brackets are optional): "[drive:][\pathname\]DMPLAS /P [drive:][\pathname\]filename.ext" You may also use both additional parameters with the /P command to set the page size and mode. Note however that if DMPLAS has been installed and activated, the TSR page size and mode takes precedence. Before printing the file a printer reset is performed and the laser end-of-line wrap and perforation skip functions are activated. The laser printer soft reset (ESC 'E') is sent at the end. NOTE: DMPLAS does NOT check printer status, neither as a TSR nor as a file printer, but does return a normal status byte. You should make sure your printer is on line and ready. 4 DMPLAS Version 1.1 ====================================================================== 1.7 TESTING DMPLAS So that you can see if DMPLAS works well with your computer and your printers, we have included a series of files on the distribution diskette that you can use to check it out. DLTEST-W.WS4 is a document written in Wordstar Version 4 to be printed on a dot matrix printer. DLTEST-W.PRN is the result of redirecting the printer output to a file -- it contains both formatting commands and document text. The other test files are named "DLTEST-n" (n = a number or letter). There are two files each with the same name. DLTEST-n.BAS is the Basic program that was used to create DLTEST-n.PRN -- the file that contains both the printer controls and the text. Before you install DMPLAS you may want to try the following: 1. Put your dot matrix printer on line, and at the DOS prompt enter ~~~~~~~~~~ "COPY DLTEST-n.PRN PRN" 2. Now put your laser printer on line, and at the DOS prompt enter ~~~~~ "DMPLAS /P DLTEST-n.PRN" If you have installed and activated the TSR, you can print to your laser printer with the command "COPY DLTEST-n.PRN PRN" The test files contain examples of the more commonly used controls. All use the normal page length and standard mode. DLTEST-1 Print Pitch, Style, and Special Effects DLTEST-2 The Master Print Mode DLTEST-3 Line Spacing DLTEST-4 Left and Right Margins DLTEST-5 Vertical and Horizontal Movement DLTEST-6 Horizontal Tab Commands and Backspace DLTEST-F Dot Graphics - grey scale patterns DLTEST-G Dot Graphics - cross hatch pattern DMPLAS Version 1.1 5 ====================================================================== PART 2. CONVERTED PRINTER CONTROLS The following is a list of the dot matrix printer controls, by functional group, that are converted to equivalent laser printer controls by DMPLAS. The controls that depend on mode are indicated by or . All others are available in both modes. The test files listed demonstrate some of the controls available in standard mode. 2.1 PITCH CONTROL DMPLAS pitch controls attempt to use Courier fonts -- Pica translates to 10 cpi/12 pts, Elite to 12cpi/10pts, and Condensed to 16cpi/8pts. If you are not happy with the appearance provided by your current laser printer fonts see FONT.DOC (in DMPLASFN.ZIP) for alternatives. The standard print pitch controls are demonstrated in DLTEST-1 SO Expanded print - one line SI Condensed print DC2 Cancel condensed DC2 Set 10 cpi (Pica) DC4 Cancel one line expanded ESC SO Expanded print - one line ESC SI Condensed print ESC DC2 Cancel condensed ESC ':' Set 12 cpi (Elite) ESC 'M' Set pitch to Elite (12 cpi) ESC 'P' Set pitch to Pica (10 cpi) ESC 'W' 1 Expanded print on ESC 'W' 0 Expanded print off ESC 'g' Set 15 cpi 2.2 PRINT STYLE The standard print style commands are demonstrated in DLTEST-1 ESC '%G' Begin Italics ESC '%H' End Italics ESC '4' Select italic characters ESC '5' Cancel italic characters ESC 'E' Emphasized printing on ESC 'F' Emphasized printing off ESC 'G' Boldface on ESC 'H' Boldface off ESC 'P' 1 Select proportional printing ESC 'P' 0 Cancel proportional printing ESC 'p' 1 Select proportional printing ESC 'p' 0 Cancel proportional printing 6 DMPLAS Version 1.1 ====================================================================== 2.3 SPECIAL EFFECTS These special effect commands are demonstrated in DLTEST-1 ESC '-' 1 Underline on ESC '-' 0 Underline off ESC 'S' 0 Set superscript on ESC 'S' 1 Set subscript on ESC 'T' Set superscript/subscript off ESC '!' n Set Master Print Mode n command is explained and demonstrated in DLTEST-2 Not demonstrated ESC 'I' n Set Master print mode n 2.4 LINE SPACING The standard line spacing commands are demonstrated in DLTEST-3 ESC '%8' n Begin n/360 line spacing ESC '+' n Begin n/360 line spacing ESC '0' Set line spacing to 1/8" ESC '1' Set line spacing to 7/72" ESC '2' Set line spacing to 1/6" ESC '2' Execute ESC 'A' n ESC '3' n Set line spacing to n/216" ESC 'A' n Set line spacing to n/72" ESC 'A' n Set line spacing n/72" immediate ESC 'A' n Set line spacing n/72" for ESC '2' Not demonstrated ESC '[' n Begin n/360 line spacing 2.5 VERTICAL MOVEMENT These vertical movement commands are demonstrated in DLTEST-5 LF Line feed FF Form feed ESC LF Reverse Linefeed ESC FF Reverse Formfeed ESC 'J' n Onetime linefeed of n/216" ESC 'f' 1 n Set print position to current line + n Not demonstrated ESC '%4' n Onetime n/360 line feed ESC '5' 1 Auto Linefeed on ESC '5' 0 Auto Linefeed off ESC 'j' n Send one reverse LF n/216" DMPLAS Version 1.1 7 ====================================================================== 2.6 MARGIN CONTROL These margin control commands are demonstrated in DLTEST-4 ESC 'l' n Set left margin to column n ESC 'Q' n Set right margin col n ESC 'X' l r Set left & right margins This commands is demonstrated in DLTEST-3 ESC 'N' n Set bottom margin n lines Not demonstrated ESC 'O' Cancel top & bottom margins 2.7 HORIZONTAL MOVEMENT These horizontal commands are also demonstrated in DLTEST-5 ESC '$' n1 n2 Absolute horizontal position ESC '\' n1 n2 Relative horizontal position ESC 'f' 0 n Set print position to col n These are demonstrated in DLTEST-6 (new in DMPLAS 1.1) BS Backspace HT Horizontal tab ESC 'D' n1 n2 ...0 Set variable horizontal tabs at n1,n2,etc. ESC 'e' 0 n Set horizontal tabs at every n columns Not demonstrated ESC 'd' n1 n2 Relative horizontal position 2.8 DOT GRAPHICS Since dot matrix and laser printers differ in the way 8 bit dot graphics (raster graphics) are printed, some adjustments are made by DMPLAS. Horizontal spacing is maintained by adding dots to make it equivalent. Vertical spacing of 8/72" per line is maintained by duplicating dot rows on the laser printer. These commands are demonstrated in DLTEST-F and DLTEST-G ESC 'K' n1 n2 m1 m2 ... Normal density (60 dpi) ESC 'L' n1 n2 m1 m2 ... Double density (120 dpi) ESC 'Y' n1 n2 m1 m2 ... Double density/double speed (120 dpi) ESC 'Z' n1 n2 m1 m2 ... Quadruple density (240 dpi) ESC '*' n n1 n2 m1 m2 ... Select graphics mode n where n = 0 = Normal density (60 dpi) 1 = Double density (120 dpi) 2 = Double density/double speed (120 dpi) 3 = Quadruple density (240 dpi) 4 = Semi-double density (80 dpi) 5 = Plotter graphics (72 dpi) 6 = CRT graphics (90 dpi) 7 = Double density Plotter (144 dpi) 8 DMPLAS Version 1.1 ====================================================================== PART 3. PRINTER CONTROL CODE TABLE The following table lists, in ASCII value order, all of the control codes and escape sequences that are recognized by DMPLAS. The symbols in the Flag column indicates what action is taken when translating the code; * = trapped or > = translated to equivalent laser sequence. Actions dependent on the mode are prefixed with S (Std) or I (IBM). Code/Sequence Flag Printer Function Performed ~~~~~~~~~~~~~ ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ BEL * Sound printer bell BS > Backspace HT > Horizontal tab LF > Line feed VT * Vertical tab FF > Form feed CR > Carriage return SO > Expanded print - one line SI > Condensed print on DC1 * Set printer on line DC2 S> Cancel condensed DC2 I> Set 10 cpi (Pica) DC3 * Set printer off line DC4 > Cancel one line expanded CAN * Cancel a line (clear buffer) DEL * Delete last character sent ESC LF > Reverse Linefeed ESC FF > Reverse Formfeed ESC SO > Expanded print - one line ESC SI > Condensed print on ESC DC2 > Cancel condensed ESC EM n * Sheet feeder commands ESC EM 'T' n * Set print start on sheet feeder ESC ESC > DMPLAS bypass - sends ESC once ESC US n * Double/Triple height printing ESC ' ' n * Add n dots between characters ESC '!' n S> Set master print mode ESC '!' n I* Select international char set ESC '#' * Accept bit 8 as is ESC '$' n1 n2 > Absolute horizontal position ESC '%' n S* Download character set control ESC '%4' n I> Onetime n/360 line feed ESC '%8' n I> Begin n/360 line spacing ESC '%G' I> Begin Italics ESC '%H' I> End Italics ESC '&' 0 ... * Define download characters ESC '(' n * Select NLQ/HSD print quality ESC '*' n ... > Select 8 bit graphics mode n ESC '+' n1 .. . S* Macro instruction commands ESC '+' n I> Begin n/360 line spacing ESC '-' 1 > Underline on ESC '-' 0 > Underline off ESC '/' n * Select vertical tab channel n DMPLAS Version 1.1 9 ====================================================================== PART 3. PRINTER CONTROL CODES (continued) Code/Sequence Flag Printer Function Performed ~~~~~~~~~~~~~ ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ESC '0' > Set line spacing to 1/8" ESC '1' > Set line spacing to 7/72" ESC '2' S> Set 6 lpi ESC '2' I> Execute ESC 'A' n ESC '3' n > Set line spacing to n/216" ESC '4' S> Select italic characters ESC '4' I* Set TOF here (IBM mode) ESC '5' > Cancel italic characters ESC '5' 1 > Auto Linefeed on ESC '5' 0 > Auto Linefeed off ESC '6' * Select IBM character set #2 ESC '6' * 128-159,255 = Italic Internat ESC '7' * Select IBM character set #1 ESC '7' * 128-159,255 = contol codes 0-32,127 ESC '8' * Disable paper out detector ESC '9' * Enable paper out detector ESC ':' > Set 12 cpi (Elite) ESC ':' 0 n 0 * Copy ROM font n into RAM ESC '<' * Set uni-directional print ESC '=' * Set bit 8 to zero ESC '='n n 20 /1 * Define download characters ESC '>' * Set bit 8 to one ESC '?' n0 n1 * Redefine graphic mode ESC '@' > Reset printer ESC 'A' n S> Set line spacing n/72" immediate ESC 'A' n I> Set line spacing n/72" for ESC '2' ESC 'B' n1 .. .0 * Set vertical tab positions ESC 'C' 0 n * Set page length n inches ESC 'C' n * Set page length n lines ESC 'D' n1 .. .0 > set variable horizontal tab positions ESC 'E' > Emphasized printing on (Bold) ESC 'F' > Emphasized printing off (Bold) ESC 'G' > Boldface Double strike on ESC 'H' > Boldface Double strike off ESC 'I' n S* Character set selection ESC 'I' n I> Set Master print mode ESC 'J' n > Onetime linefeed of n/216" ESC 'K' n1 .. . > Normal density graphics 60 dpi ESC 'L' n1 .. . > Double density graphics 120 dpi ESC 'M' > Set 12 cpi (Elite) ESC 'N' n > Set bot marg n lines = skip perf ESC 'O' > Cancel top & bottom margins ESC 'P' S> Set 10 cpi (Pica) ESC 'P' 1/0 I> Set Proportional on/off ESC 'Q' n S> Set right margin col n ESC 'Q' 3,35, 36 I* Deselect printer ESC 'R' * Reset horiz and vert tabs ESC 'R' n * Select character set n ESC 'S' n > Set superscript/subscript on ESC 'T' > Set superscript/subscript off 10 DMPLAS Version 1.1 ====================================================================== PART 3. PRINTER CONTROL CODES (continued) Code/Sequence Flag Printer Function Performed ~~~~~~~~~~~~~ ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ ESC 'U' n * Unidirectional print control ESC 'V' n dat a * Repeat data n times (LQ-1500) ESC 'V' NUL * Cancel repeat data (LQ-1500) ESC 'W' 1/0 > Expanded print on/off ESC 'X' * Cancel all WP modes except propor. ESC 'X' l r > Set left & right margins ESC 'Y' n1 .. . > Dble dens/dble speed graphics ESC 'Z' n1 .. . > Quadruple density graphics ESC '[' n S> Begin n/360 line spacing ESC '[' n ... I* Print double high/wide ESC '\' n1 n2 S> Relative horizontal position ESC '\' n1 n2 I* Print all codes as characters ESC ']' n > Onetime linefeed of n/360" ESC '^' 0/1 . .. * 60/120 dpi graphics ESC '^' n ... * 9 pin graphics ESC '^' n * Print char(n) from all char chart ESC '_' 1/0 * Overlining on/off ESC 'a' n * Align or center printing ESC 'b' n ... 0 * Set vertical tabs in channel ESC 'c' n * Set top margin n lines ESC 'd' n1 n2 > Relative horizontal position ESC 'e' 0/1 n * Set H/V tabs every n chars ESC 'e' 0 n > Set horizontal tabs every n columns ESC 'e' 1 n * Set verical tabs every n lines ESC 'f' 0 n > Set print position to col n ESC 'f' 1 n > Printer to current line + n ESC 'g' > Set pitch to 15 cpi (Micron) ESC 'h' n * Enlarged characters on/off ESC 'i' n * Set immediate printing on/off ESC 'j' n S> Send one reverse LF n/216" (STD) ESC 'j' I* Deselect printer ESC 'k' n * Select font/typeface n ESC 'l' n > Set left margin to column n ESC 'm' * Select Triple width printing ESC 'm' 1/0 * Select/Cancel HX-20 graphic symbols ESC 'p' 1 > Select proportional printing ESC 'p' 0 > Cancel proportional printing ESC 'q' n * Select character style n ESC 'r' n * Select color to print ESC 'r' n * Set top margin n lines ESC 's' n * Set printing speed ESC 't' n * Select graphic/italic chars set ESC 'v' n * Custom character set n ESC 'w' 0/1 * Double high off/on ESC 'x' 1/0 * Set Near Letter Quality on/off ESC 'y' n * Select quasi 8 bit graphics ESC '~' 0/1 * Print normal/slashed zero DMPLAS Version 1.1 11 ====================================================================== PART 4. SOME HINTS AND TIPS 4.1 SCREEN DUMPS Text screen prints (from pressing the Shift-PrtSc key) on some dot matrix printers as well as laser printers have special characters printed instead of true lines as shown on the screen. See 4.1 for a solution to this problem. The program GRAPHICS.COM included with DOS before version 5 worked only with CGA screens and IBM/Epson dot matrix printers. DMPLAS /A allows these screen dumps to be printed on HP LaserJet compatibles. Unfortunately GRAPHICS.COM will still only work properly with CGA graphic screens. There are other programs that handle EGA, VGA, and Hercules graphics and DOS 5's GRAPHICS.COM accomidates these as well as HP LaserJets. For DMPLAS to be properly effective it should be loaded (DMPLAS /A) before GRAPHICS.COM. ~~~~~~ 4.2 IBM LINE DRAWING CHARACTERS IBM Graphics and IBM Proprinters are capable of printing the IBM line drawing characters. The Epson FX is effectively compatible with the IBM Graphics printers except that italic characters are printed instead. This is why text screen dumps have "e"s and other characters instead of lines. There are 2 solutions to this problem. 1) DOWNLOAD CO120RPN.SFP from the DMPLASFN font set pack. 2) With a HP LaserJet series II the following will change the character set of the native font from Roman 8 (with italic characters) to IBM-US (with line drawing characters). Hold down the menu key until the display reads "SYM SET = Roman 8*" Press the + key until the display reads "SYM SET = IBM-US" Press the Enter/Reset Menu key to make the IBM-US the new default set. (The display marks this with the asterisk from Roman 8) Hold down the Continue/Reset key until the display reads "07 RESET" You only need do this once. After this the LaserJet will power-on with the IBM-US symbol set active. 12 DMPLAS Version 1.1 ====================================================================== 4.3 USING DMPLAS WITH A SPOOLER Since a spooler can effectively hold up the physical printing of the output until the laser printer can catch up, we recommend that you load DMPLAS as a TSR after you load your spooler software into memory. ~~~~~ If your spooler works as a device driver (in CONFIG.SYS) there DMPLAS should work fine also. 4.4 USING DMPLAS ON A LAN Due to the way DMPLAS achieves activation and de-activation, DMPLAS must be loaded on remote terminals (where the programs are actually run) rather than on the file server (where the printer is attached). DMPLAS will then translate the output to the HP LaserJet standard before the LAN transfers the output over the wires to the printer. 4.5 USING DMPLAS WITH WINDOWS 3 DMPLAS works fine when used with DOS programs being run on the DOS shell under Windows. DMPLAS can either be loaded before WIN is executed or from the DOS shell after the DOS icon has been clicked. DMPLAS can also be included in a batch file executed by a .PIF routine. In this case there is no need to deactivate DMPLAS after the program has executed. Please remember that even in a multi-tasking situation, the activation and deactivation of DMPLAS via DMPLAS /A and DMPLAS /D takes place immediately. If there is print left in a spooler or being outputted by another program running in the background the changes to the status of DMPLAS might affect the final output to the printer. Before issuing a DMPLAS command the system should be "quiet".