Applesoft: About the LOMEM command The LOMEM command in Applesoft can be used to relocate the adresses where Applesoft stores its variables in memory. LOMEM is automatically set to the top of the program when the LOAD command is executed. ___________________________________________ | | | | After LOAD | Program text | High-Res & Variables | DOS | |______________|______________________|_____| | |-LOMEM | |-TEXTAB |-HIMEM | |-LOMEM | ___________________________________________ | | | | | After LOMEM | Program text | High-Res | Variables | DOS | |______________|__________|___________|_____| 2048 8192 16384 or 16384 24576 Most commonly, users employ LOMEM when a short program's variables collide with the High-Res screen memory. Employ the statements below depending on which page of High-Res you use, HGR or HGR2: For HGR 10 LOMEM: 16384 For HGR2 10 LOMEM: 24576 LOMEM executes a CLEAR, so you must call it before any variables are defined. WARNING: the CHAIN program that comes with DOS 3.3 will reset LOMEM to the end of the program. Take note that LOMEM moves the adresses of the variables but it does not move the address of the program. Another pointer, TEXTAB, tells Applesoft where to start loading the program. The following programs relocate the program and variables above the High-Res buffers by changing TEXTAB. DOS and CHAIN will continue to load programs there until the system is re-booted or the FP command is executed. For HGR 10 POKE 103,1 : REM THIS CHANGES 20 POKE 104,64 : REM TEXTAB TO 16385 30 POKE 16384,0 : REM (NEEDED BY APPLESOFT) 40 PRINT CHR$(4);"RUN PROGRAM" For HGR2 or both pages 10 POKE 103,1 : REM THIS CHANGES 20 POKE 104,96 : REM TEXTAB TO 24577 30 POKE 24576,0 : REM (NEEDED BY APPLESOFT) 40 PRINT CHR$(4);"RUN PROGRAM" Note: Modifying TEXTAB can be dangerous. The DOS RUN command employs an Applesoft NEW to re-initialize the rest of Applesoft's pointers. Cassette users will have to type "NEW" from the keyboard before loading their programs. Failure to do a NEW will cause unpredictable results. Apple Tech Notes Keywords: ================================================================== This information is from the Apple Technical Information Library. ArticleID: TECHINFO-0000103 19960724 15:55:27.00 .