Index | PAL Intro | Commands | Registers | Indices | Stack | Macros | Classes | Attributes | Errors
reg/roll - Roll groups of registers left or right
Synopsis
Description
More On Shifting
More On Windows
Error Handling
Examples
See Also
Author
reg/roll
reg/roll #shift
reg/roll #shift, #window
Moves register data from one block of registers to another with a wrap-around capability such that the data can be rolled within a window between 1 and 15 positions to the left or right.
When no arguments are provided, rolls all registers one position to the left. This is achieved by saving register P0 to a temporary area, moving registers P1 - P15 to P0 - P14 as one contiguous block, and then restoring register P0 from the temporary area into slot P15.
The optional shift argument provides both the direction of the roll and the number of positions to roll. A raw index between #1 and #15 will roll the registers left by between 1 and 15 places respectively. A raw index between #-1 (or #0xffffffff) and #-15 (or #0xfffffff1) will roll the registers right by between 1 and 15 places respectively. The default shift is #1.
The optional window argument provides the size of the window, i.e. the number of registers involved in the roll, where P0 is always the base register. A value of #16 selects all registers P0 to P15. A value of #4 limits the scope of the roll to a window containing the lowermost 4 registers, i.e. it selects registers P0 to P3. The default window is #16.
A shift of #1 is the same net result as a shift of #-15. A shift of #0 performs no operation. The shift argument has a modulo operation applied such that shift values greater than #15 or less than #-15 are treated as if they were in range. Therefore, a shift of #16 or #-16 is the same as a shift of #0 and performs no operation. A shift of #17 is the same as a shift of #1, and #-17 is the same as #-1.
A window greater than the total number of registers (#16) is reduced in size to #16. A window of #0 performs no operation.
A runtime error is generated if an argument provided is of the wrong type.
reg/roll #2, #10 Roll registers P0 - P9 2 positions to the left. reg/roll #-4 Roll all registers 4 positions to the right. reg/roll #1, A Roll registers left by one position. The size of the window is defined by the value in the Accumulator. reg/roll PULL Roll registers according to the shift value on top of the stack.
pal_commands(5), pal_registers(5), pal_indices(5), reg_move(5),
PROSE Assembly Language at prose.sourceforge.net.
Copyright (c) 2002-2013 Mark R. Bannister <cambridge@users.sourceforge.net>.
This is free software and can be downloaded from prose.sourceforge.net; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
PAL 1.0 | reg_roll (5) | 15 January 2013 |