RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Downloads | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

OS_SpriteOp 61

OS SWI Calls
» OS_SpriteOp
» OS_SpriteOp 61 – Switch output to mask

OS_SpriteOp 61 – Switch output to mask

(SWI &2E)
Entry
R0 61 (Reason code) + Area value
R1 Unused/Sprite area (as defined by area value in R0)
R2 Sprite name/pointer (as defined by area value in R0)
Or 0 to switch output to screen
R3 VDU Save Area:
0: Use no save area (discouraged)
1: Use kernel save area
Otherwise: Pointer to user save area
Exit
R0-R3 Required values to restore previous context
All other registers preserved

Use

This call can be used to redirect screen output to a sprite mask, or to return output back to the screen.

While output is redirected to a sprite, all VDU operations including text output, OS_Plot operations, and sprite rendering will act on the sprite and not the screen. The VDU Variables and Mode Variables will also reflect the change.

When output is redirected to an alpha mask, ColourTrans will report a default greyscale palette (black to white gradient). For other types of mask the same logic as OS_SpriteOp 60 is used. In this situation using colour translation functions to determine the pixel values/colours to write to the mask may result in invalid values being stored.

If no save area is supplied in R3 or the save area is not yet initialised, the VDU state will be reset to the default for the sprite/screen mode. See VDU Save Area for more details on the state that save areas store.

Notes

To redirect screen output to a sprite image, see OS_SpriteOp 60.

You must be careful to restore output back to the screen should an error occur. It’s recommended to install environment handlers so that unexpected errors (e.g. data aborts) can be fully accounted for.

To restore output back to its previous location, issue OS_SpriteOp with R0-R3 containing the values returned from this call.

The low-level PaletteV API only deals with the screen palette, and so does not adapt itself in any way when screen output is redirected to a sprite. Therefore any PaletteV calls made while output is redirected will manipulate the screen palette and not the sprite palette. Additionally, ColourTrans_WritePalette will return an error if called when output is redirected.

Service_SwitchingOutputToSprite will be issued by this call.

If a call is made to change the screen mode or switch video drivers while screen output is redirected, the output will be restored to the screen.

Redirecting output to a sprite without using a save area is strongly discouraged. The reason being that it can cause issues if you either directly or indirectly call a SWI which wants to use redirection internally (e.g. the font manager makes use of redirection to build the font cache). Save areas are small (currently under 512 bytes), so there is little reason to not use them.

See also

  • Format Of Sprite
  • Format Of Sprite Area
  • OS_SpriteOp
  • OS_SpriteOp 60
  • VDU Save Area
  • ColourTrans
  • PaletteV
Revised on November 13, 2017 00:18:18 by Alan Robertson (52) (49.192.18.196)
Edit | Back in time (3 revisions) | See changes | History | Views: Print | Source | Linked from: Service_SwitchingOutputToSprite, OS_SpriteOp, OS_SpriteOp 60, OS_SpriteOp 62, VDU Save Area

Search the Wiki

Social

Follow us on and

ROOL Store

Buy RISC OS Open merchandise here, including SD cards for Raspberry Pi and more.

Donate! Why?

Help ROOL make things happen – please consider donating!

RISC OS IPR

RISC OS is an Open Source operating system owned by RISC OS Developments Ltd and licensed primarily under the Apache 2.0 license.

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2018 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys