OXYGENHUB
◆ main openmsx / doc / printer.md
6.6 KiB · Markdown · last changed chore(): initial commit 1 month ago renderedsource blame history raw

Printer Emulation Information

This document describes the control codes and escape sequences supported by the emulated printers in openMSX.

MSX Printer (msx-printer)

The MSX printer emulates a standard MSX dot-matrix printer.

Control Characters

CodeNameFunction
01HSOHAlternate character prefix. The next character (N) is printed as N & 1FH.
07HBELAudible beep (buzzer).
08HBSBackspace. Moves the print head one character space back.
09HTABHorizontal tab. Moves the print head to the next tab stop (every 8 characters).
0AHLFLine feed. Moves the paper up one line.
0BHVTVertical tab. Same as LF.
0CHFFForm feed. Advances the paper to the next page.
0DHCRCarriage return. Moves the print head to the left margin.
0EHSODouble character-width ON.
0FHSIDouble character-width OFF.
1BHESCStart of an escape sequence.

Escape Sequences

SequenceFunction
ESC NProportional mode OFF, font density 1.0.
ESC EProportional mode OFF, font density 1.40 (Elite).
ESC QProportional mode OFF, font density 1.72 (Condensed).
ESC PProportional mode ON, font density 0.90.
ESC !Letter quality mode ON.
ESC "Letter quality mode OFF.
ESC C DDouble strike mode ON.
ESC C dDouble strike mode OFF.
ESC C IItalic mode ON.
ESC C iItalic mode OFF.
ESC C BBold mode ON.
ESC C bBold mode OFF.
ESC C SSuperscript mode ON.
ESC C sSuperscript mode OFF.
ESC C USubscript mode ON.
ESC C uSubscript mode OFF.
ESC O S nnSet skip over perforation to nn lines.
ESC L nnnSet left margin to nnn dots.
ESC ASet line spacing to 1/6 inch.
ESC BSet line spacing to 1/9 inch.
ESC T nnSet line spacing to nn/144 inch.
ESC Z nnSet line spacing to nn/216 inch.
ESC @Reset printer to default settings.
ESC \ nnnSet right margin to nnn dots.
ESC G nnn mmmmPrint bit-image graphics (nnn: density, mmmm: byte count).
ESC S nnnnPrint bit-image graphics (nnnn: byte count).
ESC XUnderline mode ON.
ESC YUnderline mode OFF.
ESC &Toggle Japanese mode.
ESC $Toggle Japanese mode.

Epson Printer (epson-printer)

The Epson printer emulates the Epson FX-80 dot-matrix printer.

Control Characters

CodeNameFunction
00HNULTerminates horizontal and vertical TAB setting.
07HBELSound beeper.
08HBSBackspace.
09HTABHorizontal tab.
0AHLFLine feed.
0BHVTVertical tab.
0CHFFForm feed.
0DHCRCarriage return.
0EHSOExpanded mode ON (resets after one line).
0FHSICompressed mode ON.
11HDC1Device control 1.
12HDC2Compressed mode OFF.
13HDC3Device control 3.
14HDC4Expanded mode OFF.
18HCANCancels all text in the print buffer.
1BHESCStart of an escape sequence.

Escape Sequences

SequenceFunction
ESC ! nMaster Print Mode Select (combined bitmask for elite, compressed, bold, etc.).
ESC % nSelect character set (n=0: ROM, n=1: RAM).
ESC & ...Define user-defined characters.
ESC * m n1 n2Select bit-image graphics mode.
ESC - nUnderline mode ON (n=1) or OFF (n=0).
ESC 0Set line spacing to 1/8 inch.
ESC 1Set line spacing to 7/72 inch.
ESC 2Set line spacing to 1/6 inch.
ESC 3 nSet line spacing to n/216 inch.
ESC 4Italic mode ON.
ESC 5Italic mode OFF.
ESC 6Enable printing of international italic characters.
ESC 7Disable printing of international italic characters.
ESC 8Enable paper-out sensor.
ESC 9Disable paper-out sensor.
ESC :Copy ROM character set to RAM.
ESC <Uni-directional printing mode ON.
ESC =Set 8th bit of data to 0.
ESC >Set 8th bit of data to 1.
ESC @Reset printer.
ESC A nSet line spacing to n/72 inch.
ESC EEmphasized mode (bold) ON.
ESC FEmphasized mode (bold) OFF.
ESC GDouble-strike mode ON.
ESC HDouble-strike mode OFF.
ESC I nPrint characters 1-31 literally (n=1).
ESC J nImmediate line feed of n/216 inch.
ESC K n1 n2Single-density bit-image graphics (480 dots per line).
ESC L n1 n2Double-density bit-image graphics (960 dots per line).
ESC MElite mode ON (12 cpi).
ESC PElite mode OFF (10 cpi).
ESC Q nSet right margin to n characters.
ESC R nSelect international character set (0:USA, 1:FR, 2:DE, 3:UK, 4:DK, 5:SE, 6:IT, 7:ES, 8:JP).
ESC S nScript mode ON (n=0: super, n=1: sub).
ESC TScript mode OFF.
ESC U nUni-directional mode ON (n=1) or OFF (n=0).
ESC W nExpanded mode ON (n=1) or OFF (n=0).
ESC Z n1 n2Quadruple-density bit-image graphics.
ESC ^ m n1 n2Nine-pin bit-image graphics mode.
ESC j nImmediate reverse line feed of n/216 inch.
ESC p nProportional mode ON (n=1) or OFF (n=0).

BASIC Examples

MSX Printer Example

This program demonstrates common formatting codes for the msx-printer.

10 LPRINT "--- MSX Printer Demo ---"
20 LPRINT CHR$(27);"E";"Elite Mode"
30 LPRINT CHR$(27);"Q";"Condensed Mode"
40 LPRINT CHR$(27);"P";"Proportional Mode"
50 LPRINT CHR$(27);"N";"Normal Mode"
60 LPRINT CHR$(27);"!";"Letter Quality ON"
70 LPRINT CHR$(27);CHR$(34);"Letter Quality OFF"
80 LPRINT CHR$(27);"CB";"Bold ON";CHR$(27);"Cb";" OFF"
90 LPRINT CHR$(27);"CI";"Italic ON";CHR$(27);"Ci";" OFF"
100 LPRINT CHR$(27);"X";"Underline ON";CHR$(27);"Y";" OFF"
110 LPRINT "Standard ";CHR$(27);"CS";"Super";CHR$(27);"Cs";" and ";CHR$(27);"CU";"Sub";CHR$(27);"Cu"
120 LPRINT CHR$(14);"Double Width ON"
130 LPRINT CHR$(15);"Double Width OFF"
140 LPRINT CHR$(12); : ' Form Feed

Epson Printer Example

This program demonstrates common formatting codes for the epson-printer.

10 LPRINT "--- Epson FX-80 Demo ---"
20 LPRINT CHR$(27);"M";"Elite Mode (12 cpi)"
30 LPRINT CHR$(27);"P";"Pica Mode (10 cpi)"
40 LPRINT CHR$(15);"Compressed Mode ON";CHR$(18);" OFF"
50 LPRINT CHR$(27);"E";"Emphasized ON";CHR$(27);"F";" OFF"
60 LPRINT CHR$(27);"G";"Double-Strike ON";CHR$(27);"H";" OFF"
70 LPRINT CHR$(27);"4";"Italic Mode ON";CHR$(27);"5";" OFF"
80 LPRINT CHR$(27);"-";CHR$(1);"Underline ON";CHR$(27);"-";CHR$(0);" OFF"
90 LPRINT CHR$(27);"W";CHR$(1);"Expanded ON";CHR$(27);"W";CHR$(0);" OFF"
100 LPRINT "Normal ";CHR$(27);"S";CHR$(0);"Super";CHR$(27);"T";" and ";CHR$(27);"S";CHR$(1);"Sub";CHR$(27);"T"
110 LPRINT CHR$(12); : ' Form Feed