RP2350 PSRAM: how to wire, how to use?


Author Message
EDNEDN
Guru

Joined: 18/02/2023
Location: United States
Posts: 309
Posted: 03:13pm 25 Aug 2024      

  matherp said  
Next comes the question of how to make the additional RAM available to the MMBasic user. My current thoughts are to keep this simple and just provide routines to copy to/from physical PSRAM addresses into MMBasic arrays and also provide routines to load/store PSRAM from disk.


If I was doing the work to support the PSRAM, I would be tempted to do it using the Dim statement.   Probably something like:

Dim X(5000,100,2) In_PSRAM

From a logistical perspective, the easy and most natural way to use large blocks of memory is via arrays.   So to my way of thinking, it would be very natural for someone writing an MMBasic program to flag that a particularly large array should be located in PSRAM.    Other than marking an item as In_PSRAM all of the program logic (and syntax) would be the same.

I would add a PSRAM type or flag to the  s_vartbl.type field.

typedef struct s_vartbl {                               // structure of the variable table
unsigned char name[MAXVARLEN];                  // variable's name
unsigned char type;  
       ...  }

and as a variable is evaluated, it would be clear to the MMBasic interpreter code where in memory the item is located and how to access it.


Incidentally, DEC's Basic+ on RSTS/E OS's on the PDP-11's had something very similar to what I'm describing.   Using the Dim statement the programmer could position the array into a disk file instead of core memory.   All of the remaining logic in the program that accessed the array was identical.   Where the storage actually existed for the array was controlled by the Dim statement.   All of the other program logic was identical and did not care where the storage actually manifested itself.    Section 11-1 of http://elvira.stacken.kth.se/rstsdoc/rsts-doc-v70/v7.0-v3-a-dec-11-orbpb-b-d_basic_plus_language_manual.pdf describes the Basic+ syntax for doing this.
Edited 2024-08-26 02:00 by EDNEDN