Shop OBEX P1 Docs P2 Docs Learn Events
Work-around for expanding program memory on the BS2 — Parallax Forums

Work-around for expanding program memory on the BS2

achilles03achilles03 Posts: 247
edited 2005-02-20 22:12 in BASIC Stamp
We all know the eeprom can't be expanded beyond it's current 2k, but as a thought exersize, I was wondering if this is possible... Could a program be written on the BS2 that would access tokenized instructions on another eeprom, write them on the BS2's eeprom, and then have a GOTO or GOSUB command that would go to the beginning address of those new instructions? After completing the instructions, the BS2 could go back to retreiving and re-writing the next set of tokenized commands from an external eeprom...

Would this work?

Dave

Comments

  • GadgetmanGadgetman Posts: 2,436
    edited 2005-02-19 15:59
    Not on a stock BS2, no.

    The reason is that the tokens aren't stored sequentially.
    At the highest part of the address space is some sort of jump table which must match up with certain parts of your program.
    (All kinds of jumps)

    The only way to expand the memory is to use the BS2p and BS2pe models
    There, though, there's nothing stopping you from overwriting a bank with tokens stored on an external EEPROM or any other storage device you want, then use the RUN command to execute that code.

    The BS2e and BS2sx, while they also have MultiBank functions, won't allow you to read and write to other banks than the one your program is currently running in.

    It's a nice thought exercise, but here's another...
    How do you manage to fill the program space of an BS2p or BS2pe?

    smile.gif
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-19 22:44
    Actually this discussion has been brought up many times in the past, and I believe it has been done.· However, the effort made it seem like more trouble than it's worth.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
  • kelvin jameskelvin james Posts: 531
    edited 2005-02-19 23:26
    Gadgetman said...
    How do you manage to fill the program space of an BS2p or BS2pe?


    I had to give some long thought as to what i had to OMIT function wise, because i simply could not fit it on a bsp.
    Each bank is almost full, and i am still looking at ways to consolidate some of the code to sqeeze in a little more. It depends on the application and the devices that are interfaced, some require more space for code. Part of the problem is variable space, only so much per program bank, then have to move to a new one to basically do the same thing.
    kelvin
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-19 23:40
    You could try re-using some of your variables if this is possible in your program.· Often times in a program I will have a couple of work variables that I will use in multiple routines.· For example, perhaps I need to read some data from EEPROM and display to the LCD.· In another routine I may need to get user input form the keypad.· At least 2 variables are used in both routines, and one of those is also used in yet another routine.

    As for program code, sometimes I see people writing code like:

    OUTPUT 0
    OUTPUT 1
    OUTPUT 2
    OUTPUT 3
    INPUT 4
    INPUT 5
    HIGH 0
    LOW 1
    LOW 2
    HIGH 3
    

    When the same block of code could've been done with:

    DIRS = %001111
    OUTS = %1001
    

    For beginners, the first block of code may be easier to understand, and some would recommend that, but once you're filling the memory up it's time to start learning to streamline your code a little.· If you posted some of it, you might get some feedback on how to go about doing this.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
  • kelvin jameskelvin james Posts: 531
    edited 2005-02-20 07:18
    Thankyou for the input Chris. I have read numerous posts, gone through the manual, tried inventing my own methods, but no results. Some i have implemented and have helped. I use a lot of serial commands, and for some reason they take a lot of program space, especially the serial lcd output. Sratchpad doesn't help either, as i need the values stored on powerdown. I guess part of the problem is me, i have seen a ton of potential in the operation aspect, and just want to add more. If i figure there is a paticular function that would be useful, it should be there to use. Timing is an issue with this this, so looping, gosub, etc. only complicates things. And i have had to use some of it, at the expense of speed. The code is "device dependant", so posting it won't help. Can Parallax supply an interfaceable co-processor, please?
    Anyway Chris, i see that you are into the music/amplification thing. I have been in and out of the scene for the past 30 years, and have enjoyed every minute of it. Actually, i have an old Ampeg VT22 amp right beside me, 100 watts of real tube power, one of the original models released. Maybe a stamp equalizer control for it ?
    kelvin
  • GadgetmanGadgetman Posts: 2,436
    edited 2005-02-20 12:37
    Could you post a section or two that pertains to the serial commands?

    And the bank switching routines you're using wouldn't hurt, either.

    heck, post everything and let us take a peek...
    (But make certain it's stuffed full of comments and explanations)
    we might be able to spot something.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-02-20 22:12
    Kelvin,

    ·· I'm sorry my recommendations didn't help.· One more that I was going to offer you, you appear to have already tried (Placing the serial statements and such in sub-routines).

    ·· As for the audio/music stuff...Yes, I used to build Audio/Video controllers/switches using 6502 or Z80 CPUs to control it.· Of course, back then there were no easy solutions.· Most of the chips that could do most of the work were very complicated to interface to and control.

    ·· Later there seemed to be a slew of I2C & 1-Wire chips for Audio/Video, but many were discontinued, I think because they catered to the hobbyist, and not production (Maybe cost?).· I still see a few things around, but it's been slow lately.· I actually broke down and bought an amplifier for the DJ Business about 6 months ago because I didn't have time to wait until I could get a suitable one constructed.



    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    --==<{Chris}>==--
Sign In or Register to comment.