🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.sys.acorn.programmer
5 messages
5 total messages Started by Bob Latham Wed, 28 Oct 2026 12:41
Wimp_SlotSize questions
#1
Author: Bob Latham
Date: Wed, 28 Oct 2026 12:41
21 lines
1348 bytes
In my RISCOS 3 PRMs page 3-206 it says you can change the slot size
of the current slot by setting a value in register 0.

At the bottom of that same page it also says - No tasks should set
their current slot size,: normally, a new task will call *wimpslot
which then calls Wimp_SlotSize.

To my simple brain that is a major contradiction and I don't
understand it at all.

Say I need to obtain some temporary extra memory for a sort buffer,
can extend the slot using this call, do the sort work and reduce the
slot size again?

Can someone clarify for me please?

Thanks.

Bob.
Re: Wimp_SlotSize questions
#2
Author: Martin
Date: Wed, 28 Oct 2026 13:21
40 lines
2762 bytes
In article <5d2eda27cdbob@sick-of-spam.invalid>,
   Bob Latham <bob@sick-of-spam.invalid> wrote:

> In my RISCOS 3 PRMs page 3-206 it says you can change the slot size
> of the current slot by setting a value in register 0.

> At the bottom of that same page it also says - No tasks should set
> their current slot size,: normally, a new task will call *wimpslot
> which then calls Wimp_SlotSize.

> To my simple brain that is a major contradiction and I don't
> understand it at all.

I think the clue is in 'normally', as it is normal for a task to be
started just after a WimpSlot command in a !Run file, and that can be
easily changed if more or less is required for the task to run.

It is more unusual for tasks to want to change their slotsize, but
many do use SYS Wimp_Slotsize where variable storage is required.

> Say I need to obtain some temporary extra memory for a sort buffer,
> can extend the slot using this call, do the sort work and reduce the
> slot size again?

That would certainly work ... but it may depend on what language you
are using if that is the best way.

If you are using BASIC, then beware that it will not adjust HIMEM, so
the space is not simply usable from BASIC - but can certainly be used.
It may be better using END=, which changes the SlotSize and adjusts
HIMEM, but there are some restrictions when it can be used.

If you are using BASIC and sorting arrays, then you should look at my
ArmSort module from http://www.avisoft.f9.co.uk/ which makes sorting
very easy.

-- 
Martin Avison 
Note that unfortunately this email address will become invalid
without notice if (when) any spam is received. 
Re: Wimp_SlotSize questions
#4
Author: Theo
Date: Wed, 28 Oct 2026 13:28
47 lines
3139 bytes
Bob Latham <bob@sick-of-spam.invalid> wrote:
> 
> In my RISCOS 3 PRMs page 3-206 it says you can change the slot size
> of the current slot by setting a value in register 0.
> 
> At the bottom of that same page it also says - No tasks should set
> their current slot size,: normally, a new task will call *wimpslot
> which then calls Wimp_SlotSize.
> 
> To my simple brain that is a major contradiction and I don't
> understand it at all.
> 
> Say I need to obtain some temporary extra memory for a sort buffer,
> can extend the slot using this call, do the sort work and reduce the
> slot size again?
> 
> Can someone clarify for me please?

That bit was always confusing.  I think what it's trying to say is don't use
Wimp_SlotSize instead of *Wimpslot for setting the slot size for a new app. 
ie you should set it in your !Run file via *WimpSlot rather than in your
!RunImage.

For example in BASIC you might start with by default (for example) 640k and
then try to expand via Wimp_SlotSize, but by that point the BASIC stack is
set up at the 640k marker and changing Wimp_SlotSize later doesn't alter
that, so you risk running out of stack and heap if you did it that way.

AFAIAA it's fine to use Wimp_SlotSize to manipulate your slot at runtime as
you suggest.  BASIC would be unaware of any memory above END (set to your
starting slot) so you would need your own allocator for memory above it.  If
you are just using that for a single buffer then such an allocator is
trivial.

Norcroft C supports chunked stacks so in theory it would be possible to add
new stack frames in the expanded space above where the stack originally
started from.  I'm not sure if that would actually happen in practice. 

Likewise I'm not sure what other memory allocators would do; I believe
'flex' and maybe the SharedCLibrary are able to expand the slot according to
their own requirements, but I'm a bit hazy on the details.  I suspect they
may be surprised if you expand the slot behind their back, but only if they
tried to expand due to running out of memory.  If you don't run out of heap
memory, it's likely fine to extend the slot behind their back and then do
your own allocations within it.

Theo
Re: Wimp_SlotSize questions
#3
Author: Bob Latham
Date: Wed, 28 Oct 2026 14:52
20 lines
1504 bytes
In article <bUy*A4hUA@news.chiark.greenend.org.uk>,
   Theo <theom+news@chiark.greenend.org.uk> wrote:
> Bob Latham <bob@sick-of-spam.invalid> wrote:

> > Can someone clarify for me please?

> That bit was always confusing.

Thank you Martin and Theo. I think I can have a play now.

I should have said, I'm still insane enough to enjoy coding in Basic
assembler. My only defence is that this is only a hobby. I would love
to start doing some 'C' I've purchased to suite to do it but just
can't figure it out, It's not C so much as RISCOS C and all the tools
and paraphernalia. Same with the toolbox still can't grasp it.

Thanks again.

Bob.
Re: Wimp_SlotSize questions
#6
Author: Jean-Michel
Date: Wed, 28 Oct 2026 16:41
15 lines
1836 bytes
In message <5d2ee63733bob@sick-of-spam.invalid>
          Bob Latham <bob@sick-of-spam.invalid> wrote:

> I should have said, I'm still insane enough to enjoy coding in Basic
> assembler. My only defence is that this is only a hobby. I would love
> to start doing some 'C' I've purchased to suite to do it but just
> can't figure it out, It's not C so much as RISCOS C and all the tools
> and paraphernalia. Same with the toolbox still can't grasp it.

Steve Fryatt's tutorial is very good for building applications in C.
RSSC has updated !Sourcery, also a very good tool.


-- 
Jean-Michel
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads