Shop OBEX P1 Docs P2 Docs Learn Events
Using the write function and overwriting variables — Parallax Forums

Using the write function and overwriting variables

ArchiverArchiver Posts: 46,084
edited 2004-04-21 05:46 in General Discussion
If you use a write function on say slot 4 could you mistakenly
overwrite memory on slot 3.
Thanks,
Jack Lindsay

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2004-04-20 20:38
    In a message dated 4/20/2004 3:26:40 PM Eastern Daylight Time,
    jlindsay24@y... writes:


    > If you use a write function on say slot 4 could you mistakenly
    > overwrite memory on slot 3.
    >

    Each slot has 2K memory. You can use the lower portion of memory on any slot
    without endangering data written to the same area in other 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]
  • ArchiverArchiver Posts: 46,084
    edited 2004-04-21 05:46
    >If you use a write function on say slot 4 could you mistakenly
    >overwrite memory on slot 3.
    >Thanks,
    >Jack Lindsay

    I think you are asking this with respect to a BS2p.

    You would certainly not overwrite the memory in slot 3 once you have
    issued the STORE 4 command. Once you have issued the STORE 4
    command, all subsequent writes will be to slot 4 until, 1) you issue
    a STORE n command to a different slot or 2) you issue a RUN command
    to move program execution to another slot.

    When you issue a RUN command, the storage follows suit, and initially
    writes will be to that same bank as was RUN. You then need a STORE n
    command to point the READS and WRITES to another bank.

    You can implement bank-neutral subroutines. For example, suppose you
    need a subroutine to store something in bank 4, but you want this
    subroutine not to affect the STORage pointer that is in effect when
    the subroutine is called:
    my_subroutine:
    GET 127, holderVar ' reads the current store and run status
    STORE 4
    PUT location, mydata
    STORE holderVar.NIB1 ' restores the entry STORE bank status
    RETURN

    You didn't ask about that, but know that location 127 in the
    scratchpad is read-only, and always contains the current RUN and
    STORE banks in nib0 and nib1 respectively.

    One of your initial questions was about using the BS2e as a data
    logger, and now you are looking at the BS2p. Take a look too at the
    BS2pe, because it has even more memory, 32k compared to 16k in the
    BS2p, and other features that are great for data logging.
    <http://www.emesystems.com/BS2pe.htm> .

    -- Tracy
Sign In or Register to comment.