Shop OBEX P1 Docs P2 Docs Learn Events
Clearing Ram — Parallax Forums

Clearing Ram

ArchiverArchiver Posts: 46,084
edited 2001-12-11 16:03 in General Discussion
Hello,

I'm switching between program banks for the first time, and I'm wondering if
there is an easy way to clear all the variable space ram to 0 so I can start
fresh when the program switches over?

Thanks,
stewart


--
Stewart Mayer, stewlist@k... on 12/10/2001

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2001-12-10 23:25
    In a message dated 12/10/01 4:25:14 PM Central Standard Time,
    stewlist@k... writes:


    > I'm switching between program banks for the first time, and I'm wondering if
    > there is an easy way to clear all the variable space ram to 0 so I can
    > start
    >


    This little routine takes advantage of the Stamp's flexibility with memory
    indexing.

    ram VAR Word

    FOR ram = 1 TO 12
    ram(ram) = 0
    NEXT
    ram = 0

    -- Jon Williams
    -- Parallax


    [noparse][[/noparse]Non-text portions of this message have been removed]
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-11 14:08
    Wonderful!

    Thanks,
    Stewart

    On Mon, 10 Dec 2001 18:25:03 EST, jonwms@a... wrote:
    >In a message dated 12/10/01 4:25:14 PM Central Standard Time,
    >stewlist@k... writes:
    >
    >
    >>I'm switching between program banks for the first time, and I'm wondering if
    >>there is an easy way to clear all the variable space ram to 0 so I can
    >>start
    >>
    >
    >
    >This little routine takes advantage of the Stamp's flexibility with memory
    >indexing.
    >
    >ram VAR Wordx
    >
    >FOR ram = 1 TO 12
    >ram(ram) = 0
    >NEXT
    >ram = 0
    >
    >-- Jon Williams
    >-- Parallax
    >
    >
    >[noparse][[/noparse]Non-text portions of this message have been removed]
    >
    >
    >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.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
    >
    >


    --
    Stewart Mayer, stewlist@k... on 12/11/2001
  • ArchiverArchiver Posts: 46,084
    edited 2001-12-11 16:03
    Glad you like it. After sending the message, I thought that a small change
    would be a good idea. Here's the updated version:

    ram VAR W0

    FOR ram = 1 TO 12
    ram(ram) = 0
    NEXT
    ram = 0

    The other version of the program could give you grief if there was a word
    variable defined before "ram." By using aliasing of the internal variable
    name W0, this new version is guaranteed to work, no matter what other
    variables you have defined or in what order.

    -- Jon Williams
    -- Parallax


    In a message dated 12/11/01 8:07:51 AM Central Standard Time,
    stewlist@k... writes:


    > Wonderful!
    >
    > Thanks,
    > Stewart
    >
    > On Mon, 10 Dec 2001 18:25:03 EST, jonwms@a... wrote:
    > >In a message dated 12/10/01 4:25:14 PM Central Standard Time,
    > >stewlist@k... writes:
    > >
    > >
    > >>I'm switching between program banks for the first time, and I'm wondering
    > if
    > >>there is an easy way to clear all the variable space ram to 0 so I can
    > >>start
    > >>
    > >
    > >
    > >This little routine takes advantage of the Stamp's flexibility with memory
    > >indexing.
    > >
    > >ram VAR Wordx
    > >
    > >FOR ram = 1 TO 12
    > >ram(ram) = 0
    > >NEXT
    > >ram = 0
    > >
    > >-- Jon Williams
    > >-- Parallax
    >




    [noparse][[/noparse]Non-text portions of this message have been removed]
Sign In or Register to comment.