Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.sys.acorn.programmer > #6716 > unrolled thread

Wimp_SlotSize questions

Started byBob Latham <bob@sick-of-spam.invalid>
First post2026-10-28 12:41 +0000
Last post2026-10-28 17:41 +0100
Articles 5 — 4 participants

Back to article view | Back to comp.sys.acorn.programmer


Contents

  Wimp_SlotSize questions Bob Latham <bob@sick-of-spam.invalid> - 2026-10-28 12:41 +0000
    Re: Wimp_SlotSize questions Martin <News04@avisoft.f9.co.uk> - 2026-10-28 13:21 +0000
    Re: Wimp_SlotSize questions Theo <theom+news@chiark.greenend.org.uk> - 2026-10-28 13:28 +0000
      Re: Wimp_SlotSize questions Bob Latham <bob@sick-of-spam.invalid> - 2026-10-28 14:52 +0000
        Re: Wimp_SlotSize questions Jean-Michel <jmc.bruck@orange.fr> - 2026-10-28 17:41 +0100

#6716 — Wimp_SlotSize questions

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-10-28 12:41 +0000
SubjectWimp_SlotSize questions
Message-ID<5d2eda27cdbob@sick-of-spam.invalid>
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.

[toc] | [next] | [standalone]


#6717

FromMartin <News04@avisoft.f9.co.uk>
Date2026-10-28 13:21 +0000
Message-ID<5d2edde289News04@avisoft.f9.co.uk>
In reply to#6716
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. 

[toc] | [prev] | [next] | [standalone]


#6718

FromTheo <theom+news@chiark.greenend.org.uk>
Date2026-10-28 13:28 +0000
Message-ID<bUy*A4hUA@news.chiark.greenend.org.uk>
In reply to#6716
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

[toc] | [prev] | [next] | [standalone]


#6719

FromBob Latham <bob@sick-of-spam.invalid>
Date2026-10-28 14:52 +0000
Message-ID<5d2ee63733bob@sick-of-spam.invalid>
In reply to#6718
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.

[toc] | [prev] | [next] | [standalone]


#6720

FromJean-Michel <jmc.bruck@orange.fr>
Date2026-10-28 17:41 +0100
Message-ID<c424f02e5d.jmb@jmc.bruck.orange.fr>
In reply to#6719
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.sys.acorn.programmer


csiph-web