Post Reply 
[HP48] Memory Management
10-27-2014, 10:08 PM (This post was last modified: 10-27-2014 10:18 PM by Han.)
Post: #8
RE: [HP48] Memory Management
You'd be much better off using a list of arrays saved inside USEROB. Since EXTRA is going to have to be a pre-determined size, you may as well reserve a fixed amount of space in USEROB but leave it in the form of a list of arrays.

Code:

DOLIST (5 nibbles)
  DOARRAY (5 nibbles) + <len> + <prologue> + <dimcount> + <dimsize> + data_nibbles
  DOARRAY ...
  DOARRAY ...
  DOHSTR ...
SEMI (5 nibbles)

You can modify each array's length, prologue, dimcount, and dimsize easily through assembly language. All those parameters are easily calculated. A call to MOVEUP or MOVEDN will easily allow moving large chunks of data within the memory space between DOLIST and SEMI. The last object should be a string which could simply be the "extra" that contains useless data.

With this technique, you don't have to bother with variables. The only limitation would be the total RAM that you pre-allocate -- which would be the case for Claudio's idea as well. As long as you pre-allocate sufficient memory, you can also have as few or as many arrays as you want. Just make sure there is enough "extra" space in the string at the end of the list. Lastly, you can access the arrays easily with regular RPL via GET. Nothing should be copied to TEMPOB since it can be referenced via a pointer into USEROB. When you store your new data, you simply contract/expand the string to adjust for the change in the modified array, move the existing arrays (if necessary) via MOVEUP/MOVEDN and then insert the modified array (all done via assembly, though).

If you don't want users to accidentally mess with the contents via UserRPL commands, you can optionally embed everything inside a library object. However, access to the contents will require a custom program to extract the data from the library object (you can simply push a pointer to the embedded array).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
[HP48] Memory Management - Bruno - 10-24-2014, 12:34 PM
RE: [HP48] Memory Management - Claudio L. - 10-24-2014, 04:48 PM
RE: [HP48] Memory Management - Bruno - 10-27-2014, 10:12 AM
RE: [HP48] Memory Management - Claudio L. - 10-27-2014, 12:04 PM
RE: [HP48] Memory Management - Paul Dale - 10-27-2014, 10:18 AM
RE: [HP48] Memory Management - Bruno - 10-27-2014, 01:15 PM
RE: [HP48] Memory Management - Han - 10-27-2014 10:08 PM
RE: [HP48] Memory Management - Bruno - 10-29-2014, 10:15 PM



User(s) browsing this thread: 1 Guest(s)