Radio Shack CTR-118 User Manual Page 130

  • Download
  • Add to my manuals
  • Print
  • Page
    / 196
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 129
11-2
Speeding Up Execution
The speed at which a program is processed will depend on the complexity of
the operations and the number of instructions. In most simple programs,
speed will not be a factor. It will seem as though the answer is returned the
moment you enter RUN. However, as you begin writing longer and more
intricate programs, speed will become a significant factor. Here are some
suggestions to guide you in designing speedier programs.
1)
Delete all unnecessary lines in the program (REM statements, etc.)
2)
Combine multi-statement program lines when practical.
3)
Use variables rather than constants in operations (very important). Your
TRS-80 normally operates using floating decimal point values. It takes a lot
less time to access a variable than to convert a constant to floating point
representation. For example: if you will use
π
a lot in a program, define
π
as a
variable (PI=3.14159) and use the variable (PI) in the operations.
4)
Use POKE graphics. This can speed up your graphics displays by a factor
of 6.
5)
Define the most commonly used variables first. When a variable is
defined it is located at the top of the variable table. The second will be just
below that. When variables are accessed, the table will be searched to find
the variable. Therefore, you will save time by locating frequently used
variables at the top of the table (by defining them first). The Computer will
not have to look as far to find them.
6)
Use integer variables, especially in FOR-NEXT loops, when possible. This
is most important of all.
Page view 129
1 2 ... 125 126 127 128 129 130 131 132 133 134 135 ... 195 196

Comments to this Manuals

No comments