| e8555c89 Andy McCall |
1 |
# Printer Emulation Information |
| 2 |
|
| 3 |
This document describes the control codes and escape sequences supported by the emulated printers in openMSX. |
| 4 |
|
| 5 |
## MSX Printer (msx-printer) |
| 6 |
The MSX printer emulates a standard MSX dot-matrix printer. |
| 7 |
|
| 8 |
### Control Characters |
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
| 01H | SOH | Alternate character prefix. The next character (N) is printed as N & 1FH. | |
| 13 |
| 07H | BEL | Audible beep (buzzer). | |
| 14 |
| 08H | BS | Backspace. Moves the print head one character space back. | |
| 15 |
| 09H | TAB | Horizontal tab. Moves the print head to the next tab stop (every 8 characters). | |
| 16 |
| 0AH | LF | Line feed. Moves the paper up one line. | |
| 17 |
| 0BH | VT | Vertical tab. Same as LF. | |
| 18 |
| 0CH | FF | Form feed. Advances the paper to the next page. | |
| 19 |
| 0DH | CR | Carriage return. Moves the print head to the left margin. | |
| 20 |
| 0EH | SO | Double character-width ON. | |
| 21 |
| 0FH | SI | Double character-width OFF. | |
| 22 |
| 1BH | ESC | Start of an escape sequence. | |
| 23 |
|
| 24 |
### Escape Sequences |
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
| ESC N | Proportional mode OFF, font density 1.0. | |
| 29 |
| ESC E | Proportional mode OFF, font density 1.40 (Elite). | |
| 30 |
| ESC Q | Proportional mode OFF, font density 1.72 (Condensed). | |
| 31 |
| ESC P | Proportional mode ON, font density 0.90. | |
| 32 |
| ESC ! | Letter quality mode ON. | |
| 33 |
| ESC " | Letter quality mode OFF. | |
| 34 |
| ESC C D | Double strike mode ON. | |
| 35 |
| ESC C d | Double strike mode OFF. | |
| 36 |
| ESC C I | Italic mode ON. | |
| 37 |
| ESC C i | Italic mode OFF. | |
| 38 |
| ESC C B | Bold mode ON. | |
| 39 |
| ESC C b | Bold mode OFF. | |
| 40 |
| ESC C S | Superscript mode ON. | |
| 41 |
| ESC C s | Superscript mode OFF. | |
| 42 |
| ESC C U | Subscript mode ON. | |
| 43 |
| ESC C u | Subscript mode OFF. | |
| 44 |
| ESC O S nn | Set skip over perforation to nn lines. | |
| 45 |
| ESC L nnn | Set left margin to nnn dots. | |
| 46 |
| ESC A | Set line spacing to 1/6 inch. | |
| 47 |
| ESC B | Set line spacing to 1/9 inch. | |
| 48 |
| ESC T nn | Set line spacing to nn/144 inch. | |
| 49 |
| ESC Z nn | Set line spacing to nn/216 inch. | |
| 50 |
| ESC @ | Reset printer to default settings. | |
| 51 |
| ESC \ nnn | Set right margin to nnn dots. | |
| 52 |
| ESC G nnn mmmm | Print bit-image graphics (nnn: density, mmmm: byte count). | |
| 53 |
| ESC S nnnn | Print bit-image graphics (nnnn: byte count). | |
| 54 |
| ESC X | Underline mode ON. | |
| 55 |
| ESC Y | Underline mode OFF. | |
| 56 |
| ESC & | Toggle Japanese mode. | |
| 57 |
| ESC $ | Toggle Japanese mode. | |
| 58 |
|
| 59 |
--- |
| 60 |
|
| 61 |
## Epson Printer (epson-printer) |
| 62 |
The Epson printer emulates the Epson FX-80 dot-matrix printer. |
| 63 |
|
| 64 |
### Control Characters |
| 65 |
|
| 66 |
|
| 67 |
|
| 68 |
| 00H | NUL | Terminates horizontal and vertical TAB setting. | |
| 69 |
| 07H | BEL | Sound beeper. | |
| 70 |
| 08H | BS | Backspace. | |
| 71 |
| 09H | TAB | Horizontal tab. | |
| 72 |
| 0AH | LF | Line feed. | |
| 73 |
| 0BH | VT | Vertical tab. | |
| 74 |
| 0CH | FF | Form feed. | |
| 75 |
| 0DH | CR | Carriage return. | |
| 76 |
| 0EH | SO | Expanded mode ON (resets after one line). | |
| 77 |
| 0FH | SI | Compressed mode ON. | |
| 78 |
| 11H | DC1 | Device control 1. | |
| 79 |
| 12H | DC2 | Compressed mode OFF. | |
| 80 |
| 13H | DC3 | Device control 3. | |
| 81 |
| 14H | DC4 | Expanded mode OFF. | |
| 82 |
| 18H | CAN | Cancels all text in the print buffer. | |
| 83 |
| 1BH | ESC | Start of an escape sequence. | |
| 84 |
|
| 85 |
### Escape Sequences |
| 86 |
|
| 87 |
|
| 88 |
|
| 89 |
| ESC ! n | Master Print Mode Select (combined bitmask for elite, compressed, bold, etc.). | |
| 90 |
| ESC % n | Select character set (n=0: ROM, n=1: RAM). | |
| 91 |
| ESC & ... | Define user-defined characters. | |
| 92 |
| ESC * m n1 n2 | Select bit-image graphics mode. | |
| 93 |
| ESC - n | Underline mode ON (n=1) or OFF (n=0). | |
| 94 |
| ESC 0 | Set line spacing to 1/8 inch. | |
| 95 |
| ESC 1 | Set line spacing to 7/72 inch. | |
| 96 |
| ESC 2 | Set line spacing to 1/6 inch. | |
| 97 |
| ESC 3 n | Set line spacing to n/216 inch. | |
| 98 |
| ESC 4 | Italic mode ON. | |
| 99 |
| ESC 5 | Italic mode OFF. | |
| 100 |
| ESC 6 | Enable printing of international italic characters. | |
| 101 |
| ESC 7 | Disable printing of international italic characters. | |
| 102 |
| ESC 8 | Enable paper-out sensor. | |
| 103 |
| ESC 9 | Disable paper-out sensor. | |
| 104 |
| ESC : | Copy ROM character set to RAM. | |
| 105 |
| ESC < | Uni-directional printing mode ON. | |
| 106 |
| ESC = | Set 8th bit of data to 0. | |
| 107 |
| ESC > | Set 8th bit of data to 1. | |
| 108 |
| ESC @ | Reset printer. | |
| 109 |
| ESC A n | Set line spacing to n/72 inch. | |
| 110 |
| ESC E | Emphasized mode (bold) ON. | |
| 111 |
| ESC F | Emphasized mode (bold) OFF. | |
| 112 |
| ESC G | Double-strike mode ON. | |
| 113 |
| ESC H | Double-strike mode OFF. | |
| 114 |
| ESC I n | Print characters 1-31 literally (n=1). | |
| 115 |
| ESC J n | Immediate line feed of n/216 inch. | |
| 116 |
| ESC K n1 n2 | Single-density bit-image graphics (480 dots per line). | |
| 117 |
| ESC L n1 n2 | Double-density bit-image graphics (960 dots per line). | |
| 118 |
| ESC M | Elite mode ON (12 cpi). | |
| 119 |
| ESC P | Elite mode OFF (10 cpi). | |
| 120 |
| ESC Q n | Set right margin to n characters. | |
| 121 |
| ESC R n | Select international character set (0:USA, 1:FR, 2:DE, 3:UK, 4:DK, 5:SE, 6:IT, 7:ES, 8:JP). | |
| 122 |
| ESC S n | Script mode ON (n=0: super, n=1: sub). | |
| 123 |
| ESC T | Script mode OFF. | |
| 124 |
| ESC U n | Uni-directional mode ON (n=1) or OFF (n=0). | |
| 125 |
| ESC W n | Expanded mode ON (n=1) or OFF (n=0). | |
| 126 |
| ESC Z n1 n2 | Quadruple-density bit-image graphics. | |
| 127 |
| ESC ^ m n1 n2 | Nine-pin bit-image graphics mode. | |
| 128 |
| ESC j n | Immediate reverse line feed of n/216 inch. | |
| 129 |
| ESC p n | Proportional mode ON (n=1) or OFF (n=0). | |
| 130 |
|
| 131 |
--- |
| 132 |
|
| 133 |
## BASIC Examples |
| 134 |
|
| 135 |
### MSX Printer Example |
| 136 |
This program demonstrates common formatting codes for the `msx-printer`. |
| 137 |
|
| 138 |
```basic |
| 139 |
10 LPRINT "--- MSX Printer Demo ---" |
| 140 |
20 LPRINT CHR$(27);"E";"Elite Mode" |
| 141 |
30 LPRINT CHR$(27);"Q";"Condensed Mode" |
| 142 |
40 LPRINT CHR$(27);"P";"Proportional Mode" |
| 143 |
50 LPRINT CHR$(27);"N";"Normal Mode" |
| 144 |
60 LPRINT CHR$(27);"!";"Letter Quality ON" |
| 145 |
70 LPRINT CHR$(27);CHR$(34);"Letter Quality OFF" |
| 146 |
80 LPRINT CHR$(27);"CB";"Bold ON";CHR$(27);"Cb";" OFF" |
| 147 |
90 LPRINT CHR$(27);"CI";"Italic ON";CHR$(27);"Ci";" OFF" |
| 148 |
100 LPRINT CHR$(27);"X";"Underline ON";CHR$(27);"Y";" OFF" |
| 149 |
110 LPRINT "Standard ";CHR$(27);"CS";"Super";CHR$(27);"Cs";" and ";CHR$(27);"CU";"Sub";CHR$(27);"Cu" |
| 150 |
120 LPRINT CHR$(14);"Double Width ON" |
| 151 |
130 LPRINT CHR$(15);"Double Width OFF" |
| 152 |
140 LPRINT CHR$(12); : ' Form Feed |
| 153 |
``` |
| 154 |
|
| 155 |
### Epson Printer Example |
| 156 |
This program demonstrates common formatting codes for the `epson-printer`. |
| 157 |
|
| 158 |
```basic |
| 159 |
10 LPRINT "--- Epson FX-80 Demo ---" |
| 160 |
20 LPRINT CHR$(27);"M";"Elite Mode (12 cpi)" |
| 161 |
30 LPRINT CHR$(27);"P";"Pica Mode (10 cpi)" |
| 162 |
40 LPRINT CHR$(15);"Compressed Mode ON";CHR$(18);" OFF" |
| 163 |
50 LPRINT CHR$(27);"E";"Emphasized ON";CHR$(27);"F";" OFF" |
| 164 |
60 LPRINT CHR$(27);"G";"Double-Strike ON";CHR$(27);"H";" OFF" |
| 165 |
70 LPRINT CHR$(27);"4";"Italic Mode ON";CHR$(27);"5";" OFF" |
| 166 |
80 LPRINT CHR$(27);"-";CHR$(1);"Underline ON";CHR$(27);"-";CHR$(0);" OFF" |
| 167 |
90 LPRINT CHR$(27);"W";CHR$(1);"Expanded ON";CHR$(27);"W";CHR$(0);" OFF" |
| 168 |
100 LPRINT "Normal ";CHR$(27);"S";CHR$(0);"Super";CHR$(27);"T";" and ";CHR$(27);"S";CHR$(1);"Sub";CHR$(27);"T" |
| 169 |
110 LPRINT CHR$(12); : ' Form Feed |
| 170 |
``` |