home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine 1997 / ARCHIVE_97.iso / discs / mag_discs / volume_08 / issue_06 / risc_os / kernel / VduOutput < prev   
Text File  |  1988-10-11  |  6KB  |  162 lines

  1. ; > &.DocRiscOS.Kernel.VduOutput
  2.  
  3. Title:          VDU output to sprites/1
  4. Version:        0.09
  5. Started:        11-Jan-88
  6. Last updated:   11-Oct-88
  7.  
  8. Description of switching VDU output to sprites
  9. -----------------------------------------------
  10.  
  11. In RISC OS 2.00 it is possible to switch VDU output to act directly on a
  12. sprite, rather than the screen. Thus graphical operations and text printing
  13. plot into the bitmap area of the sprite definition.
  14.  
  15. At the time output is switched, a save area may also be specified, in which
  16. the VDU context will be saved when output is subsequently redirected away from
  17. the sprite (normally back to the screen). When output to the same sprite is
  18. required, the same save area can be specified again, and the VDU context will
  19. be restored to the state when the sprite was left (eg if a graphics window was
  20. defined when outputting to a sprite and then output was redirected back to the
  21. screen and a new graphics window defined, on returning output to the sprite the
  22. old graphics window will be restored).
  23.  
  24. If no save area is specified when selecting the sprite, or if the save area is
  25. indicated as uninitialised, then the VDU context will be set to the default
  26. state for the screen mode the sprite was created with (although the size of the
  27. graphics area will be set to the size of the sprite).
  28.  
  29. In addition, it is possible to switch output to the screen using different
  30. save areas, and thus create multiple screen contexts.
  31.  
  32. Note: when output is switched to a sprite, its left-hand wastage is removed.
  33. This ensures that the left-hand edge of the output bitmap is word-aligned.
  34.  
  35. Calls to SWI OS_SpriteOp associated with switching output
  36. ---------------------------------------------------------
  37.  
  38. As is usual for calls to OS_SpriteOp, R0 contains a reason code which falls
  39. into one of three groups:-
  40.  
  41. a) R0 = (&000 + n) implies the sprite is in the system sprite area;
  42.    R1 is irrelevant, R2 -> sprite name
  43.  
  44. b) R0 = (&100 + n) implies the sprite is in a user sprite area;
  45.    R1 -> user sprite area, R2 -> sprite name
  46.  
  47. c) R0 = (&200 + n) implies the sprite is in a user sprite area;
  48.    R1 -> user sprite area, R2 -> sprite control block
  49.  
  50. 1. Switching output to a sprite
  51. -------------------------------
  52.  
  53. in:     R0 = k * &100 + SpriteReason_SwitchOutputToSprite (&k3C)
  54.         R1, R2 indicate sprite as described above, according to the value of k
  55.         R3 -> save area (must be word aligned)
  56.          0 => no save area
  57.  
  58. out:    R0-R3 = registers to call OS_SpriteOp with to restore old state
  59.  
  60. An uninitialised save area must be marked as such by setting its first word
  61. to zero (once a save area has had variables stored in it, the MOS changes the
  62. first word to a save area designator).
  63.  
  64. 2. Switching output to the transparency mask of a sprite
  65. --------------------------------------------------------
  66.  
  67. in:     R0 = k * &100 + SpriteReason_SwitchOutputToMask (&k3D)
  68.         R1, R2 indicate sprite as described above, according to the value of k
  69.         R3 -> save area (must be word aligned)
  70.          0 => no save area
  71.  
  72. out:    R0-R3 = registers to call OS_SpriteOp with to restore old state
  73.  
  74.  
  75. 3. Switching output to the screen
  76. ---------------------------------
  77.  
  78. in:     R0 = SpriteReason_SwitchOutputToSprite (&03C)
  79.         R1 irrelevant
  80.         R2 = 0
  81.         R3 -> save area (must be word aligned)
  82.          0 => no save area
  83.          1 => MOS's save area
  84.  
  85. out:    R0-R3 = registers to call OS_SpriteOp with to restore old state
  86.  
  87. The operating system maintains a save area for the screen's context which it
  88. uses by default. However the user is at liberty to specify a different save
  89. area for the screen (to create multiple screen contexts) or to specify no
  90. save area for the screen.
  91.  
  92.  
  93. 4. Reading size of a suitable save area for a sprite's context
  94. --------------------------------------------------------------
  95.  
  96. in:     R0 = k * &100 + SpriteReason_ReadSaveAreaSize (&k3E)
  97.         R1, R2 indicate sprite as described above, according to the value of k
  98.  
  99. out:    R3 = size of required save area (in bytes)
  100.  
  101.  
  102. 5. Reading size of a suitable save area for a screen context
  103. ------------------------------------------------------------
  104.  
  105. in:     R0 = SpriteReason_ReadSaveAreaSize (&03E)
  106.         R1 irrelevant
  107.         R2 = 0
  108.  
  109. out:    R3 = size of required save area (in bytes)
  110.  
  111. 6. Removing left-hand wastage from a sprite
  112. -------------------------------------------
  113.  
  114. in:     R0 = k * &100 + SpriteReason_RemoveLeftHandWastage (&k36)
  115.         R1, R2 indicate sprite as described above, according to the value of k
  116.  
  117. out:    -
  118.  
  119. Sprites in general have a number of unused bits in the words corresponding to
  120. the left- and right-hand edges of each pixel row. This operation removes the
  121. left-hand wastage so that the left hand side of the sprite is word-aligned.
  122. The right-hand wastage is increased by the number of bits that were removed,
  123. and if this is now more than 32 bits then a whole word is removed from each
  124. row of the sprite, and the rest of the sprite area moved down to fill the
  125. gap.
  126.  
  127. Variables included in save area
  128. -------------------------------
  129.  
  130. ECF patterns, BBC/native ECF flag, ECF origin
  131.  
  132. Dotted line pattern and length, and current position in pattern
  133.  
  134. Graphics foreground and background actions, colours and tints
  135.  
  136. Text foreground and background colours and tints
  137.  
  138. Graphics and text window definitions
  139.  
  140. Graphics origin
  141.  
  142. Graphics cursor and 2 previous positions
  143.  
  144. Text cursor position (and input cursor position)
  145.  
  146. Vdu status (VDU 2 state, page mode, windowing, shadowing, VDU 5 mode,
  147.  cursor editing state, VDU disabled)
  148.  
  149. Vdu queue and queue ptr
  150.  
  151. Mode variables are reconstituted from the sprite mode number or the display
  152. mode number as appropriate
  153.  
  154. Character sizes and spacings
  155.  
  156. Changed box coordinates and status
  157.  
  158. Wrch destinations flag
  159.  
  160. Spool handle
  161.  
  162.