@ GNU AS assembler header file for ColourTrans
@ Written by DefMod (Dec  9 2012) on Sun Dec  9 15:45:17 2012
@ Jonathan Coxhead, jonathan@doves.demon.co.uk, 28 July 1995

@ OSLib---efficient, type-safe, transparent, extensible,
@ register-safe API coverage of RISC OS
@ 
@ Copyright (c) 1994-2012 Jonathan Coxhead and OSLib maintainers
@ 
@ Licence:
@ 
@    OSLib is free software; you can redistribute it and/or modify
@ it under the terms of the GNU General Public License as published by
@ the Free Software Foundation; either version 1, or (at your option)
@ any later version - and this with the following clarification and
@ special exception:
@ 
@    Linking this library statically or dynamically with other modules
@ is making a combined work based on this library. Thus, the terms
@ and conditions of the GNU General Public License cover the whole
@ combination.
@ 
@    As a special exception, the copyright holders of this library
@ give you permission to link this library with independent modules
@ to produce an executable, regardless of the license terms of these
@ independent modules, and to copy and distribute the resulting
@ executable under terms of your choice, provided that you also meet,
@ for each linked independent module, the terms and conditions of the
@ license of that module. An independent module is a module which is
@ not derived from or based on this library. If you modify this
@ library, you may extend this exception to your version of the library,
@ but you are not obliged to do so. If you do not wish to do so, delete
@ this exception statement from your version.
@ 
@    OSLib is distributed in the hope that it will be useful,
@ but WITHOUT ANY WARRANTY; without even the implied warranty of
@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
@ GNU General Public License for more details.
@ 
@    You should have received a copy of the GNU General Public License
@ along with this programme; if not, write to the Free Software
@ Foundation, Inc, 675 Mass Ave, Cambridge, MA 02139, USA.

#ifndef ColourTrans_Hdr
#  define ColourTrans_Hdr

#  ifndef Get_Types
#    define Get_Types
#    include "oslib/Types.Hdr"
#  endif

#  ifndef Get_OS
#    define Get_OS
#    include "oslib/OS.Hdr"
#  endif

#  ifndef Get_OSSpriteOp
#    define Get_OSSpriteOp
#    include "oslib/OSSpriteOp.Hdr"
#  endif

#  ifndef Get_Font
#    define Get_Font
#    include "oslib/Font.Hdr"
#  endif

@Symbols for constants
#  define ColourTrans_ColourRange 0x10000
#  define ColourTrans_SetFG_GCol 0x0
#  define ColourTrans_SetBG_GCol 0x80
#  define ColourTrans_UseECFS_GCol 0x100
#  define ColourTrans_SetText_GCol 0x200
#  define ColourTrans_GivenSprite 0x1
#  define ColourTrans_CurrentIfAbsent 0x2
#  define ColourTrans_GivenTransferFn 0x4
#  define ColourTrans_ReturnGCOLList 0x8
#  define ColourTrans_ReturnWideEntries 0x10
#  define ColourTrans_ReturnPaletteTable 0x1000000
#  define ColourTrans_WriteDefaultCalibration 0x1
#  define ColourTrans_PaletteForSprite 0x1
#  define ColourTrans_FlashingPalette 0x2
#  define ColourTrans_SetFGCol 0x0
#  define ColourTrans_SetBGCol 0x80
#  define ColourTrans_SetTextCol 0x200
#  define ColourTrans_SetFGTextCol 0x0
#  define ColourTrans_SetBGTextCol 0x80
#  define ColourTrans_CurrentPalette 0xffffffff
#  define ColourTrans_DefaultPalette 0x0
#  define ColourTrans_CurrentFont 0x0
#  define Error_ColourTransBadCalib 0xa00
#  define Error_ColourTransConvOver 0xa01
#  define Error_ColourTransBadHSV 0xa02
#  define Error_ColourTransSwitched 0xa03
#  define Error_ColourTransBadMiscOp 0xa04
#  define Error_ColourTransBadFlags 0xa05
#  define Error_ColourTransBuffOver 0xa06
#  define Error_ColourTransBadDepth 0xa07

@Symbols for structure offsets and sizes
        .struct 0
        .skip   Bits
ColourTrans_GCOLFlags          : 

        .struct 0
        .skip   Bits
ColourTrans_TableFlags         : 

        .struct 0
        .skip   Bits
ColourTrans_CalibrationFlags   : 

        .struct 0
        .skip   Bits
ColourTrans_PaletteFlags       : 

        .struct 0
        .skip   Bits
ColourTrans_ColourFlags        : 

        .struct 0
        .skip   Bits
ColourTrans_TextColourFlags    : 

        .struct 0
ColourTrans_GCOLList_gcol      : .skip   OS_GCOL
ColourTrans_GCOLList           : 

        .struct 0
ColourTrans_CalibrationTable_rcount: .skip   Int
ColourTrans_CalibrationTable_gcount: .skip   Int
ColourTrans_CalibrationTable_bcount: .skip   Int
ColourTrans_CalibrationTable_standard_colour: .skip   OS_Colour
ColourTrans_CalibrationTable   : 
        
        .altmacro
        .macro  ColourTrans_CalibrationTable_MEMBERS label
\label&_rcount                 : .skip   Int
\label&_gcount                 : .skip   Int
\label&_bcount                 : .skip   Int
        .endm
        
        .struct 0
        ColourTrans_CalibrationTable_MEMBERS ColourTrans_CalibrationTableBase
ColourTrans_CalibrationTableBase: 


@Symbols for SWI's and SWI reason codes
.set XColourTrans_SelectTable,0x60740
.set ColourTrans_SelectTable,0x40740
   @Entry
   @  R0 = source_mode (OS_Mode)
   @  R1 -> source_palette (OS_Palette)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = trans_tab (pointer to OSSpriteOp_TransTab)
   @Exit
   @  R4 corrupted

.set XColourTrans_SelectTableForSprite,0x60740
.set ColourTrans_SelectTableForSprite,0x40740
   @Entry
   @  R0 -> source_area (OSSpriteOp_Area)
   @  R1 = source_id (OSSpriteOp_Id)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = trans_tab (pointer to OSSpriteOp_TransTab)
   @  R5 = flags (ColourTrans_TableFlags)
   @Exit
   @  R4 corrupted

.set XColourTrans_SelectGCOLTable,0x60741
.set ColourTrans_SelectGCOLTable,0x40741
   @Entry
   @  R0 = source_mode (OS_Mode)
   @  R1 -> source_palette (OS_Palette)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = gcol_list (pointer to ColourTrans_GCOLList)

.set XColourTrans_SelectGCOLTableForSprite,0x60741
.set ColourTrans_SelectGCOLTableForSprite,0x40741
   @Entry
   @  R0 -> source_area (OSSpriteOp_Area)
   @  R1 = source_id (OSSpriteOp_Id)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = gcol_list (pointer to ColourTrans_GCOLList)
   @  R5 = flags (ColourTrans_TableFlags)

.set XColourTrans_ReturnGCOL,0x60742
.set ColourTrans_ReturnGCOL,0x40742
   @Entry
   @  R0 = colour (OS_Colour)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_SetGCOL,0x60743
.set ColourTrans_SetGCOL,0x40743
   @Entry
   @  R0 = colour (OS_Colour)
   @  R3 = flags (ColourTrans_GCOLFlags)
   @  R4 = action (OS_Action)
   @Exit
   @  R0 = gcol (OS_GCOL)
   @  R2 = log2_bpp (Int)
   @  R3 corrupted

.set XColourTrans_ReturnColourNumber,0x60744
.set ColourTrans_ReturnColourNumber,0x40744
   @Entry
   @  R0 = colour (OS_Colour)
   @Exit
   @  R0 = colour_number (OS_ColourNumber)

.set XColourTrans_ReturnGCOLForMode,0x60745
.set ColourTrans_ReturnGCOLForMode,0x40745
   @Entry
   @  R0 = colour (OS_Colour)
   @  R1 = mode (OS_Mode)
   @  R2 -> dest_palette (OS_Palette)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_ReturnColourNumberForMode,0x60746
.set ColourTrans_ReturnColourNumberForMode,0x40746
   @Entry
   @  R0 = colour (OS_Colour)
   @  R1 = mode (OS_Mode)
   @  R2 -> dest_palette (OS_Palette)
   @Exit
   @  R0 = colour_number (OS_ColourNumber)

.set XColourTrans_ReturnOppGCOL,0x60747
.set ColourTrans_ReturnOppGCOL,0x40747
   @Entry
   @  R0 = colour (OS_Colour)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_SetOppGCOL,0x60748
.set ColourTrans_SetOppGCOL,0x40748
   @Entry
   @  R0 = colour (OS_Colour)
   @  R3 = flags (ColourTrans_GCOLFlags)
   @  R4 = action (OS_Action)
   @Exit
   @  R0 = gcol (OS_GCOL)
   @  R2 = log2_bpp (Int)
   @  R3 corrupted

.set XColourTrans_ReturnOppColourNumber,0x60749
.set ColourTrans_ReturnOppColourNumber,0x40749
   @Entry
   @  R0 = colour (OS_Colour)
   @Exit
   @  R0 = colour_number (OS_ColourNumber)

.set XColourTrans_ReturnOppGCOLForMode,0x6074a
.set ColourTrans_ReturnOppGCOLForMode,0x4074a
   @Entry
   @  R0 = colour (OS_Colour)
   @  R1 = mode (OS_Mode)
   @  R2 -> dest_palette (OS_Palette)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_ReturnOppColourNumberForMode,0x6074b
.set ColourTrans_ReturnOppColourNumberForMode,0x4074b
   @Entry
   @  R0 = colour (OS_Colour)
   @  R1 = mode (OS_Mode)
   @  R2 -> dest_palette (OS_Palette)
   @Exit
   @  R0 = colour_number (OS_ColourNumber)

.set XColourTrans_GCOLToColourNumber,0x6074c
.set ColourTrans_GCOLToColourNumber,0x4074c
   @Entry
   @  R0 = gcol (OS_GCOL)
   @Exit
   @  R0 = colour_number (OS_ColourNumber)

.set XColourTrans_ColourNumberToGCOL,0x6074d
.set ColourTrans_ColourNumberToGCOL,0x4074d
   @Entry
   @  R0 = colour_number (OS_ColourNumber)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_ReturnFontColours,0x6074e
.set ColourTrans_ReturnFontColours,0x4074e
   @Entry
   @  R0 = font (Font_F)
   @  R1 = bg_hint (OS_Colour)
   @  R2 = fill (OS_Colour)
   @  R3 = offset (Int)
   @Exit
   @  R1 = bg_hint_out (OS_Colour)
   @  R2 = fill_out (OS_Colour)
   @  R3 = offset_out (Int)

.set XColourTrans_SetFontColours,0x6074f
.set ColourTrans_SetFontColours,0x4074f
   @Entry
   @  R0 = font (Font_F)
   @  R1 = bg_hint (OS_Colour)
   @  R2 = fill (OS_Colour)
   @  R3 = offset (Int)
   @Exit
   @  R1 = bg_hint_out (OS_Colour)
   @  R2 = fill_out (OS_Colour)
   @  R3 = offset_out (Int)

.set XColourTrans_InvalidateCache,0x60750
.set ColourTrans_InvalidateCache,0x40750

.set XColourTrans_SetCalibration,0x60751
.set ColourTrans_SetCalibration,0x40751
   @Entry
   @  R0 -> calibration_table (ColourTrans_CalibrationTable)

.set XColourTrans_ReadCalibration,0x60752
.set ColourTrans_ReadCalibration,0x40752
   @Entry
   @  R0 = calibration_table (pointer to ColourTrans_CalibrationTable)
   @Exit
   @  R1 = size (Int)

.set XColourTrans_ConvertDeviceColour,0x60753
.set ColourTrans_ConvertDeviceColour,0x40753
   @Entry
   @  R1 = colour (OS_Colour)
   @  R3 -> calibration_table (ColourTrans_CalibrationTable)
   @Exit
   @  R2 = colour_out (OS_Colour)

.set XColourTrans_ConvertDevicePalette,0x60754
.set ColourTrans_ConvertDevicePalette,0x40754
   @Entry
   @  R0 = colour_count (Int)
   @  R1 -> list (OS_Colour)
   @  R2 = buffer (pointer to OS_Colour)
   @  R3 -> calibration_table (ColourTrans_CalibrationTable)

.set XColourTrans_ConvertRGBToCIE,0x60755
.set ColourTrans_ConvertRGBToCIE,0x40755
   @Entry
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)
   @Exit
   @  R0 = x (Int)
   @  R1 = y (Int)
   @  R2 = z (Int)

.set XColourTrans_ConvertCIEToRGB,0x60756
.set ColourTrans_ConvertCIEToRGB,0x40756
   @Entry
   @  R0 = x (Int)
   @  R1 = y (Int)
   @  R2 = z (Int)
   @Exit
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)

.set XColourTrans_WriteCalibrationToFile,0x60757
.set ColourTrans_WriteCalibrationToFile,0x40757
   @Entry
   @  R0 = flags (ColourTrans_CalibrationFlags)
   @  R1 = file (OS_F)
   @Exit
   @  R0 corrupted

.set XColourTrans_WriteCalibrationToFileW,0x60757
.set ColourTrans_WriteCalibrationToFileW,0x40757
   @Entry
   @  R0 = flags (ColourTrans_CalibrationFlags)
   @  R1 = file (OS_FW)
   @Exit
   @  R0 corrupted

.set XColourTrans_ConvertRGBToHSV,0x60758
.set ColourTrans_ConvertRGBToHSV,0x40758
   @Entry
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)
   @Exit
   @  R0 = h (Int)
   @  R1 = s (Int)
   @  R2 = v (Int)

.set XColourTrans_ConvertHSVToRGB,0x60759
.set ColourTrans_ConvertHSVToRGB,0x40759
   @Entry
   @  R0 = h (Int)
   @  R1 = s (Int)
   @  R2 = v (Int)
   @Exit
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)

.set XColourTrans_ConvertRGBToCMYK,0x6075a
.set ColourTrans_ConvertRGBToCMYK,0x4075a
   @Entry
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)
   @Exit
   @  R0 = c (Int)
   @  R1 = m (Int)
   @  R2 = y (Int)
   @  R3 = k (Int)

.set XColourTrans_ConvertCMYKToRGB,0x6075b
.set ColourTrans_ConvertCMYKToRGB,0x4075b
   @Entry
   @  R0 = c (Int)
   @  R1 = m (Int)
   @  R2 = y (Int)
   @  R3 = k (Int)
   @Exit
   @  R0 = r (Int)
   @  R1 = g (Int)
   @  R2 = b (Int)

.set XColourTrans_ReadPalette,0x6075c
.set ColourTrans_ReadPalette,0x4075c
   @Entry
   @  R0 -> area (OSSpriteOp_Area)
   @  R1 = id (OSSpriteOp_Id)
   @  R2 = palette (pointer to OS_Palette)
   @  R3 = size (Int)
   @  R4 = flags (ColourTrans_PaletteFlags)
   @Exit
   @  R3 = spare (Int)

.set XColourTrans_WritePalette,0x6075d
.set ColourTrans_WritePalette,0x4075d
   @Entry
   @  R0 -> area (OSSpriteOp_Area)
   @  R1 = id (OSSpriteOp_Id)
   @  R2 -> palette (OS_Palette)
   @  R3 = &0
   @  R4 = flags (ColourTrans_PaletteFlags)

.set XColourTrans_SetColour,0x6075e
.set ColourTrans_SetColour,0x4075e
   @Entry
   @  R0 = gcol (OS_GCOL)
   @  R3 = flags (ColourTrans_ColourFlags)
   @  R4 = action (OS_Action)

.set XColourTrans_MiscOp,0x6075f
.set ColourTrans_MiscOp,0x4075f

#  define ColourTransMiscOp_SetWeights 0x0
   @Entry
   @  R0 = &0
   @  R1 = rweight (Int)
   @  R2 = gweight (Int)
   @  R3 = bweight (Int)

.set XColourTrans_WriteLoadingsToFile,0x60760
.set ColourTrans_WriteLoadingsToFile,0x40760
   @Entry
   @  R1 = file (OS_F)

.set XColourTrans_WriteLoadingsToFileW,0x60760
.set ColourTrans_WriteLoadingsToFileW,0x40760
   @Entry
   @  R1 = file (OS_FW)

.set XColourTrans_SetTextColour,0x60761
.set ColourTrans_SetTextColour,0x40761
   @Entry
   @  R0 = colour (OS_Colour)
   @  R3 = flags (ColourTrans_TextColourFlags)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_SetOppTextColour,0x60762
.set ColourTrans_SetOppTextColour,0x40762
   @Entry
   @  R0 = colour (OS_Colour)
   @  R3 = flags (ColourTrans_TextColourFlags)
   @Exit
   @  R0 = gcol (OS_GCOL)

.set XColourTrans_GenerateTable,0x60763
.set ColourTrans_GenerateTable,0x40763
   @Entry
   @  R0 = source_mode (OS_Mode)
   @  R1 -> source_palette (OS_Palette)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = trans_tab (pointer to OSSpriteOp_TransTab)
   @  R5 = flags (ColourTrans_TableFlags)
   @  R6 = workspace (pointer to Void)
   @  R7 = transfer_fn (pointer to code)
   @Exit
   @  R4 = size (Int)

.set XColourTrans_GenerateTableForSprite,0x60763
.set ColourTrans_GenerateTableForSprite,0x40763
   @Entry
   @  R0 -> source_area (OSSpriteOp_Area)
   @  R1 = source_id (OSSpriteOp_Id)
   @  R2 = dest_mode (OS_Mode)
   @  R3 -> dest_palette (OS_Palette)
   @  R4 = trans_tab (pointer to OSSpriteOp_TransTab)
   @  R5 = flags (ColourTrans_TableFlags)
   @  R6 = workspace (pointer to Void)
   @  R7 = transfer_fn (pointer to code)
   @Exit
   @  R4 = size (Int)

#  define ColourV 0x22

#  define Service_CalibrationChanged 0x5b
   @Entry
   @  R1 = &5B

#  define Service_InvalidateCache 0x82
   @Entry
   @  R1 = &82

#endif
