03h AL$REPL replace an item in an allocator cell
Input D register - Size of current item.
X register - Tag of the cell to be shrunk or expanded.
UTW_S0 - Offset in cell to start shrink or expand.
UTW_S1 - Size of new item.
Output - none -

Increase or decrease the cell whose base address is held in the two byte address pointed at by the X register according to the two sizes in the D register and location UTW_S1.

The cell is grown or shrunk accordingly by calls to AL$GROW or AL$SHNK.

The base of the cell will not move as the extra space is added or deleted after the start of the cell. However all cells which come after this cell may be moved.

If the value of X is not in the correct range ($2000-$203E) results will be unpredictable. If the offset in UTW_S0 is bigger than the cell, the shrink/grow will still be performed with unpredictable results. The user may write his own shell to protect against these bugs.

Example For example, to replace 8 bytes of a cell by 6 bytes at 10 bytes from the start of the cell:
        LDX     #10
        STX     UTW_S0  ; Offset to replace
        LDX     #6      ; Number of bytes in new item
        STX     UTW_S1 
        LDX     CELL    ; get the tag
        LDD     #8      ; Number of bytes in current item
        OS      AL$REPL
        BCS     ERROR   ; Report errors
Errors 254 - Not enough memory for the cell to be allocated.