;---------------------------------------------------------------------------
;   IFND UTILITY_TAGITEM_I
;                include   utility/tagitem.i
;   ENDC
;---------------------------------------------------------------------------
SEGMENTSIZE    equ       64*1024
;---------------------------------------------------------------------------
;---- Alerts:

; an alert number like 35xx01xx identifies an alert caused by retina.library

ALERT_NOHARD             equ   $0100   ;no Retina hardware present

ALERT_NOMEM              equ   $0110|AG_NoMemory  ;Retina does not have any memory at all
ALERT_NOMEMTOFREE        equ   $0111   ;tried to free memory although no memory is in use
ALERT_MEMTOFREENOTFOUND  equ   $0112   ;tried to free memory which has not been allocated
ALERT_NOMEMNODEMEM       equ   $0113|AG_NoMemory  ;no Amiga memory for memory listnode
ALERT_MEMNOTFREED        equ   $0114   ;still some memory in use at library expunge

ALERT_CLOSE_LIB_MONITOR  equ   $0121   ;CloseMonitor() eines Library-internen Monitors
ALERT_MONITOR_NOT_CLOSED equ   $0122   ;LIB_Expunge und ein Monitor ist noch offen
;---------------------------------------------------------------------------
; modes for Retina_SetDrMd()

RDM_JAM1       equ       0
RDM_COMPLEMENT equ       2
;---------------------------------------------------------------------------
; modes for Retina_WriteRect(), ...

RECTMODE_RGB   equ       0
RECTMODE_RGBA  equ       1
RECTMODE_BGR   equ       2                  ;faster than MODE_RGB
RECTMODE_GB_R  equ       3                  ;for VDPaint only, do NOT use
RECTMODE_256   equ       4
RECTMODE_GB_R0 equ       5                  ;for VDPaint only, do NOT use
;---------------------------------------------------------------------------
; Tagitems for SetSprite() or SpriteFunction():

RSP_On         equ       TAG_USER+1
RSP_Color0     equ       TAG_USER+2
RSP_Color1     equ       TAG_USER+3
RSP_ZoomX      equ       TAG_USER+4
RSP_ZoomY      equ       TAG_USER+5         ;ignored by SpriteFunction()
;---------------------------------------------------------------------------
; flag definitions for _nrm_Flags:

 BITDEF MD,DBL,0         ;1 = Double-Scan
 BITDEF MD,LACE,1        ;1 = Interlace
 BITDEF MD,CLKDIV2,2     ;1 = 1/2 Pixelclock benutzen

ATNT_MODE_8    equ       0                  ; 8 bit with color lookup
ATNT_MODE_15   equ       1                  ;15 bit true color with color lookup
ATNT_MODE_24   equ       2                  ;24 bit true color with color lookup
ATNT_MODE_16   equ       3                  ;16 bit true color with color lookup
ATNT_MODE_res  equ       4                  ;not available
ATNT_MODE_15b  equ       5                  ;same as 1, but lookup table bypassed
ATNT_MODE_16b  equ       6                  ;same as 3, but lookup table bypassed
ATNT_MODE_24b  equ       7                  ;same as 2, but lookup table bypassed

 STRUCTURE __NewRetinaMonitor,0

               LONG      _nrm_MonitorID
               APTR      _nrm_Name

               LONG      _nrm_PixelClock

               BYTE      _nrm_AtntMode
               BYTE      _nrm_Flags

               LABEL     _nrm_MaxWidth
               WORD      _nrm_StdWidth
               LABEL     _nrm_MaxHeight
               WORD      _nrm_StdHeight

               WORD      _nrm_HBStart
               WORD      _nrm_HSStart
               WORD      _nrm_HSEnd
               WORD      _nrm_HBEnd
               WORD      _nrm_HTotal

               WORD      _nrm_VBStart
               WORD      _nrm_VSStart
               WORD      _nrm_VSEnd
               WORD      _nrm_VBEnd
               WORD      _nrm_VTotal

               WORD      _nrm_MaxWidth_reserved
               WORD      _nrm_MaxHeight_reserved

               LABEL     _nrm_SIZEOF
;---------------------------------------------------------------------------
 STRUCTURE __RetinaMonitor,0
               STRUCT    _rm_Node,LN_SIZE

               LONG      _rm_MonitorID

               LONG      _rm_HFrequency
               LONG      _rm_VFrequency

               WORD      _rm_BytesPerPixel

               LABEL     _rm_MaxWidth
               WORD      _rm_StdWidth
               LABEL     _rm_MaxHeight
               WORD      _rm_StdHeight

               WORD      _rm_MaxWidth_reserved
               WORD      _rm_MaxHeight_reserved

               LABEL     _rm_PUBSIZE        ;never use this!
;---------------------------------------------------------------------------
; special values vor Retina_OpenScreen() Width and Height

RSCR_STDWIDTH  equ       -1
RSCR_STDHEIGHT equ       -1
RSCR_MAXWIDTH  equ       -2
RSCR_MAXHEIGHT equ       -2

; TagItems for Retina_OpenScreen():

RSA_BitMap     equ       TAG_USER+1         ;use this BitMap
RSA_DBufBitMap equ       TAG_USER+2         ;not supported yet
RSA_ErrorCode  equ       TAG_USER+3         ;return an error code

; values for RSA_ErrorCode:

ROSERR_NONE         equ  0   ; everything ok or unknown error
ROSERR_ID           equ  1   ; unknown monitor-ID
ROSERR_DEFAULTID    equ  2   ; unknown default monitor-ID
ROSERR_TOOBIG       equ  3   ; screen size is too big
ROSERR_NOMEM        equ  4   ; couldn't get normal memory
ROSERR_NORETINAMEM  equ  5   ; couldn't get Retina graphics memory

; Flags for _rs_Flags:

 BITDEF RSF,DONTCLEARONOPEN,0
 BITDEF RSF,DONTCLEARONCLOSE,1
 BITDEF RSF,DOUBLEBUFFER,2
 BITDEF RSF,CUSTOMBITMAP,3
 BITDEF RSF,CUSTOMDBUFBITMAP,4              ;currently not supported
 BITDEF RSF,AUTOADJUST,5                    ;currently not supported

  STRUCTURE __RetinaScreen,LN_SIZE          ;ListNode for internal use only
               WORD      _rs_Width          ;number of pixels in one horizontal line
               WORD      _rs_Height         ;number of lines
               LONG      _rs_BitMap         ;the screen's address in Retina memory
               LONG      _rs_DBufBitMap     ;used for double buffered screens

               LONG      _rs_Flags

               LABEL     _rs_APen
               BYTE      _rs_APenA_reserved ;reserved for alpha channel support
               BYTE      _rs_APenR          ;the red component (true color only)
               BYTE      _rs_APenG          ;the green component (true color only)
               LABEL     _rs_APen256        ;the number of the palette register
                                            ;  on a 256 color screen
               BYTE      _rs_APenB          ;  or the blue component (true color)

               BYTE      _rs_DrawMode       ;RDM_JAM1, ...

               ALIGNLONG

               WORD      _rs_BytesPerPixel  ;number of bytes per pixel (1..3)
               WORD      _rs_Modulo         ;number of bytes in one line
               APTR      _rs_Monitor        ;^ auf benutzten Monitor

               LABEL     _rs_PUBSIZE        ;never use this!
;---------------------------------------------------------------------------
; These are the currently available Mode-ID's you need for OpenScreen()

MID_DEFAULT_08 equ       -1
MID_DEFAULT_16 equ       -2
MID_DEFAULT_24 equ       -3

MID_UNKNOWN    equ       0

MID_HIRES_8    equ       1
MID_LORES_16   equ       2
MID_HIRES_24   equ       3
; 4..10 currently have no name
;---------------------------------------------------------------------------
; the public-part of retina.library

    STRUCTURE _xy_RetinaBase,LIB_SIZE

               APTR      _rb_BoardAddress
               APTR      _rb_SegmentAddress

               STRUCT    _rb_ScreenList,LH_SIZE     ;READ ONLY! Each access to this
                                                    ;list must be inside OwnRetina()
                                                    ;and DisownRetina()!
                                                    ;The first entry in this list is
                                                    ;the top (visible) screen. This
                                                    ;list may be empty!

               ULONG     _rb_reserved

    LABEL   _rb_PUBSIZE           ; you should never use this

; subsequent fields in the library base are RETINA PRIVATE
;---------------------------------------------------------------------------
; You may use this macro to call the functions in retina.library. To avoid
; conflicts with existing functions, they have a slightly unusual name.
CALLRET:     MACRO
               move.l    a6,-(a7)
               movea.l   _RetinaBase(a5),a6
               jsr       _LVORetina_\1(a6)
               movea.l   (a7)+,a6
             ENDM
;---------------------------------------------------------------------------
