3.Delete all REM statements. Each REM statement uses at least one byte plus the number in the comment text. For instance, the statement 130 REM THIS IS A COMMENT uses

24 bytes of memory.

In the statement 140 X=X+Y: REM UPDATE SUM, the REM uses 14 bytes of memory including the colon before the REM.

4.Use variables instead of constants. Suppose you use the constant 3.14159 ten times in your program. If you insert a statement

10 P=3.1.4159

in the program, and use P instead of 3.14159 each time it is needed, you will save 40 bytes. This will also result in a speed improvement.

5.A program need not end with an END, so an END statement at the end of a program may be deleted.

6.Reuse variables. If you have a variable T which is used so hold a temporary result in one part of the program and you need a temporary variable later in your program, use it again. Or, if you are asking the terminal user to give a YES or NO answer to two differ- ent questions at two different times during the execution of the program, use the same temporary variable A$ to store the reply.

7.Use GOSUB's to execute sections of program statements that perform identical actions.

8.Use the zero elements of matrices; for instance, A(0), B(0,X).

STORAGE ALLOCATION INFORMATION

Simple (non-matrix) numeric and strong variables like V use 7 bytes; 2 for the variable name, and

5 for the value. Simple non-matrix string variables also use 7 bytes; 2 for the variable name, 1 for the

length, 2 for a pointer, and 2 are unused.

Matrix variables require 7 bytes to hold the header, plus additional bytes to hold each matrix element. Each element that is an integer variable requires 2 bytes. Elements that are string variables or floating

point variables require 3 bytes or 5 bytes, respectively.

String variables also use one byte of string space for each character in the string. This is true whether the string variable is a simple string variable like A$, or an element of a string matrix such as Q1$(5,2).

When a new function is defined by a DEF statement, 7 bytes are used to store the definition.

Reserved words such as FOR, GOTO or NOT, and the names of the intrinsic functions such as COS, INT and STR$ take up only one byte of program storage. All other characters in programs use one byte of program storage each.

When a program is being executed, space is dynamically allocated on the stack as follows:

1.Each active FOR...NEXT loop uses 22 bytes.

2.Each active GOSUB (one that has not returned yet) uses 6 bytes.

3.Each parenthesis encountered in an expression uses 4 bytes and each temporary result calculated in an expression uses 12 bytes.

C SPEED HINTS

The hints below should improve the execution time of your BASIC program. Note that some of these hints are the same as those used to decrease the space used by your programs. This means that in many cases you can increase the efficiency of both the speed and size of your programs at the same time.

1.Delete all unnecessary spaces and REM's from the program. This may cause a small decrease in execution time because BASIC would otherwise have to ignore or skip over spaces and REM statements.

Page 250
Image 250
Apple II manual Storage Allocation Information, Speed Hints

II specifications

The Apple II, launched in April 1977, was one of the first highly successful mass-produced microcomputer products. It marked a significant leap in personal computing, setting standards for future developments in the industry. Created by Steve Wozniak and Steve Jobs, the Apple II differentiated itself with its user-friendly design, appealing aesthetics, and robust capabilities.

One of the standout features of the Apple II was its open architecture, which allowed users to expand and enhance the computer's functionality. This design enabled hundreds of third-party hardware and software developers to contribute to its ecosystem, resulting in an array of peripherals, including printers, modems, and storage devices. The Apple II utilized a MOS Technology 6502 microprocessor running at a clock speed of 1 MHz. Initially equipped with 4 KB of RAM, the machine could be expanded to 48 KB, accommodating more complex applications and programs.

The Apple II was also notable for its colorful graphics. It was one of the first computers to support color display, offering a 6-color palette with a resolution of 280x192 pixels in 16 colors when using its Color Graphics Card. This feature significantly enhanced the visual appeal of games and educational software developed for the platform, making computing more accessible and entertaining for various audiences.

Apple's commitment to user experience was evident in the design of the machine. It featured an integrated keyboard and a plastic case, which was both durable and visually appealing. The self-contained design included drive bays for floppy disk drives, allowing for quicker data access than traditional tape drives. It also supported audio output, enabling sound effects and music, a novelty at the time.

The introduction of the Apple DOS operating system further underscored the machine's capabilities. DOS streamlined file management and made it easier for users to navigate and manage their data. The combination of hardware and software positioned the Apple II as an educational tool and a gaming platform, fostering a vibrant software ecosystem.

The Apple II family continued to evolve, with variations like the Apple II+, IIe, and IIgs being introduced over the years. These iterations brought enhancements in memory, processing power, and graphics capabilities. The legacy of the Apple II endures, not only as a foundational product in personal computing but also as a symbol of innovation that paved the way for future advancements in technology. Its impact is still felt today, as it inspired countless developers and shaped the trajectory of the computer industry.