Commit 0542fd48 authored by Jeffrey Lee's avatar Jeffrey Lee

Add details of new sprite mode word format. Add ColourConv macro to help with colour conversions.

Detail:
  hdr/Macros - Add ColourConv macro to convert &BBGGRRxx palette entries to any sensible true-colour pixel format
  hdr/Sprite - Add definition of the new RISC OS 5 style sprite mode word format. Revise "new" 3.5 style format to include the wide mask flag introduced by ROL. Define new sprite types for ROL-compatible 64K sprites and new RISC OS 5 sprites.
Admin:
  Tested in OMAP3 ROM build on BB-xM
  Part of an implementation of the Extended Framebuffer Format spec:
  http://www.riscosopen.org/wiki/documentation/show/Extended%20Framebuffer%20Format%20Specification


Version 2.31. Tagged as 'HdrSrc-2_31'
parent e97a69d2
/* (2.30)
/* (2.31)
*
* This file is automatically maintained by srccommit, do not edit manually.
* Last processed by srccommit version: 1.1.
*
*/
#define Module_MajorVersion_CMHG 2.30
#define Module_MajorVersion_CMHG 2.31
#define Module_MinorVersion_CMHG
#define Module_Date_CMHG 28 Jul 2013
#define Module_Date_CMHG 06 Aug 2013
#define Module_MajorVersion "2.30"
#define Module_Version 230
#define Module_MajorVersion "2.31"
#define Module_Version 231
#define Module_MinorVersion ""
#define Module_Date "28 Jul 2013"
#define Module_Date "06 Aug 2013"
#define Module_ApplicationDate "28-Jul-13"
#define Module_ApplicationDate "06-Aug-13"
#define Module_ComponentName "HdrSrc"
#define Module_ComponentPath "castle/RiscOS/Sources/Programmer/HdrSrc"
#define Module_FullVersion "2.30"
#define Module_HelpVersion "2.30 (28 Jul 2013)"
#define Module_LibraryVersionInfo "2:30"
#define Module_FullVersion "2.31"
#define Module_HelpVersion "2.31 (06 Aug 2013)"
#define Module_LibraryVersionInfo "2:31"
......@@ -106,6 +106,7 @@ OldOpt SETA {OPT}
;$n Chunk $v,$c,$s,$o Create a SWI chunk
;$n ChunkM $v,$c Create a Message chunk
; Command $cmd, $max, $min, $optbits, $cmdlabel Generate a *command block
;$label ColourConv $in,$out,$tmpR,$tmpG,$tmpB,$red_shift,$red_bits,$green_shift,$green_bits,$blue_shift,$blue_bits,$alpha Convert &BBGGRR00 colours to various formats
;$label DEC $reg,$by Decrement a register (by a value)
;$label DECS $reg,$by Decrement a register (by a value) settng PSR
;$label DivRem $rc, $ra, $rb, $rtemp Get DIV and REM of two values
......@@ -632,6 +633,42 @@ Command_LastName SETA .-Module_BaseAddr
DCD $cmdlab._Help -Module_BaseAddr
MEND
; **************************************************************************
; *** ColourConv - Convert a palette entry (&BBGGRRxx) to any sensible ***
; *** true-colour pixel format. ***
; *** 'shift' args denote bottom bit of relevant channel in output ***
; *** 'bits' args denote number of bits in channel ***
; *** 'alpha' is optional constant to set alpha/transfer channel to ***
; **************************************************************************
MACRO
$label ColourConv $in,$out,$tmpR,$tmpG,$tmpB,$red_shift,$red_bits,$green_shift,$green_bits,$blue_shift,$blue_bits,$alpha
ASSERT ($in <> $tmpR) :LAND: ($in <> $tmpG)
ASSERT ($tmpR <> $tmpG) :LAND: ($tmpR <> $tmpB) :LAND: ($tmpG <> $tmpB)
ASSERT ($out <> $tmpB)
$label AND $tmpR,$in,#((1<<$red_bits)-1)<<(16-$red_bits) ; Extract R
AND $tmpG,$in,#((1<<$green_bits)-1)<<(24-$green_bits) ; Extract G
[ $red_shift >= (16-$red_bits) ; Reposition R
MOV $tmpR,$tmpR,LSL #$red_shift-(16-$red_bits)
|
MOV $tmpR,$tmpR,LSR #(16-$red_bits)-$red_shift
]
AND $tmpB,$in,#((1<<$blue_bits)-1)<<(32-$blue_bits) ; Extract B
[ $green_shift >= (24-$green_bits) ; Merge in G
ORR $out,$tmpR,$tmpG,LSL #$green_shift-(24-$green_bits)
|
ORR $out,$tmpR,$tmpG,LSR #(24-$green_bits)-$green_shift
]
[ $blue_shift >= (32-$blue_bits) ; Merge in B
ORR $out,$out,$tmpB,LSL #$blue_shift-(32-$blue_bits)
|
ORR $out,$out,$tmpB,LSR #(32-$blue_bits)-$blue_shift
]
[ "$alpha" <> ""
ORR $out,$out,#$alpha ; Set alpha
]
MEND
; ********************************************************
; *** DEC - Decrements a register, default is by one ***
; ********************************************************
......
......@@ -152,46 +152,78 @@ saExten # 0 ;
SpriteAreaCBsize * (saExten-saEnd)
; The new definition of the sprite mode word is:
; Bits 31-27 Sprite type:
; The RISC OS 3.5 definition of the sprite mode word is:
; Bits 30-27 Sprite type:
; 0 - the word represents a mode number, ie the old world
; 1 - 6 new format as below
; 7 - 31 not assigned
; 7 - 15 not assigned
;
; For types >0 the format is:
;
; 31--27 26--14 13--01 00
; 1 - always
; <xdpi> - dots per inch, x
; <ydpi> - dots per inch, y
; <type> - type of sprite
; 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)
;
; T values allocated so far:
; -
; 0 old format
; 0 old format (i.e. just a mode number. <wm> must be zero)
; 1 1bpp
; 2 2bpp
; 3 4bpp
; 4 8bpp
; 5 16bpp
; 6 32bpp
; 5 16bpp 1:5:5:5 TBGR
; 6 32bpp 8:8:8:8 TBGR
; 7 cmyk (no OS support)
; 8 24bpp (no OS support)
; 9 JPEG (no OS support)
; 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
^ 0
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
SpriteType_New32bpp # 1 ; 6 32 bpp
SpriteType_MAX * :INDEX: @ ; maximum type allocated
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_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: @
; 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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment