Mutlibank Infrastructure
Bullwinkle
Posts: 101
The project I was working on kinda stalled after I ran outa RAM on the BS2. So I got a BS2e. Sure, it has 16K of RAM, but when I discovered it was actually 8 2K banks, my brain kinda seized up. I've never programmed on such a whacky memory architecture before, and even with a few pointers, was kinda daunted.
Anyhow, using ideas on this forum I have built an inrfastructure that will allow me to more easily utilise the full potential to the BS2e. It's basically a simple stack analogy, where you write the function "address" , and the return address then execute the actual jump. For the BS2e I have utilised 4 nibble variables nRunFunction and nRunSlot specify a function in a slot to execute and nRetFunction and nRetSlot specifies the return function and slot.
In order to manage memory, I have specified that the bottom 18 bytes of RAM are available to every bank. The top 8 bytes are specific to the current bank and are saved to scratchpad RAM before running another slot and restored from scratch pad RAM on return. The only problem here is the top slot ( slot 7 ) only gets 7 bytes since location 63 contains the read-only "current slot" value. Grrr....
I have also written a few simple scripts to enable easy compilation ( on Linux ). Each program consists of a common header and footer file, these are included with each slot during compilation to ensure the same global definitions are compiled into the bottom 18 bytes of RAM and common subroutines are easily catered for. The program itself consists of 8 units, each one has it's own slot value appended to it.
Anyhow, I have attached the my 8 slot "Hello World" program for your enjoyment. The scripts will only be valuable to Linux users, but I attached them anyway.
I'm glad I finally got a clean infrastructure going! I have left some of the debugging code in to clearly show the interaction between each slot and the SPRAM. I hope someone can find it useful.
Steve
Post Edited (Bullwinkle) : 4/23/2007 4:43:50 AM GMT
Anyhow, using ideas on this forum I have built an inrfastructure that will allow me to more easily utilise the full potential to the BS2e. It's basically a simple stack analogy, where you write the function "address" , and the return address then execute the actual jump. For the BS2e I have utilised 4 nibble variables nRunFunction and nRunSlot specify a function in a slot to execute and nRetFunction and nRetSlot specifies the return function and slot.
In order to manage memory, I have specified that the bottom 18 bytes of RAM are available to every bank. The top 8 bytes are specific to the current bank and are saved to scratchpad RAM before running another slot and restored from scratch pad RAM on return. The only problem here is the top slot ( slot 7 ) only gets 7 bytes since location 63 contains the read-only "current slot" value. Grrr....
I have also written a few simple scripts to enable easy compilation ( on Linux ). Each program consists of a common header and footer file, these are included with each slot during compilation to ensure the same global definitions are compiled into the bottom 18 bytes of RAM and common subroutines are easily catered for. The program itself consists of 8 units, each one has it's own slot value appended to it.
Anyhow, I have attached the my 8 slot "Hello World" program for your enjoyment. The scripts will only be valuable to Linux users, but I attached them anyway.
I'm glad I finally got a clean infrastructure going! I have left some of the debugging code in to clearly show the interaction between each slot and the SPRAM. I hope someone can find it useful.
Steve
Post Edited (Bullwinkle) : 4/23/2007 4:43:50 AM GMT
Comments
I plan to develop a "make" like facility soon, that compares the last modified data of each .o file with that of it's corrosponing source file and only compile and upload the program slots that have been edited recently.
If anyone would like a copy of that script let me know.
Post Edited (Bullwinkle) : 4/23/2007 4:44:37 AM GMT