[comp.sys.apple2] Clearing Applesoft arrays...

jschober@gnh-starport.cts.com (Joey Schober) (08/01/90)

Once upon a time, in the TECH INFO library on America Online (nee AppleLink
PE), there was information, including a short m/l subroutine, on how to easily
un-dimension AppleSoft BASIC arrays.  I seem to have misplaced this info, and
unfortunately the TECH INFO database no longer exists on AO.  :(  Could someone
possibly send me a copy of the entire developer note, or at least the m/l
routine to do the unDim??  (ya' might want to send it to me via E-mail to avoid
wasting info-apple bandwidth)

T'anks.  :)
 
     Joseph F. Schober, Sysop, StarPort BBS [703/931-0947 - 3/12/2400 baud]

ProLine.: jschober@gnh-starport                          ======================
UUCP....: crash!gnh-starport!jschober                    Amer-Online:  JSchober
InterNet: jschober@gnh-starport.cts.com                  CompuServe: 72727,2765
ARPA....: crash!gnh-starport!jschober@nosc.mil           ======================

mattd@Apple.COM (Matt Deatherage) (08/01/90)

In article <0093A83956585C20.00000111@dcs.simpact.com> jschober@gnh-starport.cts.com (Joey Schober) writes:
>Once upon a time, in the TECH INFO library on America Online (nee AppleLink
>PE), there was information, including a short m/l subroutine, on how to easily
>un-dimension AppleSoft BASIC arrays.  I seem to have misplaced this info, and
>unfortunately the TECH INFO database no longer exists on AO.  :(  Could someone
>possibly send me a copy of the entire developer note, or at least the m/l
>routine to do the unDim??  (ya' might want to send it to me via E-mail to avoid
>wasting info-apple bandwidth)
>
>T'anks.  :)
> 
>     Joseph F. Schober, Sysop, StarPort BBS [703/931-0947 - 3/12/2400 baud]
>
It's probably of general enough interest, utility, and brevity to be useful
posted to the net.

Applesoft: Array Eraser Program
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

(Note those are the old, 1983-style "Apple Techincal Notes", of which there
were several hundred, not the "Apple II Technical Notes" from Developer
Technical Support, of which there are only a few hundred.)

-- 
============================================================================
Matt Deatherage, Apple Computer, Inc. | "The opinions represented here are
Developer Technical Support, Apple II |  not necessarily those of Apple
Group.  Personal mail only, please.   |  Computer, Inc.  Remember that."
============================================================================