• Wimp_SlotSize questions

    From Bob Latham@bob@sick-of-spam.invalid to comp.sys.acorn.programmer on Wed Oct 28 12:41:15 2026
    From Newsgroup: comp.sys.acorn.programmer


    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.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Martin@News04@avisoft.f9.co.uk to comp.sys.acorn.programmer on Wed Oct 28 13:21:59 2026
    From Newsgroup: comp.sys.acorn.programmer

    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.
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Theo@theom+news@chiark.greenend.org.uk to comp.sys.acorn.programmer on Wed Oct 28 13:28:09 2026
    From Newsgroup: comp.sys.acorn.programmer

    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
    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Bob Latham@bob@sick-of-spam.invalid to comp.sys.acorn.programmer on Wed Oct 28 14:52:58 2026
    From Newsgroup: comp.sys.acorn.programmer

    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.

    --- Synchronet 3.22a-Linux NewsLink 1.2
  • From Jean-Michel@jmc.bruck@orange.fr to comp.sys.acorn.programmer on Wed Oct 28 17:41:25 2026
    From Newsgroup: comp.sys.acorn.programmer

    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
    --- Synchronet 3.22a-Linux NewsLink 1.2