stardot / MatrixBrandy

Matrix Brandy BASIC VI for Linux, Windows, MacOSX
http://brandy.matrixnetwork.co.uk/
44 stars 8 forks source link

RISC OS build claim memory on startup #49

Closed jgharston closed 4 years ago

jgharston commented 5 years ago

The current RISC OS build needs a wimp slot set before the binary is run, typically: WimpSlot 1200K /.brandyRO

The binary is about 440K, which is smaller than the default 640K wimpslot, so there should be a way for the binary itself to claim the amount of memory it needs (and is 640K-440K=200K really too little to run?). I've tried doing this, the code is commented out and maked "I can't get this working".

soruk42 commented 5 years ago

Brandy also requests a workspace of about 640K - perhaps on RISC OS we can default it to something smaller, such as 128K?

Edit: This is DEFAULTSIZE, in target.h line 302.

soruk42 commented 5 years ago

Further - minimum workspace requestable is 16K.

jgharston commented 5 years ago

On 20-08-2019 15:20, Michael McConnell wrote:

Further - minimum workspace requestable is 16K.

Yes, native ARM BASIC examines the available memory and only bombs out if there's less than 8K or so (off the top of my head).

-- J.G.Harston - jgh@mdfs.net - mdfs.net/jgh

soruk42 commented 4 years ago

It seems that on both 26-bit and 32-bit builds, malloc() (or its equivalent) is doing the right thing, growing the WimpSlot on 26-bit, or using a dynamic area on 32-bit. But, even making a build with just 16K memory by default, it still needs quite a big WimpSlot just for the binary to begin running. On the website I have zip files of both builds, packaged as RISC OS applications so WimpSlot is set there, and can multitask via !GraphTask if available.

soruk42 commented 3 years ago

Coming back to this, it looks to me like the WimpSlot needs to be the right size just to allow the binary to load and start executing. Once it is running, the binary can malloc() whatever it needs. Every RISC OS multitasking application also requires its own WimpSlot setting in !Run, so perhaps this behaviour is to be expected.

My RISC OS builds and downloads are packaged in applications, which grab a WimpSlot and will run in !GraphTask if available, else it will single-task.