Shop OBEX P1 Docs P2 Docs Learn Events
Memory Overlay Idea.. — Parallax Forums

Memory Overlay Idea..

Kaos KiddKaos Kidd Posts: 614
edited 2006-01-03 18:22 in BASIC Stamp
Ok... I'm sure someone else has thought of this idea, but I cant seem to see it listed here and about...
An Overlay Memory approch to BS2's memory limitations..
Remember bback in the days of DOS... where all DOS could see and use was 1 Meg
(Sounds like the 8K limit in the BS2)... Anyway, we used a program to manage that..
and software would do something like this...
load in some code... stuff in into a page in upper memory...
load in some more code... stuff into a page in upper memory...
Now I know my BS2P's got 8 slots... and when the code gets just so large...
the idea is to take the "tokenized code" from a slot and offload it into an eeprom..
and then download "tokenized code" into the "freed" slot then execute it...
I could see it would require a "loader" program in the BS2...
... INIT...
... Get Source Code slot and Length...
... Open EEProm MemoryMap bytes, get the next available byte..
... start writing the code from slot one for XX length into eeprom starting at available byte...
... update the eeprom memorymap bytes to indicate the next available byte...
And I could invision the code in each program...
Something with a map of the routines stored in EE, and their size...
Reading that into a Slot... executing it... then returning back...
Ok bosses and gods of the stamps... is this "dooable" or pipe dreams?
It would be a ...
I could well imagin... with good memory managment skills, one could literly create a self modfying program...
as long as the code, offsets, locations are correct...· Gosh, I remember doing that on the C64...


▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

Until our bytes cross again, may your chips never smoke, your bits never fall off, your parts bin never be empty and your jumpers never fall off.
KK
·

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-01-03 03:30
    KaosKidd -

    Doing what you suggest with an interpretive language (such as PBASIC) would make it so slow as to be practically useless. Presently the time used merely to interpret the tokens can be a stumbling block which cause some folks to have to go to a faster Stamp platform as it is, just so that effect isn't so great. This "advantage" is due to the faster execution speeds of the more advanced processors which are built on the Ubicomm core.

    If the MicroChip PIC had been designed to execute code in external memory (which it wasn't), or in "shadow memory" this problem wouldn't exist. The real problem is with the underlying processor, not with the Stamp or the Stamp development system. Indeed Parallax overcame this hardware shortcoming by begining to use a different underying processor, starting with the BS-2SX. It, and all of the other more advanced Stamp processors, use the Ubicom chip as a base.

    OTOH, if you CAN come up with such a "paging" or "overlay" system which will operate on a MicroChip PIC processor, and do so at an acceptable execution speed, with about 99.98% reliability, I'm SURE Parallax and many other companies would LOVE to hear about it. You could make yourself a small FORTUNE overnight!

    However, since microcontrollers generally operate without an operating system, you might find it more difficult than you might imagine. Even the venerable C64 you mention had an operating system, and also a Motorola chip which DID allow external memory addressing (as I remember).

    Regards,

    Bruce Bates
  • DonDon Posts: 34
    edited 2006-01-03 06:14
    It's probably way too much overhead on a system that is already limited.· Perhaps it is time to consider switching to a different processor.· There are many choices, both from Parallax and elsewhere.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Don Kinzer

    ZBasic Microcontrollers
    http://www.zbasic.net
    ·
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-01-03 15:19
    In testing, I've discovered I need to know a whole lot more about the banking (aka slots) in the bs2p.
    The C64 (and C128 for that matter), could only page ram within it's 64K. ( just like EMM386 did in the long lost and loving days of DOS.. [noparse]:)[/noparse]
    Quickie for you... I take it the BS2SX has 'improved' memory managment as compaired to my bs2P40?
    (Like I said, I need to learn a whole lot more about my stamp...)
    KK

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Until our bytes cross again, may your chips never smoke, your bits never fall off, your parts bin never be empty and your jumpers never fall off.
    KK
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-03 15:25
    KaosKidd said...(trimmed)
    In testing, I've discovered I need to know a whole lot more about the banking (aka slots) in the bs2p.
    The C64 (and C128 for that matter), could only page ram within it's 64K. ( just like EMM386 did in the long lost and loving days of DOS.. [noparse]:)[/noparse]
    Quickie for you... I take it the BS2SX has 'improved' memory managment as compaired to my bs2P40?
    The C64/128 had an 8-bit CPU with a 16-bit Address Bus that limited it to 64K.· This was the same with the Z80 as far as memory goes.· At least in the case of the C64/128 you could switch out the ROM and have access to the full 64K RAM.

    Now, as for the SX having improved memory management...There is no memory management on the BASIC Stamps.· In fact, the BS2p is faster and has more ScratchPad RAM than the BS2sx.· It also draws less current due to the slower clock speed (It runs in Turbo mode).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • Kaos KiddKaos Kidd Posts: 614
    edited 2006-01-03 16:20
    Yes...
    That would be the shadowing...
    Its been years, but I remember copying the basic roms into ram, then changing (poking!) the register to run from ram...
    Ok... so the stamps dont have that capability, and the time to "move" code from off chip into the chip's address space is long..
    Well, I thought I had a winner [noparse]:)[/noparse]

    THanks !

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔

    Until our bytes cross again, may your chips never smoke, your bits never fall off, your parts bin never be empty and your jumpers never fall off.
    KK
    ·
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2006-01-03 18:22
    KK,

    ·· Not to shoot down your idea...The conceot is there, but maybe you need to look at it more from a CHAINing aspect than OVERLAY.· Since you have the extra slots, you can simply jump from program to program, much more like the Commodore Amiga BASIC did.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
Sign In or Register to comment.