Oki ML591 MICROLINE Reference Manual - Page 92

Programming Graphics in BASIC, Graphics Density Selection Commands, IBM/E

Page 92 highlights

Programming Graphics in BASIC One important thing to remember when you're programming graphics is not to include extraneous line feeds in your programs. Using a semicolon after the data in an LPRINT statement will keep the print position on the same line. However, there is an additional complication: by default, BASIC assigns to all printers a maximum line length of 80 characters. After the printer has received 80 bytes of data, it will automatically perform a carriage return and line feed. Since graphics data typically consists of many bytes, it's quite easy to exceed this limit. The resulting output will be garbled. You can work around this problem by setting the line length to the maximum allowable value, 255. Put one of these statements at the beginning of your program: For parallel printers: WIDTH "LPT1:",255 For serial printers that have been opened as #1: WIDTH #1,255 Graphics Density Selection Commands (IBM/E) ߜ ML320 E/I, ML321 E/I ߜ ML320 Turbo, ML321 Turbo ߜ ML520, ML521 Function Begin Single Density Graphics Double Density Graphics Command Double Speed/ Double Density Graphics Command Quadruple Density Graphics Command ASCII ESC K Ln Hn [data] ESC L Ln Hn [data] ESC Y Ln Hn [data] ESC Z Ln Hn [data] Dec 27 75 Ln Hn [data] 27 76 Ln Hn [data] 27 89 Ln Hn [data] 27 90 Ln Hn [data] Hex 1B 4B Ln Hn [data] 1B 4C Ln Hn [data] 1B 59 Ln Hn [data] 1B 5A Ln Hn [data] These graphics modes correspond to the 8-pin modes and are supported by most current DOS-based graphics software. Parameters Ln and Hn These parameters tell the printer how many bytes of graphics data to expect. Eight-pin graphics have one byte of data per column. To calculate the values for Ln and Hn, first determine how many columns of dots there will be in your graphics image. Divide this number by 256 and assign the whole number result to Hn; assign the remainder to Ln. 54 Chapter 6: Graphics Commands for 9-Pin Printers

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
  • 57
  • 58
  • 59
  • 60
  • 61
  • 62
  • 63
  • 64
  • 65
  • 66
  • 67
  • 68
  • 69
  • 70
  • 71
  • 72
  • 73
  • 74
  • 75
  • 76
  • 77
  • 78
  • 79
  • 80
  • 81
  • 82
  • 83
  • 84
  • 85
  • 86
  • 87
  • 88
  • 89
  • 90
  • 91
  • 92
  • 93
  • 94
  • 95
  • 96
  • 97
  • 98
  • 99
  • 100
  • 101
  • 102
  • 103
  • 104
  • 105
  • 106
  • 107
  • 108
  • 109
  • 110
  • 111
  • 112
  • 113
  • 114
  • 115
  • 116
  • 117
  • 118
  • 119
  • 120
  • 121
  • 122
  • 123
  • 124
  • 125
  • 126
  • 127
  • 128
  • 129
  • 130
  • 131
  • 132
  • 133
  • 134
  • 135
  • 136
  • 137
  • 138
  • 139
  • 140
  • 141
  • 142
  • 143
  • 144
  • 145
  • 146
  • 147
  • 148
  • 149
  • 150
  • 151
  • 152
  • 153
  • 154
  • 155
  • 156
  • 157
  • 158
  • 159
  • 160
  • 161
  • 162
  • 163
  • 164
  • 165
  • 166
  • 167
  • 168
  • 169
  • 170
  • 171
  • 172
  • 173
  • 174
  • 175
  • 176
  • 177
  • 178
  • 179
  • 180

Chapter 6: Graphics Commands for 9-Pin Printers
54
Programming Graphics in BASIC
One important thing to remember when you're programming graphics is not to include
extraneous line feeds in your programs. Using a semicolon after the data in an LPRINT
statement will keep the print position on the same line.
However, there is an additional complication: by default, BASIC assigns to all printers a
maximum line length of 80 characters. After the printer has received 80 bytes of data, it will
automatically perform a carriage return and line feed. Since graphics data typically consists of
many bytes, it's quite easy to exceed this limit. The resulting output will be garbled. You can
work around this problem by setting the line length to the maximum allowable value, 255. Put
one of these statements at the beginning of your program:
For parallel printers:
WIDTH “LPT1:”,255
For serial printers that have been opened as #1:
WIDTH #1,255
Graphics Density Selection Commands
(IBM/E)
±
ML320 E/I, ML321 E/I
±
ML320 Turbo, ML321 Turbo
±
ML520, ML521
Function
ASCII
Dec
Hex
Begin Single Density
Graphics
ESC K L
n
H
n
[data]
27 75 L
n
H
n
[data]
1B 4B L
n
H
n
[data]
Double Density
Graphics Command
ESC L L
n
H
n
[data]
27 76 L
n
H
n
[data]
1B 4C L
n
H
n
[data]
Double Speed/
Double Density
Graphics Command
ESC Y L
n
H
n
[data]
27 89 L
n
H
n
[data]
1B 59 L
n
H
n
[data]
Quadruple Density
Graphics Command
ESC Z L
n
H
n
[data]
27 90 L
n
H
n
[data]
1B 5A L
n
H
n
[data]
These graphics modes correspond to the 8-pin modes and are supported by most current
DOS-based graphics software.
Parameters L
n
and H
n
These parameters tell the printer how many bytes of graphics data to expect. Eight-pin graphics
have one byte of data per column. To calculate the values for L
n
and H
n
, first determine how
many columns of dots there will be in your graphics image. Divide this number by 256 and
assign the whole number result to H
n
; assign the remainder to L
n
.