How to save an array in memory
Archiver
Posts: 46,084
In a message dated 4/28/2004 4:35:31 PM Eastern Daylight Time,
jlindsay24@y... writes:
> I have an array
> array VAR BIT(16)
>
> how can I save the entire array in memory to run another slot and
> then come back with the same value.
>
> Is there syntax with GET and PUT to do this or some other way.
>
>
If you are using a multi-slot Stamp, all slots must have the variables in
precisely the same order. Doing this would make your array available in all
eight slots.
Sid Weaver
We're always thinking.....
http://www.visualmuses.com/chipcircuit/index.html
[noparse][[/noparse]Non-text portions of this message have been removed]
jlindsay24@y... writes:
> I have an array
> array VAR BIT(16)
>
> how can I save the entire array in memory to run another slot and
> then come back with the same value.
>
> Is there syntax with GET and PUT to do this or some other way.
>
>
If you are using a multi-slot Stamp, all slots must have the variables in
precisely the same order. Doing this would make your array available in all
eight slots.
Sid Weaver
We're always thinking.....
http://www.visualmuses.com/chipcircuit/index.html
[noparse][[/noparse]Non-text portions of this message have been removed]
Comments
array VAR BIT(16)
how can I save the entire array in memory to run another slot and
then come back with the same value.
Is there syntax with GET and PUT to do this or some other way.
Thanks,
Jack Lindsay
dealing with your array:
array VAR Word
Now, instead of doing this:
array(x) = some_value
you will do this:
array.LOWBIT(x) = some_value
The nice thing about using the Word declaration is you can manipulate
all bits at once:
array = 0 ' clear the array
You would need a loop to do this with your declaration.
Now, you can pass this to another slot with PUT and GET:
PUT Location, Word array
Done deal.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Jack Lindsay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=DLPeBTpQmfPSgUXCtzI2A-SUGgI1geR2_qmDDMjmGWY_di-_6JyflDD4OVFBqQqtMVMijy7yTeXpGg]jlindsay24@y...[/url
Sent: Wednesday, April 28, 2004 2:43 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
I have an array
array VAR BIT(16)
how can I save the entire array in memory to run another slot and then
come back with the same value.
Is there syntax with GET and PUT to do this or some other way.
Thanks,
Jack Lindsay
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, April 28, 2004 4:14 PM
Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
> PBASIC is very flexible, so let me suggest an alternate strategy for
> dealing with your array:
>
> array VAR Word
>
> Now, instead of doing this:
>
> array(x) = some_value
>
> you will do this:
>
> array.LOWBIT(x) = some_value
>
> The nice thing about using the Word declaration is you can manipulate
> all bits at once:
>
> array = 0 ' clear the array
>
> You would need a loop to do this with your declaration.
>
> Now, you can pass this to another slot with PUT and GET:
>
> PUT Location, Word array
>
> Done deal.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Jack Lindsay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=EBTNaSGGBXsIh9Hv1aE9zSg1YDvEJnSUnOlvB_tix2hYIMCizv-Lwd3RR19tvk1Lu5K7LDCOx2SjaSY]jlindsay24@y...[/url
> Sent: Wednesday, April 28, 2004 2:43 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
>
>
> I have an array
> array VAR BIT(16)
>
> how can I save the entire array in memory to run another slot and then
> come back with the same value.
>
> Is there syntax with GET and PUT to do this or some other way.
>
> Thanks,
> Jack Lindsay
>
>
> To UNSUBSCRIBE, just send mail to:
> basicstamps-unsubscribe@yahoogroups.com
> from the same email address that you subscribed. Text in the Subject and
Body of the message will be ignored.
>
> Yahoo! Groups Links
>
>
>
>
>
bytes and nibs too).
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: SB [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=NEJtV-KmrZuqTkCrSujSIKNKK96mhS8wyOP-cowXSYAxHIE_xlYPoaL1xaPWFSOwW-LIEicQTvWsQL0VMMAbww]steve.brady@r...[/url
Sent: Wednesday, April 28, 2004 4:37 PM
To: basicstamps@yahoogroups.com
Subject: Re: [noparse][[/noparse]basicstamps] How to save an array in memory
What's the purpose of the lowbit part?
Original Message
From: "Jon Williams" <jwilliams@p...>
To: <basicstamps@yahoogroups.com>
Sent: Wednesday, April 28, 2004 4:14 PM
Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
> PBASIC is very flexible, so let me suggest an alternate strategy for
> dealing with your array:
>
> array VAR Word
>
> Now, instead of doing this:
>
> array(x) = some_value
>
> you will do this:
>
> array.LOWBIT(x) = some_value
>
> The nice thing about using the Word declaration is you can manipulate
> all bits at once:
>
> array = 0 ' clear the array
>
> You would need a loop to do this with your declaration.
>
> Now, you can pass this to another slot with PUT and GET:
>
> PUT Location, Word array
>
> Done deal.
>
> -- Jon Williams
> -- Applications Engineer, Parallax
> -- Dallas Office
>
>
>
Original Message
> From: Jack Lindsay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=2ObVBpTwUwfHGRNb1ncMCsyYOpud8A1X0KrFB5FO5x91EqfHmuXHBJJgm57QJgvPM6H_G7EEmd5F1A]jlindsay24@y...[/url
> Sent: Wednesday, April 28, 2004 2:43 PM
> To: basicstamps@yahoogroups.com
> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
>
>
> I have an array
> array VAR BIT(16)
>
> how can I save the entire array in memory to run another slot and then
> come back with the same value.
>
> Is there syntax with GET and PUT to do this or some other way.
>
> Thanks,
> Jack Lindsay
I agree with Jon about using the implicit array. Note that you can
also use an alias for the bits, like this:
array var word
arraybit var array.bit0 ' <-- alias for lowbit of the array.
Then
arraybit(5) = 1 ' set bit 5 of the array
Now, with regard to saving it when you run another bank, maybe you
don't have to do anything! Variables are maintained when crossing
from one bank to another. You just have to be sure that the _word_
variable "array" is defined in the same order in both banks. For
example, if "array" is the third _word_ variable defined in bank 1,
then you must also have it as the 3rd _word_ variable defined in bank
2. That way, the data at that physical location in memory will be
the same and also have the same name in both banks, and there will
not be danger of zapping it inadvertently by putting other data in
that physical location in the main RAM.
Know that all word variables are allocated space in memory ahead of
all bytes, nibs, and bits, in that order of priority. That is why
I emphasize _word_. You can see that when you press CTR<-M and look
at the RAM map screen. When you define a variable as a word, you are
assuring it a place at the top of RAM, so it won't move, and neither
will the bits that make it up.
If you do need to salt away the array in the scratchpad RAM, you can
do it like this:
put savedarray, word array
and later retrieve it
get savedarray, word array
With regard to the order of bits in memory, you can look at it as 208
bits in a row. Or 13 words, or 26 bytes, or 52 nibs. Suppose you
have this:
myword var word
yourword var word
funnybit var myword.bit9 '9th bit of myword
Here is what physical memory looks like:
myword
****yourword****
etc...
0123456789abcdef0123456789abcdef0123456789abcdef --> up to bit 207
^
|
funnybit
Here are some implicit array references that are possible:
myword(0) ' same as myword
myword(1) ' same as yourword
myword(2) ' same as the as yet unnamed group of 16 bits after yourword
funnybit(0) ' same as funnybit, which is myword.bit9
funnybit(1) ' same as myword.bit10
funnybit(22) ' same as yourword.bit15
funnybit(22) ' same as yourword.bit15
funnybit(198) ' the unnamed last bit in the memory array
You see, the array index is based on the size of the underlying
variable (word, byte, nib, bit), and the index refers to a position
that many up in an implicit array of variables of that size. It does
not even matter if the variables have been given a name in your
program. It is just working with respect to the physical array of
RAM memory.
Like Jon says, when you understand the implicit arrays, and that word
variables are defined first, you can do a lot of cool and useful
tricks with the Stamp.
-- Tracy
http://www.emesystems.com/BS2SX.htm#variables
>What's the purpose of the lowbit part?
>
>
>
Original Message
>From: "Jon Williams" <jwilliams@p...>
>To: <basicstamps@yahoogroups.com>
>Sent: Wednesday, April 28, 2004 4:14 PM
>Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
>
>
>> PBASIC is very flexible, so let me suggest an alternate strategy for
>> dealing with your array:
>>
>> array VAR Word
>>
>> Now, instead of doing this:
>>
>> array(x) = some_value
>>
>> you will do this:
>>
>> array.LOWBIT(x) = some_value
>>
>> The nice thing about using the Word declaration is you can manipulate
>> all bits at once:
>>
>> array = 0 ' clear the array
>>
>> You would need a loop to do this with your declaration.
>>
>> Now, you can pass this to another slot with PUT and GET:
>>
>> PUT Location, Word array
>>
>> Done deal.
>>
>> -- Jon Williams
>> -- Applications Engineer, Parallax
>> -- Dallas Office
>>
>>
>>
Original Message
>> From: Jack Lindsay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=5EfBfjgBReZ1Ifms3nOhtNj6Fw0NBjEICBnu79EoX4WhoEa7U56ohG_9iL7SnHWadWPUcfrkn4V6Pw]jlindsay24@y...[/url
>> Sent: Wednesday, April 28, 2004 2:43 PM
> > To: basicstamps@yahoogroups.com
>> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
>>
>>
>> I have an array
>> array VAR BIT(16)
>>
>> how can I save the entire array in memory to run another slot and then
>> come back with the same value.
>>
>> Is there syntax with GET and PUT to do this or some other way.
>>
>> Thanks,
> > Jack Lindsay
>>
>
save what was last recorded. Unless you use a PUT or WRITE.
Jack
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> Hi Jack,
>
> I agree with Jon about using the implicit array. Note that you can
> also use an alias for the bits, like this:
>
> array var word
> arraybit var array.bit0 ' <-- alias for lowbit of the
array.
>
> Then
>
> arraybit(5) = 1 ' set bit 5 of the array
>
> Now, with regard to saving it when you run another bank, maybe you
> don't have to do anything! Variables are maintained when crossing
> from one bank to another. You just have to be sure that the _word_
> variable "array" is defined in the same order in both banks. For
> example, if "array" is the third _word_ variable defined in bank 1,
> then you must also have it as the 3rd _word_ variable defined in
bank
> 2. That way, the data at that physical location in memory will be
> the same and also have the same name in both banks, and there will
> not be danger of zapping it inadvertently by putting other data in
> that physical location in the main RAM.
>
> Know that all word variables are allocated space in memory ahead of
> all bytes, nibs, and bits, in that order of priority. That is
why
> I emphasize _word_. You can see that when you press CTR<-M and
look
> at the RAM map screen. When you define a variable as a word, you
are
> assuring it a place at the top of RAM, so it won't move, and
neither
> will the bits that make it up.
>
> If you do need to salt away the array in the scratchpad RAM, you
can
> do it like this:
> put savedarray, word array
> and later retrieve it
> get savedarray, word array
>
>
> With regard to the order of bits in memory, you can look at it as
208
> bits in a row. Or 13 words, or 26 bytes, or 52 nibs. Suppose you
> have this:
> myword var word
> yourword var word
> funnybit var myword.bit9 '9th bit of myword
>
> Here is what physical memory looks like:
>
>
myword
****yourword****
etc...
> 0123456789abcdef0123456789abcdef0123456789abcdef --> up to bit
207
> ^
> |
> funnybit
>
> Here are some implicit array references that are possible:
>
> myword(0) ' same as myword
> myword(1) ' same as yourword
> myword(2) ' same as the as yet unnamed group of 16 bits
after yourword
> funnybit(0) ' same as funnybit, which is myword.bit9
> funnybit(1) ' same as myword.bit10
> funnybit(22) ' same as yourword.bit15
> funnybit(22) ' same as yourword.bit15
> funnybit(198) ' the unnamed last bit in the memory array
>
> You see, the array index is based on the size of the underlying
> variable (word, byte, nib, bit), and the index refers to a position
> that many up in an implicit array of variables of that size. It
does
> not even matter if the variables have been given a name in your
> program. It is just working with respect to the physical array of
> RAM memory.
>
> Like Jon says, when you understand the implicit arrays, and that
word
> variables are defined first, you can do a lot of cool and useful
> tricks with the Stamp.
>
> -- Tracy
> http://www.emesystems.com/BS2SX.htm#variables
>
>
>
>
>
>
>
>
> >What's the purpose of the lowbit part?
> >
> >
> >
Original Message
> >From: "Jon Williams" <jwilliams@p...>
> >To: <basicstamps@yahoogroups.com>
> >Sent: Wednesday, April 28, 2004 4:14 PM
> >Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
> >
> >
> >> PBASIC is very flexible, so let me suggest an alternate strategy
for
> >> dealing with your array:
> >>
> >> array VAR Word
> >>
> >> Now, instead of doing this:
> >>
> >> array(x) = some_value
> >>
> >> you will do this:
> >>
> >> array.LOWBIT(x) = some_value
> >>
> >> The nice thing about using the Word declaration is you can
manipulate
> >> all bits at once:
> >>
> >> array = 0 ' clear the array
> >>
> >> You would need a loop to do this with your declaration.
> >>
> >> Now, you can pass this to another slot with PUT and GET:
> >>
> >> PUT Location, Word array
> >>
> >> Done deal.
> >>
> >> -- Jon Williams
> >> -- Applications Engineer, Parallax
> >> -- Dallas Office
> >>
> >>
> >>
Original Message
> >> From: Jack Lindsay [noparse][[/noparse]mailto:jlindsay24@y...]
> >> Sent: Wednesday, April 28, 2004 2:43 PM
> > > To: basicstamps@yahoogroups.com
> >> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
> >>
> >>
> >> I have an array
> >> array VAR BIT(16)
> >>
> >> how can I save the entire array in memory to run another slot
and then
> >> come back with the same value.
> >>
> >> Is there syntax with GET and PUT to do this or some other way.
> >>
> >> Thanks,
> > > Jack Lindsay
> >>
> >
important), you can move from one slot to the other without problems.
The easiest way to prevent problems is to copy-and-paste your variable
declarations from one slot to another.
-- Jon Williams
-- Applications Engineer, Parallax
-- Dallas Office
Original Message
From: Jack Lindsay [noparse]/noparse]mailto:[url=http://forums.parallaxinc.com/group/basicstamps/post?postID=0oCaZjVaPjh_c2RANq67H4d9QxFtHeNtfBxesbS117WKHoON4wi0UDwQ1y0kiPOt_Uq5wGBmVxSDTxuJ]jlindsay24@y...[/url
Sent: Thursday, April 29, 2004 4:13 PM
To: basicstamps@yahoogroups.com
Subject: [noparse][[/noparse]basicstamps] Re: How to save an array in memory
I find that when I run a different slot the memory does not always save
what was last recorded. Unless you use a PUT or WRITE. Jack
--- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> Hi Jack,
>
> I agree with Jon about using the implicit array. Note that you can
> also use an alias for the bits, like this:
>
> array var word
> arraybit var array.bit0 ' <-- alias for lowbit of the
array.
>
> Then
>
> arraybit(5) = 1 ' set bit 5 of the array
>
> Now, with regard to saving it when you run another bank, maybe you
> don't have to do anything! Variables are maintained when crossing
> from one bank to another. You just have to be sure that the _word_
> variable "array" is defined in the same order in both banks. For
> example, if "array" is the third _word_ variable defined in bank 1,
> then you must also have it as the 3rd _word_ variable defined in
bank
> 2. That way, the data at that physical location in memory will be
> the same and also have the same name in both banks, and there will
> not be danger of zapping it inadvertently by putting other data in
> that physical location in the main RAM.
>
> Know that all word variables are allocated space in memory ahead of
> all bytes, nibs, and bits, in that order of priority. That is
why
> I emphasize _word_. You can see that when you press CTR<-M and
look
> at the RAM map screen. When you define a variable as a word, you
are
> assuring it a place at the top of RAM, so it won't move, and
neither
> will the bits that make it up.
>
> If you do need to salt away the array in the scratchpad RAM, you
can
> do it like this:
> put savedarray, word array
> and later retrieve it
> get savedarray, word array
>
>
> With regard to the order of bits in memory, you can look at it as
208
> bits in a row. Or 13 words, or 26 bytes, or 52 nibs. Suppose you
> have this:
> myword var word
> yourword var word
> funnybit var myword.bit9 '9th bit of myword
>
> Here is what physical memory looks like:
>
>
myword
****yourword****
etc...
> 0123456789abcdef0123456789abcdef0123456789abcdef --> up to bit
207
> ^
> |
> funnybit
>
> Here are some implicit array references that are possible:
>
> myword(0) ' same as myword
> myword(1) ' same as yourword
> myword(2) ' same as the as yet unnamed group of 16 bits
after yourword
> funnybit(0) ' same as funnybit, which is myword.bit9
> funnybit(1) ' same as myword.bit10
> funnybit(22) ' same as yourword.bit15
> funnybit(22) ' same as yourword.bit15
> funnybit(198) ' the unnamed last bit in the memory array
>
> You see, the array index is based on the size of the underlying
> variable (word, byte, nib, bit), and the index refers to a position
> that many up in an implicit array of variables of that size. It
does
> not even matter if the variables have been given a name in your
> program. It is just working with respect to the physical array of
> RAM memory.
>
> Like Jon says, when you understand the implicit arrays, and that
word
> variables are defined first, you can do a lot of cool and useful
> tricks with the Stamp.
>
> -- Tracy
> http://www.emesystems.com/BS2SX.htm#variables
>
>
>
>
>
>
>
>
> >What's the purpose of the lowbit part?
> >
> >
> >
Original Message
> >From: "Jon Williams" <jwilliams@p...>
> >To: <basicstamps@yahoogroups.com>
> >Sent: Wednesday, April 28, 2004 4:14 PM
> >Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
> >
> >
> >> PBASIC is very flexible, so let me suggest an alternate strategy
for
> >> dealing with your array:
> >>
> >> array VAR Word
> >>
> >> Now, instead of doing this:
> >>
> >> array(x) = some_value
> >>
> >> you will do this:
> >>
> >> array.LOWBIT(x) = some_value
> >>
> >> The nice thing about using the Word declaration is you can
manipulate
> >> all bits at once:
> >>
> >> array = 0 ' clear the array
> >>
> >> You would need a loop to do this with your declaration.
> >>
> >> Now, you can pass this to another slot with PUT and GET:
> >>
> >> PUT Location, Word array
> >>
> >> Done deal.
> >>
> >> -- Jon Williams
> >> -- Applications Engineer, Parallax
> >> -- Dallas Office
> >>
> >>
> >>
Original Message
> >> From: Jack Lindsay [noparse][[/noparse]mailto:jlindsay24@y...]
> >> Sent: Wednesday, April 28, 2004 2:43 PM
> > > To: basicstamps@yahoogroups.com
> >> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
> >>
> >>
> >> I have an array
> >> array VAR BIT(16)
> >>
> >> how can I save the entire array in memory to run another slot
and then
> >> come back with the same value.
> >>
> >> Is there syntax with GET and PUT to do this or some other way.
> >>
> >> Thanks,
> > > Jack Lindsay
> >>
> >
To UNSUBSCRIBE, just send mail to:
basicstamps-unsubscribe@yahoogroups.com
from the same email address that you subscribed. Text in the Subject
and Body of the message will be ignored.
Yahoo! Groups Links
This message has been scanned by WebShield. Please report SPAM to
abuse@p....
--- In basicstamps@yahoogroups.com, "Jack Lindsay" <jlindsay24@y...>
wrote:
> I find that when I run a different slot the memory does not always
> save what was last recorded. Unless you use a PUT or WRITE.
> Jack
>
> --- In basicstamps@yahoogroups.com, Tracy Allen <tracy@e...> wrote:
> > Hi Jack,
> >
> > I agree with Jon about using the implicit array. Note that you
can
> > also use an alias for the bits, like this:
> >
> > array var word
> > arraybit var array.bit0 ' <-- alias for lowbit of the
> array.
> >
> > Then
> >
> > arraybit(5) = 1 ' set bit 5 of the array
> >
> > Now, with regard to saving it when you run another bank, maybe
you
> > don't have to do anything! Variables are maintained when crossing
> > from one bank to another. You just have to be sure that the
_word_
> > variable "array" is defined in the same order in both banks. For
> > example, if "array" is the third _word_ variable defined in bank
1,
> > then you must also have it as the 3rd _word_ variable defined in
> bank
> > 2. That way, the data at that physical location in memory will
be
> > the same and also have the same name in both banks, and there
will
> > not be danger of zapping it inadvertently by putting other data
in
> > that physical location in the main RAM.
> >
> > Know that all word variables are allocated space in memory ahead
of
> > all bytes, nibs, and bits, in that order of priority. That is
> why
> > I emphasize _word_. You can see that when you press CTR<-M and
> look
> > at the RAM map screen. When you define a variable as a word, you
> are
> > assuring it a place at the top of RAM, so it won't move, and
> neither
> > will the bits that make it up.
> >
> > If you do need to salt away the array in the scratchpad RAM, you
> can
> > do it like this:
> > put savedarray, word array
> > and later retrieve it
> > get savedarray, word array
> >
> >
> > With regard to the order of bits in memory, you can look at it as
> 208
> > bits in a row. Or 13 words, or 26 bytes, or 52 nibs. Suppose
you
> > have this:
> > myword var word
> > yourword var word
> > funnybit var myword.bit9 '9th bit of myword
> >
> > Here is what physical memory looks like:
> >
> >
myword
****yourword****
etc...
> > 0123456789abcdef0123456789abcdef0123456789abcdef --> up to
bit
> 207
> > ^
> > |
> > funnybit
> >
> > Here are some implicit array references that are possible:
> >
> > myword(0) ' same as myword
> > myword(1) ' same as yourword
> > myword(2) ' same as the as yet unnamed group of 16 bits
> after yourword
> > funnybit(0) ' same as funnybit, which is myword.bit9
> > funnybit(1) ' same as myword.bit10
> > funnybit(22) ' same as yourword.bit15
> > funnybit(22) ' same as yourword.bit15
> > funnybit(198) ' the unnamed last bit in the memory array
> >
> > You see, the array index is based on the size of the underlying
> > variable (word, byte, nib, bit), and the index refers to a
position
> > that many up in an implicit array of variables of that size. It
> does
> > not even matter if the variables have been given a name in your
> > program. It is just working with respect to the physical array
of
> > RAM memory.
> >
> > Like Jon says, when you understand the implicit arrays, and that
> word
> > variables are defined first, you can do a lot of cool and useful
> > tricks with the Stamp.
> >
> > -- Tracy
> > http://www.emesystems.com/BS2SX.htm#variables
> >
> >
> >
> >
> >
> >
> >
> >
> > >What's the purpose of the lowbit part?
> > >
> > >
> > >
Original Message
> > >From: "Jon Williams" <jwilliams@p...>
> > >To: <basicstamps@yahoogroups.com>
> > >Sent: Wednesday, April 28, 2004 4:14 PM
> > >Subject: RE: [noparse][[/noparse]basicstamps] How to save an array in memory
> > >
> > >
> > >> PBASIC is very flexible, so let me suggest an alternate
strategy
> for
> > >> dealing with your array:
> > >>
> > >> array VAR Word
> > >>
> > >> Now, instead of doing this:
> > >>
> > >> array(x) = some_value
> > >>
> > >> you will do this:
> > >>
> > >> array.LOWBIT(x) = some_value
> > >>
> > >> The nice thing about using the Word declaration is you can
> manipulate
> > >> all bits at once:
> > >>
> > >> array = 0 ' clear the array
> > >>
> > >> You would need a loop to do this with your declaration.
> > >>
> > >> Now, you can pass this to another slot with PUT and GET:
> > >>
> > >> PUT Location, Word array
> > >>
> > >> Done deal.
> > >>
> > >> -- Jon Williams
> > >> -- Applications Engineer, Parallax
> > >> -- Dallas Office
> > >>
> > >>
> > >>
Original Message
> > >> From: Jack Lindsay [noparse][[/noparse]mailto:jlindsay24@y...]
> > >> Sent: Wednesday, April 28, 2004 2:43 PM
> > > > To: basicstamps@yahoogroups.com
> > >> Subject: [noparse][[/noparse]basicstamps] How to save an array in memory
> > >>
> > >>
> > >> I have an array
> > >> array VAR BIT(16)
> > >>
> > >> how can I save the entire array in memory to run another slot
> and then
> > >> come back with the same value.
> > >>
> > >> Is there syntax with GET and PUT to do this or some other way.
> > >>
> > >> Thanks,
> > > > Jack Lindsay
> > >>
> > >
bytes of general purpose variable storage. So does the BS2SX. So
does the BS2p, the BS2e and the BS2pe. In other words, no matter
which flavor of BS2 you have, there are only 26 bytes available for
declared variables. For the multi-slot Stamps, each of the eight
program slots uses those same 26 bytes--there is not a separate bank
of 26 bytes assigned to each slot. That's why one program slot can
clobber variables used by another, and why you must declare variables
in the same order when using them in multiple program slots.
Sorry if this is already clear to everybody, but some of the
questions seem to overlook or misunderstand this.
Regards,
Steve