Epson LX-80 User Manual - Page 92

String variables, turn and line feed codes as pin patterns.

Page 92 highlights

You may also wonder why the program prints not only the different pin patterns but also the character "J" a number of times. The reason lies in the number of columns you reserved with the graphics command. After the LX-80 receives all the numbers reserved by a graphics command-50 in this case-it leaves the graphics mode and resumes interpreting numbers as printable characters or print commands. Since the incorrect program has sent many extra numbers, mainly 10s and 13s, the 50 columns reserved are filled before the loop in line 40 has been executed 50 times. Therefore, during the last passes of the loop the LX-80 interprets CHR$(74) as the ASCII code for "J" and prints that character each of the last 35 passes of the loop. If you want to make the program work correctly, put the linespacing command in line 10, delete line 30, and add two semicolons: one at the end of line 20 and one between CHR$(74) and the colon in line 40. We have explained this incorrect program in detail so that you will remember two important tips about using the graphics command: l Use semicolons to prevent the LX-80 from printing carriage re- turn and line feed codes as pin patterns. l Do not put any other commands between the graphics command and its data. Our example should help you understand the graphics mode better and may help you find the problem when one of your own programs gives you unexpected results. String variables In a long and complicated graphics program, typing in the graphics command or repetitive data numbers over and over can become timeconsuming. You can avoid much of the repetitive typing by storing commands and data in string variables. Look at the program below. It is the same as the multiple-line exercise earlier in the chapter except for the string variables. 88

  • 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

You may also wonder why the program prints not only the differ-
ent pin patterns but also the character
J
a number of times. The
reason lies in the number of columns you reserved with the graphics
command. After the
LX-80
receives all the numbers reserved by a
graphics command-50 in this case-it leaves the graphics mode and
resumes interpreting numbers as printable characters or print com-
mands.
Since the incorrect program has sent many extra numbers, mainly
10s
and 13s, the 50 columns reserved are filled before the loop in line
40 has been executed 50 times. Therefore, during the last passes of the
loop the
LX-80
interprets
CHR$(74)
as the ASCII code for ā€œJā€ and
prints that character each of the last 35 passes of the loop.
If you want to make the program work correctly, put the line-
spacing command in line
10,
delete line 30, and add two semicolons:
one at the end of line 20 and one between CHR$(74) and the colon in
line 40.
We have explained this incorrect program in detail so that you will
remember two important tips about using the graphics command:
l
Use semicolons to prevent the LX-80 from printing carriage re-
turn and line feed codes as pin patterns.
l
Do not put any other commands between the graphics command
and its data.
Our example should help you understand the graphics mode better
and may help you find the problem when one of your own programs
gives you unexpected results.
String variables
In a long and complicated graphics program, typing in the graphics
command or repetitive data numbers over and over can become time-
consuming. You can avoid much of the repetitive typing by storing
commands and data in string variables.
Look at the program below. It is the same as the multiple-line
exercise earlier in the chapter except for the string variables.
88