Right...the plan is:
All calls to OS_DynamicArea (0) must have R5 set (maximum size of area) or they'll be rejected. OS_DynamicArea will then map memory away if required to ensure there's no memory in the area, which ends at the 16mb boundary and grows downwards by maximum area size on each DA allocation.
I won't be implementing any of the service calls as I don't believe they're required for our needs and it would be a lot of coding anyhow.
I will only implement OS_DynamicArea (0) and (1), the others won't be required as we don't need to enumerate or renumber DA's. (2) which returns information on a DA isn't required as we'll be tracking our own DA's anyhow - unless you want it coded of course.
There would be an issue should we have for example 3 DA's and the 2nd is removed, as it would leave a hole and potentially allow Application space to overlap the 3rd DA. This won't be an issue in our case, as we're only using DA's for ADFFS and QTM shims. Just something to be aware of.
EDIT: Forgot to add that OS_DynamicArea (0) must have R1 and R3 set to -1, so the DA number and logical address are allocated by ADFFS.
OS_DynamicArea 0
Creates a new dynamic area
On entry
R0 = 0 (reason code)
R1 = –1 (or new area number not in range 128 - 255; this is reserved for Acorn use)
R2 = initial size of area, in bytes
R3 = –1 (or base logical address of area; this is reserved for Acorn use)
R4 = area flags (see below)
R5 = maximum size of area, in bytes (–1 = total RAM size of the machine)
R6 = pointer to dynamic area handler routine (see page 5a-45), or 0 if no routine
R7 = pointer to workspace, passed in R12 on entry to dynamic area handler routine;
or –1 for RISC OS to instead pass base address of area; or 0 if R6 = 0
R8 = pointer to null terminated string describing dynamic area (e.g. ‘Font cache’)
On exit
R0 preserved
R1 = allocated area number
R2 preserved
R3 = specified or allocated base address of area
R4 preserved
R5 = specified or allocated maximum size of area
R6 - R8 preserved