💾 Archived View for mirrors.apple2.org.za › archive › ground.icaen.uiowa.edu › apple8 › Pgms › BASIC… captured on 2023-01-29 at 10:52:33.
-=-=-=-=-=-=-
The following program demonstrates a subroutine that eliminates arrays from memory. Use it in programs to erase the array so that it can be re-dimensioned or where it would help you to reclaim memory if an array takes up scarce memory. 100 HOME : VTAB 5 120 PRINT TAB (14);"ARRAY ERASER" 130 GOSUB 10000 : GOSUB 1050 150 PRINT "HERE ARE THE ARRAYS" 160 LIST 180 : GOSUB 1000 180 DIM A(100),B(100) 190 PRINT "AND HERE'S WHAT WE PUT IN THEM" 200 LIST 220 - 230 210 GOSUB 1000 220 LET A(100) = 100 : LET B(100) = 100 240 PRINT "OK, LET'S PRINT THEM OUT" 250 LIST 260 - 270 260 PRINT A(100) : PRINT B(100) 280 GOSUB 1000 290 PRINT "NOW TO ERASE ARRAY 'A'" 300 LIST 310 310 CALL 768,A : GOSUB 1000 330 PRINT "OK, NOW LET'S PRINT B(100) TO SHOW" 340 PRINT : PRINT "THAT IT'S STILL THERE" 350 LIST 360 360 PRINT B(100) : GOSUB 1000 380 PRINT "NOW LET'S TRY TO PRINT A(100). THE" 390 PRINT : PRINT "ERROR WE GET PROVES THAT THE" 400 PRINT : PRINT "ARRAY IS GONE." 410 LIST 420 420 PRINT A(100) 430 END 1000 REM 'PRESS ANY...' ROUTINE 1010 VTAB 23 : PRINT TAB (9);"PRESS ANY KEY FOR MORE" 1030 HTAB 20 : GET A$ 1050 VTAB 10 : HTAB 1 1070 CALL - 958 : REM CLEAR SCREEN 1080 RETURN 10000 REM THE 'ERASE' POKER 10010 FOR J = 768 TO 823: READ K: POKE J,K: NEXT J 10020 RETURN 10030 DATA 32,177,0,32,217,247 10040 DATA 24,160,2,165,155 10050 DATA 133,66,113,155,133 10060 DATA 60,200,165,156,133 10070 DATA 67,113,155,133,61 10080 DATA 136,56,165,109,133 10090 DATA 62,241,155,133,109 10100 DATA 200,165,110,133,63 10110 DATA 241,155,133,110,160 10120 DATA 0,32,44,254,32,163 10130 DATA 217,76,152,217 Apple Tech Notes Keywords: ================================================================== This information is from the Apple Technical Information Library. ArticleID: TECHINFO-0000101