Sprite 8.67 KB
Newer Older
Neil Turton's avatar
Neil Turton committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86
; Copyright 1996 Acorn Computers Ltd
;
; Licensed under the Apache License, Version 2.0 (the "License");
; you may not use this file except in compliance with the License.
; You may obtain a copy of the License at
;
;     http://www.apache.org/licenses/LICENSE-2.0
;
; Unless required by applicable law or agreed to in writing, software
; distributed under the License is distributed on an "AS IS" BASIS,
; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
; See the License for the specific language governing permissions and
; limitations under the License.
;
; > &.Hdr.Sprite

; ***********************************
; ***    C h a n g e   L i s t    ***
; ***********************************

; Date       Name  Description
; ----       ----  -----------
; 22-Sep-87  TMD   Added SwitchOutputToSprite/Mask reason codes
;  8-Oct-87  NDR   Added sprite scaling and colour translation reason codes
;  8-Oct-87  NDR   Moved SwitchOutputToSprite/Mask reason codes to 60,61
;  6-Nov-87  NDR   Added SpriteReason_MergeSprites reason code (35)
; 12-Nov-87  NDR   Changed name from MergeSprites to AppendSprite
; 29-Jan-88  NDR   Added SpriteReason_SetPointerShape
;  2-Feb-88  NDR   Removed SpriteReason_Set/ReadScaleFactors/ColourTranslation
; 17-Feb-88  NDR   Added SpriteReason_ReadVduBlockSize
; 03-Mar-88  TMD   Renamed ReadVduBlockSize as ReadSaveAreaSize
; 11-Oct-88  TMD   Added SpriteReason_RemoveLeftHandWastage
; 13-Sep-89  NDR   Added SpriteReason_PutSpriteTransformed
;                  Added SpriteReason_PlotMaskTransformed
; 28-Nov-89  GJS   Added SpriteReason_InsertDeleteRows
;                  Added SpriteReadon_InsertDeleteColumns
; 30-Jan-91  DDV   Added SpriteReason_CreateRemovePalette
; 28-Aug-92  DDV   Defined new constants about the revised header format
; 11-Mar-93  AMG   Amend the above new constants to reflect reality, and
;                    define the new sprite types
; 16-Jul-93  JSR   MaxSpitePaletteSize put back to 16*8 because 256*8 didn't work
; 28-Sep-93  AMG   Add SpriteReason_PutSpriteTransformedCalibrated, PutSpriteScaledCalibrated
;                    and reserve T=7,T=8 sprites for CC.
; 27-Oct-93  AMG   Add T=9 for JPEG (for WRS).
; 18-Nov-93  AMG   Add SpriteType_Substitute and explanation
; 01-Feb-94  AMG   Correct MaxSpritePaletteSize ( warning! it's no longer an immediate value)
; 27-Sep-94  GPS   Added SpriteReason_CheckSpriteArea (17)
; 25-Oct-94  GPS   Removed SpriteReason_PutSpriteTransformedCalibrated, PutSpriteScaledCalibrated
;                  Added definitions for JPEG SWIs.
; 29-Oct-94  AMcC  Removed definitions for JPEG SWIs (now in Hdr:SprExtend)
;

;
; Reason codes for SWI SpriteOp, passed in R0
;

;SpriteReason_ReportError           * 0
;SpriteReason_ClaimSpace            * 1  ;*SSpace <n>
SpriteReason_ScreenSave             * 2
SpriteReason_ScreenLoad             * 3

SpriteReason_ReadAreaCB             * 8  ;*SInfo
SpriteReason_ClearSprites           * 9  ;*SNew
SpriteReason_LoadSpriteFile         * 10 ;*SLoad <filename>
SpriteReason_MergeSpriteFile        * 11 ;*SMerge <filename>
SpriteReason_SaveSpriteFile         * 12 ;*SSave <filename>
SpriteReason_ReturnName             * 13
SpriteReason_GetSprite              * 14 ;*SGet <n>
SpriteReason_CreateSprite           * 15
SpriteReason_GetSpriteUserCoords    * 16
SpriteReason_CheckSpriteArea        * 17

SpriteReason_SelectSprite           * 24 ;*SChoose <n> [<m>]
SpriteReason_DeleteSprite           * 25 ;*SDelete <n>
SpriteReason_RenameSprite           * 26 ;*SRename
SpriteReason_CopySprite             * 27
SpriteReason_PutSprite              * 28
SpriteReason_CreateMask             * 29
SpriteReason_RemoveMask             * 30
SpriteReason_InsertRow              * 31
SpriteReason_DeleteRow              * 32
SpriteReason_FlipAboutXAxis         * 33
SpriteReason_PutSpriteUserCoords    * 34
SpriteReason_AppendSprite           * 35
SpriteReason_SetPointerShape        * 36
SpriteReason_CreateRemovePalette    * 37
Jeffrey Lee's avatar
Jeffrey Lee committed
87
SpriteReason_CreateRemoveAlpha      * 38
Neil Turton's avatar
Neil Turton committed
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116

SpriteReason_ReadSpriteSize         * 40
SpriteReason_ReadPixelColour        * 41
SpriteReason_WritePixelColour       * 42
SpriteReason_ReadPixelMask          * 43
SpriteReason_WritePixelMask         * 44
SpriteReason_InsertCol              * 45
SpriteReason_DeleteCol              * 46
SpriteReason_FlipAboutYAxis         * 47
SpriteReason_PlotMask               * 48
SpriteReason_PlotMaskUserCoords     * 49

SpriteReason_PlotMaskScaled         * 50
SpriteReason_PaintCharScaled        * 51
SpriteReason_PutSpriteScaled        * 52
SpriteReason_PutSpriteGreyScaled    * 53
SpriteReason_RemoveLeftHandWastage  * 54
SpriteReason_PlotMaskTransformed    * 55
SpriteReason_PutSpriteTransformed   * 56
SpriteReason_InsertDeleteRows       * 57
SpriteReason_InsertDeleteColumns    * 58

SpriteReason_SwitchOutputToSprite   * 60
SpriteReason_SwitchOutputToMask     * 61
SpriteReason_ReadSaveAreaSize       * 62

;SpriteReason_PutSpriteScaledCalibrated        * 63
;SpriteReason_PutSpriteTransformedCalibrated   * 64

117 118 119
SpriteReason_TileSpriteScaled       * 65

SpriteReason_BadReasonCode          * 66
Neil Turton's avatar
Neil Turton committed
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157


 ^ 0

spNext    # 4  ;  Offset to next sprite
spName    # 12 ;  Sprite name
spWidth   # 4  ;  Width in words-1      (0..639)
spHeight  # 4  ;  Height in scanlines-1 (0..255/511)
spLBit    # 4  ;  First bit used (left end of row)
spRBit    # 4  ;  Last bit used (right end of row)
spImage   # 4  ;  Offset to sprite image
spTrans   # 4  ;  Offset to transparancy mask
spMode    # 4  ;  Mode sprite was defined in
spPalette # 0  ;

; These two map onto the header format used above

sp2Width    * spLBit
sp2Reserved * spRBit

SpriteCBsize * (spPalette-spNext)
SpriteNameSize * (spWidth-spName)
MaxSpritePaletteSize * 256*8

MaxSpriteWidth  * 32768  ;Words ???
MaxSpriteHeight * 32768  ;Rows


 ^ 0

saEnd        # 4 ; Offset to end of sprite area (ie total size)
saNumber     # 4 ; Number of sprites in area
saFirst      # 4 ; Offset to first sprite
saFree       # 4 ; Offset to first free word
saExten      # 0 ;

SpriteAreaCBsize * (saExten-saEnd)

158 159
; The RISC OS 3.5 definition of the sprite mode word is:
; Bits 30-27 Sprite type:
Neil Turton's avatar
Neil Turton committed
160 161
;             0 - the word represents a mode number, ie the old world
;             1 - 6  new format as below
162
;             7 - 15 not assigned
Neil Turton's avatar
Neil Turton committed
163 164 165
;
; For types >0 the format is:
;
166 167 168 169 170 171 172
; 31 30--27 26--14 13--01 00
;                          1 - always
;                  <xdpi>    - dots per inch, x
;           <ydpi>           - dots per inch, y
;    <type>                  - type of sprite
; <wm>                       - wide mask (1 => 8 bit alpha, 0 => 1 bit on/off)
;                              (RO Select extension, not in 3.5)
Neil Turton's avatar
Neil Turton committed
173 174 175
;
; T values allocated so far:
; -
176
; 0 old format (i.e. just a mode number. <wm> must be zero)
Neil Turton's avatar
Neil Turton committed
177 178 179 180
; 1 1bpp
; 2 2bpp
; 3 4bpp
; 4 8bpp
181 182
; 5 16bpp 1:5:5:5 TBGR
; 6 32bpp 8:8:8:8 TBGR
Neil Turton's avatar
Neil Turton committed
183 184 185
; 7 cmyk (no OS support)
; 8 24bpp (no OS support)
; 9 JPEG (no OS support)
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208
; 10 16bpp 5:6:5 TBGR
; 11-14 reserved
; 15 reserved for identifying RISC OS 5 style sprite mode words

; RISC OS 5 introduces another new sprite mode word format, which is:
;
; w111 1ttt tttt 0000 ffff ffff yyxx 0001
;  111 1         0000                0001 - always
;                                 xx      - DPI, x (0=180, 1=90, 2=45, 3=22.5)
;                               yy        - DPI, y (0=180, 1=90, 2=45, 3=22.5)
;                     ffff ffff           - bits 8-15 of ModeFlags
;       ttt tttt                          - sprite type
; w                                       - wide mask flag
;
; Sprite types are:
;
; 0-14 as above, modified by ModeFlags where appropriate
; 15 reserved
; 16 16bpp 4:4:4:4
; 17 4:2:2 YCbCr
; 18 4:2:0 YCbCr
; 19-127 reserved

Neil Turton's avatar
Neil Turton committed
209 210

                    ^ 0
211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229
SpriteType_Old      # 1 ; 0   old format
SpriteType_New1bpp  # 1 ; 1   1 bpp
SpriteType_New2bpp  # 1 ; 2   2 bpp
SpriteType_New4bpp  # 1 ; 3   4 bpp
SpriteType_New8bpp  # 1 ; 4   8 bpp
SpriteType_New16bpp # 1 ; 5   16 bpp 1555
SpriteType_New32bpp # 1 ; 6   32 bpp
SpriteType_MAX      * :INDEX: @ ; maximum 3.5 type supported. 64K is an exception.

SpriteType_CMYK     # 1 ; 7   cmyk - no support in OS
SpriteType_New24bpp # 1 ; 8   packed 24bpp - no support in OS
SpriteType_JPEG     # 1 ; 9   JPEG - no support in OS
SpriteType_New64K   # 1 ; 10  16 bpp 565
                    # 4
SpriteType_RISCOS5  # 1 ; 15  New RISC OS 5 sprite mode word
SpriteType_New4K    # 1 ; 16  16 bpp 4444
SpriteType_New422   # 1 ; 17  YCbCr 4:2:2
SpriteType_New420   # 1 ; 18  YCbCr 4:2:0
SpriteType_RO5MAX   * :INDEX: @
Neil Turton's avatar
Neil Turton committed
230 231 232 233 234 235 236 237 238 239

; if a Sprite Type >= SpriteType_Max is passed through the kernel (ie one that
; there's no support for) it will treat it as the substitute type instead of
; returning an error. This should make it more painless to pass unsupported
; and undefined types through the kernel

SpriteType_Substitute * SpriteType_New32bpp


        END