OPTION EXPLICIT

IMPORT OSHardware
IMPORT OSExec
IMPORT OSUtility

TYPE Rectangle
    AS INTEGER     MinX,MinY
    AS INTEGER     MaxX,MaxY
END TYPE

TYPE Rect
    AS LONG     MinX,MinY
    AS LONG     MaxX,MaxY
END TYPE

TYPE Point
    AS INTEGER x, y
END TYPE

TYPE Layer
    AS Layer PTR       front, back
    AS ClipRect PTR    ClipRect
    AS RastPort PTR    rp
    AS Rectangle       bounds
    AS UBYTE           reserved(3)
    AS UINTEGER        priority
    AS UINTEGER        Flags
    AS BitMap PTR      SuperBitMap
    AS ClipRect PTR    SuperClipRect
    AS ANY PTR         Window
    AS INTEGER         Scroll_X,Scroll_Y
    AS ClipRect PTR    cr,cr2,crnew
    AS ClipRect PTR    SuperSaveClipRects
    AS ClipRect PTR    _cliprects
    AS Layer_Info PTR  LayerInfo
    AS SignalSemaphore Lock
    AS Hook PTR        BackFill
    AS ULONG           reserved1
    AS Region PTR      ClipRegion
    AS Region PTR      saveClipRects
    AS INTEGER         Width,Height
    AS UBYTE           reserved2(17)
    AS Region PTR      DamageList
    REM AS through PTR    /
END TYPE

TYPE ClipRect
    AS ClipRect PTR    Next
    AS ClipRect PTR    prev
    AS Layer PTR       lobs
    AS BitMap PTR      BitMap
    AS Rectangle       bounds
    AS ANY  PTR        _p1
    AS ANY  PTR        _p2
    AS LONG            reserved
    AS LONG            Flags
END TYPE

CONST AS LONG CR_NEEDS_NO_CONCEALED_RASTERS = 1
CONST AS LONG CR_NEEDS_NO_LAYERBLIT_DAMAGE  = 2

CONST AS ULONG ISLESSX                      = 1
CONST AS ULONG ISLESSY                      = 2
CONST AS ULONG ISGRTRX                      = 4
CONST AS ULONG ISGRTRY                      = 8

CONST AS INTEGER PRESERVE_COLORS            = 1
CONST AS INTEGER AVOID_FLICKER              = 2
CONST AS INTEGER IGNORE_MCOMPAT             = 4
CONST AS INTEGER BIDTAG_COERCE              = 1

CONST AS INTEGER BORDERHIT                  = 0
CONST AS INTEGER TOPHIT                     = 1
CONST AS INTEGER BOTTOMHIT                  = 2
CONST AS INTEGER LEFTHIT                    = 4
CONST AS INTEGER RIGHTHIT                   = 8

CONST AS INTEGER COPPER_MOVE                = 0
CONST AS INTEGER COPPER_WAIT                = 1
CONST AS INTEGER CPRNXTBUF                  = 2
CONST AS UINTEGER CPR_NT_LOF                = &H8000
CONST AS UINTEGER CPR_NT_SHT                = &H4000
CONST AS UINTEGER CPR_NT_SYS                = &H2000

TYPE CopIns
    AS INTEGER              OpCode
    AS ULONG                OpData
END TYPE

TYPE cprlist
    AS cprlist PTR          Next
    AS UINTEGER PTR         start
    AS INTEGER              MaxCount
END TYPE

TYPE ColorMap
    AS UBYTE                Flags
    AS UBYTE                Type
    AS UINTEGER             Count
    AS ANY PTR              ColorTable
    AS ViewPortExtra PTR    cm_vpe
    AS ANY PTR              LowColorBits
    AS UBYTE                TransparencyPlane
    AS UBYTE                SpriteResolution
    AS UBYTE                SpriteResDefault
    AS UBYTE                AuxFlags
    AS ViewPort PTR         cm_vp
    AS ANY PTR              NormalDisplayInfo
    AS ANY PTR              CoerceDisplayInfo
    AS TagItem PTR          cm_batch_items
    AS ULONG                VPModeID
    AS PaletteExtra PTR     PalExtra
    AS UINTEGER             SpriteBase_Even
    AS UINTEGER             SpriteBase_Odd
    AS UINTEGER             Bp_0_base
    AS UINTEGER             Bp_1_base
END TYPE

TYPE ViewPort
    AS ViewPort PTR         Next
    AS ColorMap PTR         ColorMap
    AS CopList PTR          DspIns
    AS CopList PTR          SprIns
    AS CopList PTR          ClrIns
    AS UCopList PTR         UCopIns
    AS INTEGER              DWidth,DHeight
    AS INTEGER              DxOffset,DyOffset
    AS UINTEGER             Modes
    AS UBYTE                SpritePriorities
    AS UBYTE                ExtendedModes
    AS RasInfo PTR          RasInfo
END TYPE

TYPE CopList
    AS CopList PTR          Next
    AS CopList PTR          _CopList
    AS ViewPort PTR         _ViewPort
    AS CopIns PTR           CopIns
    AS CopIns PTR           CopPtr
    AS UINTEGER PTR         CopLStart
    AS UINTEGER PTR         CopSStart
    AS INTEGER              Count
    AS INTEGER              MaxCount
    AS INTEGER              DyOffset
    AS UINTEGER PTR         Cop2Start
    AS UINTEGER PTR         Cop3Start
    AS UINTEGER PTR         Cop4Start
    AS UINTEGER PTR         Cop5Start
    AS UINTEGER             SLRepeat
    AS UINTEGER             Flags
END TYPE

CONST AS UINTEGER EXACT_LINE = 1
CONST AS UINTEGER HALF_LINE  = 2

TYPE UCopList
    AS UCopList PTR         Next
    AS CopList PTR          FirstCopList
    AS CopList PTR          CopList
END TYPE

TYPE copinit
    AS UINTEGER             vsync_hblank(1)
    AS UINTEGER             diagstrt(11)
    AS UINTEGER             fm0(1)
    AS UINTEGER             diwstart(9)
    AS UINTEGER             bplcon2(1)
    AS UINTEGER             sprfix(2*8-1)
    AS UINTEGER             sprstrtup(2*8*2-1)
    AS UINTEGER             wait14(1)
    AS UINTEGER             norm_hblank(1)
    AS UINTEGER             jump(1)
    AS UINTEGER             wait_forever(5)
    AS UINTEGER             sprstop(7)
END TYPE

CONST AS UINTEGER MODE_640              = &H8000
CONST AS UINTEGER PLNCNTMSK             = &H7
CONST AS UINTEGER PLNCNTSHFT            = 12
CONST AS UINTEGER PF2PRI                = &H40
CONST AS UINTEGER COLORON               = &H0200
CONST AS UINTEGER DBLPF                 = &H400
CONST AS UINTEGER HOLDNMODIFY           = &H800
CONST AS UINTEGER INTERLACE             = 4

CONST AS UINTEGER PFA_FINE_SCROLL       = &HF
CONST AS UINTEGER PFB_FINE_SCROLL_SHIFT = 4
CONST AS UINTEGER PF_FINE_SCROLL_MASK   = &HF
CONST AS UINTEGER DIW_HORIZ_POS         = &H7F
CONST AS UINTEGER DIW_VRTCL_POS         = &H1FF
CONST AS UINTEGER DIW_VRTCL_POS_SHIFT   = 7
CONST AS UINTEGER DFTCH_MASK            = &HFF
CONST AS UINTEGER VPOSRLOF              = &H8000

CONST AS ULONG DTAG_DISP                = &H80000000
CONST AS ULONG DTAG_DIMS                = &H80001000
CONST AS ULONG DTAG_MNTR                = &H80002000
CONST AS ULONG DTAG_NAME                = &H80003000
CONST AS ULONG DTAG_VEC                 = &H80004000

TYPE QueryHeader
    AS ULONG     StructID
    AS ULONG     DisplayID
    AS ULONG     SkipID
    AS ULONG     Length
END TYPE

TYPE DisplayInfo
    AS QueryHeader     Header
    AS UINTEGER        NotAvailable
    AS ULONG           PropertyFlags
    AS Point           Resolution
    AS UINTEGER        PixelSpeed
    AS UINTEGER        NumStdSprites
    AS UINTEGER        PaletteRange
    AS Point           SpriteResolution
    AS UBYTE           pad(3)
    AS UBYTE           RedBits
    AS UBYTE           GreenBits
    AS UBYTE           BlueBits
    AS UBYTE           pad2(4)
    AS ULONG           reserved(1)
END TYPE

CONST AS UINTEGER DI_AVAIL_NOCHIPS        = &H0001
CONST AS UINTEGER DI_AVAIL_NOMONITOR      = &H0002
CONST AS UINTEGER DI_AVAIL_NOTWITHGENLOCK = &H0004

CONST AS ULONG DIPF_IS_LACE               = &H00000001
CONST AS ULONG DIPF_IS_DUALPF             = &H00000002
CONST AS ULONG DIPF_IS_PF2PRI             = &H00000004
CONST AS ULONG DIPF_IS_HAM                = &H00000008
CONST AS ULONG DIPF_IS_ECS                = &H00000010
CONST AS ULONG DIPF_IS_AA                 = &H00010000
CONST AS ULONG DIPF_IS_PAL                = &H00000020
CONST AS ULONG DIPF_IS_SPRITES            = &H00000040
CONST AS ULONG DIPF_IS_GENLOCK            = &H00000080
CONST AS ULONG DIPF_IS_WB                 = &H00000100
CONST AS ULONG DIPF_IS_DRAGGABLE          = &H00000200
CONST AS ULONG DIPF_IS_PANELLED           = &H00000400
CONST AS ULONG DIPF_IS_BEAMSYNC           = &H00000800
CONST AS ULONG DIPF_IS_EXTRAHALFBRITE     = &H00001000
CONST AS ULONG DIPF_IS_SPRITES_ATT        = &H00002000
CONST AS ULONG DIPF_IS_SPRITES_CHNG_RES   = &H00004000
CONST AS ULONG DIPF_IS_SPRITES_BORDER     = &H00008000
CONST AS ULONG DIPF_IS_SCANDBL            = &H00020000
CONST AS ULONG DIPF_IS_SPRITES_CHNG_BASE  = &H00040000
CONST AS ULONG DIPF_IS_SPRITES_CHNG_PRI   = &H00080000
CONST AS ULONG DIPF_IS_DBUFFER            = &H00100000
CONST AS ULONG DIPF_IS_PROGBEAM           = &H00200000
CONST AS ULONG DIPF_IS_FOREIGN            = &H80000000

TYPE DimensionInfo
    AS QueryHeader         Header
    AS UINTEGER            MaxDepth
    AS UINTEGER            MinRasterWidth
    AS UINTEGER            MinRasterHeight
    AS UINTEGER            MaxRasterWidth
    AS UINTEGER            MaxRasterHeight
    AS Rectangle           Nominal
    AS Rectangle           MaxOScan
    AS Rectangle           VideoOScan
    AS Rectangle           TxtOScan
    AS Rectangle           StdOScan
    AS UBYTE               pad(13)
    AS ULONG               reserved(1)
END TYPE

TYPE MonitorInfo
    AS QueryHeader         Header
    AS MonitorSpec PTR     Mspc
    AS Point               ViewPosition
    AS Point               ViewResolution
    AS Rectangle           ViewPositionRange
    AS UINTEGER            TotalRows
    AS UINTEGER            TotalColorClocks
    AS UINTEGER            MinRow
    AS INTEGER             Compatibility
    AS UBYTE               pad(31)
    AS Point               MouseTicks
    AS Point               DefaultViewPosition
    AS ULONG               PreferredModeID
    AS ULONG               reserved(1)
END TYPE

CONST AS INTEGER MCOMPAT_MIXED  = 0
CONST AS INTEGER MCOMPAT_SELF   = 1
CONST AS INTEGER MCOMPAT_NOBODY = -1

CONST AS INTEGER DISPLAYNAMELEN = 32

TYPE NameInfo
    AS QueryHeader   Header
    AS UBYTE         Name(DISPLAYNAMELEN-1)
    AS ULONG         reserved(1)
END TYPE

TYPE VecInfo
    AS QueryHeader  Header
    AS ANY PTR      Vec
    AS ANY PTR      Data
    AS UINTEGER     Type
    AS UINTEGER     pad(2)
    AS ULONG        reserved(1)
END TYPE

CONST AS UINTEGER SUSERFLAGS     = &H00FF
CONST AS UINTEGER VSPRITE        = &H0001
CONST AS UINTEGER SAVEBACK       = &H0002
CONST AS UINTEGER OVERLAY        = &H0004
CONST AS UINTEGER MUSTDRAW       = &H0008
CONST AS UINTEGER BACKSAVED      = &H0100
CONST AS UINTEGER BOBUPDATE      = &H0200
CONST AS UINTEGER GELGONE        = &H0400
CONST AS UINTEGER VSOVERFLOW     = &H0800
CONST AS UINTEGER BUSERFLAGS     = &H00FF
CONST AS UINTEGER SAVEBOB        = &H0001
CONST AS UINTEGER BOBISCOMP      = &H0002
CONST AS UINTEGER BWAITING       = &H0100
CONST AS UINTEGER BDRAWN         = &H0200
CONST AS UINTEGER BOBSAWAY       = &H0400
CONST AS UINTEGER BOBNIX         = &H0800
CONST AS UINTEGER SAVEPRESERVE   = &H1000
CONST AS UINTEGER OUTSTEP        = &H2000
CONST AS UINTEGER ANFRACSIZE     = 6
CONST AS UINTEGER ANIMHALF       = &H0020
CONST AS UINTEGER RINGTRIGGER    = &H0001

TYPE Bob
    AS INTEGER        Flags
    AS INTEGER PTR    SaveBuffer
    AS INTEGER PTR    ImageShadow
    AS Bob PTR        Before
    AS Bob PTR        After
    AS VSprite PTR    BobVSprite
    AS AnimComp PTR   BobComp
    AS DBufPacket PTR DBuffer
    AS INTEGER        BUserExt
END TYPE

TYPE VSprite
    AS VSprite PTR    NextVSprite
    AS VSprite PTR    PrevVSprite
    AS VSprite PTR    DrawPath
    AS VSprite PTR    ClearPath
    AS INTEGER        OldY, OldX
    AS INTEGER        Flags
    AS INTEGER        Y, X
    AS INTEGER        Height
    AS INTEGER        Width
    AS INTEGER        Depth
    AS INTEGER        MeMask
    AS INTEGER        HitMask
    AS INTEGER PTR    ImageData
    AS INTEGER PTR    BorderLine
    AS INTEGER PTR    CollMask
    AS INTEGER PTR    SprColors
    AS Bob PTR        VSBob
    AS BYTE           PlanePick
    AS BYTE           PlaneOnOff
    AS INTEGER        VUserExt
END TYPE

TYPE AnimComp
    AS INTEGER        Flags
    AS INTEGER        Timer
    AS INTEGER        TimeSet
    AS AnimComp PTR   NextComp
    AS AnimComp PTR   PrevComp
    AS AnimComp PTR   NextSeq
    AS AnimComp PTR   PrevSeq
    REM FIXME AS INTEGER     (*AnimCRoutine) __CLIB_PROTOTYPE((struct AnimComp *))
    AS ANY PTR        AnimCRoutine
    AS INTEGER        YTrans
    AS INTEGER        XTrans
    AS AnimOb PTR     HeadOb
    AS Bob PTR        AnimBob
END TYPE

TYPE AnimOb
    AS AnimOb PTR     NextOb, PrevOb
    AS LONG           Clock
    AS INTEGER        AnOldY, AnOldX
    AS INTEGER        AnY, AnX
    AS INTEGER        YVel, XVel
    AS INTEGER        YAccel, XAccel
    AS INTEGER        RingYTrans, RingXTrans
    REM FIXME AS INTEGER     (*AnimORoutine) __CLIB_PROTOTYPE((struct AnimOb *))
    AS ANY PTR        AnimORoutine
    AS AnimComp PTR   HeadComp
    AS INTEGER        AUserExt
END TYPE

TYPE DBufPacket
    AS INTEGER        BufY, BufX
    AS VSprite PTR    BufPath
    AS INTEGER PTR    BufBuffer
END TYPE

CONST AS INTEGER B2NORM     = 0
CONST AS INTEGER B2SWAP     = 1
CONST AS INTEGER B2BOBBER   = 2

TYPE collTable
    REM FIXME AS LONG     (*collPtrs[16]) __CLIB_PROTOTYPE((struct VSprite *,struct VSprite *))
    AS ANY PTR  collPtrs(15)
END TYPE

TYPE ExtendedNode
    AS Node PTR         xln_Succ
    AS Node PTR         xln_Pred
    AS UBYTE            xln_Type
    AS BYTE             xln_Pri
    AS STRING           xln_Name
    AS UBYTE            xln_Subsystem
    AS UBYTE            xln_Subtype
    AS LONG             xln_Library
    AS FUNCTION AS LONG xln_Init
END TYPE

CONST AS UBYTE SS_GRAPHICS          = &H02
CONST AS UBYTE VIEW_EXTRA_TYPE      = 1
CONST AS UBYTE VIEWPORT_EXTRA_TYPE  = 2
CONST AS UBYTE SPECIAL_MONITOR_TYPE = 3
CONST AS UBYTE MONITOR_SPEC_TYPE    = 4

TYPE MonitorSpec
    AS ExtendedNode     ms_Node
    AS UINTEGER     ms_Flags
    AS LONG     ratioh
    AS LONG     ratiov
    AS UINTEGER     total_rows
    AS UINTEGER     total_colorclocks
    AS UINTEGER     DeniseMaxDisplayColumn
    AS UINTEGER     BeamCon0
    AS UINTEGER     min_row
    AS SpecialMonitor PTR    ms_Special
    AS UINTEGER     ms_OpenCount
    AS ANY PTR  ms_transform
    AS ANY PTR  ms_translate
    AS ANY PTR  ms_scale
    REM FIXME AS LONG     (*ms_transform)()
    REM FIXME AS LONG     (*ms_translate)()
    REM FIXME AS LONG     (*ms_scale)()
    AS UINTEGER     ms_xoffset
    AS UINTEGER     ms_yoffset
    AS Rectangle     ms_LegalView
    AS ANY PTR  ms_maxoscan
    AS ANY PTR  ms_videoscan
    REM FIXME AS LONG     (*ms_maxoscan)()
    REM FIXME AS LONG     (*ms_videoscan)()
    AS UINTEGER     DeniseMinDisplayColumn
    AS ULONG     DisplayCompatible
    AS List     DisplayInfoDataBase
    AS SignalSemaphore     DisplayInfoDataBaseSemaphore
    AS ANY PTR  ms_MrgCop
    AS ANY PTR  ms_LoadView
    AS ANY PTR  ms_KillView
    REM FIXME AS LONG     (*ms_MrgCop)()
    REM FIXME AS LONG     (*ms_LoadView)()
    REM FIXME AS LONG     (*ms_KillView)()
END TYPE

CONST AS UINTEGER FROM_MONITOR          = 1
CONST AS UINTEGER STANDARD_XOFFSET      = 9
CONST AS UINTEGER STANDARD_YOFFSET      = 0

CONST AS UINTEGER MSB_REQUEST_NTSC      = 0
CONST AS UINTEGER MSB_REQUEST_PAL       = 1
CONST AS UINTEGER MSB_REQUEST_SPECIAL   = 2
CONST AS UINTEGER MSB_REQUEST_A2024     = 3
CONST AS UINTEGER MSB_DOUBLE_SPRITES    = 4
CONST AS UINTEGER MSF_REQUEST_NTSC      = 1 SHL MSB_REQUEST_NTSC
CONST AS UINTEGER MSF_REQUEST_PAL       = 1 SHL MSB_REQUEST_PAL
CONST AS UINTEGER MSF_REQUEST_SPECIAL   = 1 SHL MSB_REQUEST_SPECIAL
CONST AS UINTEGER MSF_REQUEST_A2024     = 1 SHL MSB_REQUEST_A2024
CONST AS UINTEGER MSF_DOUBLE_SPRITES    = 1 SHL MSB_DOUBLE_SPRITES

CONST AS UINTEGER REQUEST_NTSC          = 1 SHL MSB_REQUEST_NTSC
CONST AS UINTEGER REQUEST_PAL           = 1 SHL MSB_REQUEST_PAL
CONST AS UINTEGER REQUEST_SPECIAL       = 1 SHL MSB_REQUEST_SPECIAL
CONST AS UINTEGER REQUEST_A2024         = 1 SHL MSB_REQUEST_A2024

CONST AS UINTEGER STANDARD_MONITOR_MASK = REQUEST_NTSC OR REQUEST_PAL

CONST AS UINTEGER STANDARD_NTSC_ROWS    = 262
CONST AS UINTEGER STANDARD_PAL_ROWS     = 312
CONST AS UINTEGER STANDARD_COLORCLOCKS  = 226
CONST AS UINTEGER STANDARD_DENISE_MAX   = 455
CONST AS UINTEGER STANDARD_DENISE_MIN   = 93
CONST AS UINTEGER STANDARD_NTSC_BEAMCON = &H0000
CONST AS UINTEGER STANDARD_PAL_BEAMCON  = DISPLAYPAL

CONST AS UINTEGER SPECIAL_BEAMCON       = VARVBLANK OR LOLDIS OR VARVSYNC OR VARHSYNC OR VARBEAM OR CSBLANK OR VSYNCTRUE

CONST AS UINTEGER MIN_NTSC_ROW          = 21
CONST AS UINTEGER MIN_PAL_ROW           = 29

CONST AS UBYTE STANDARD_VIEW_X          = &H81
CONST AS UBYTE STANDARD_VIEW_Y          = &H2C
CONST AS UBYTE STANDARD_HBSTRT          = &H06
CONST AS UBYTE STANDARD_HSSTRT          = &H0B
CONST AS UBYTE STANDARD_HSSTOP          = &H1C
CONST AS UBYTE STANDARD_HBSTOP          = &H2C
CONST AS UINTEGER STANDARD_VBSTRT       = &H0122
CONST AS UINTEGER STANDARD_VSSTRT       = &H02A6
CONST AS UINTEGER STANDARD_VSSTOP       = &H03AA
CONST AS UINTEGER STANDARD_VBSTOP       = &H1066
CONST AS UINTEGER VGA_COLORCLOCKS       = STANDARD_COLORCLOCKS/2
CONST AS UINTEGER VGA_TOTAL_ROWS        = STANDARD_NTSC_ROWS*2
CONST AS UINTEGER VGA_DENISE_MIN        = 59
CONST AS UINTEGER MIN_VGA_ROW           = 29
CONST AS UBYTE VGA_HBSTRT               = &H08
CONST AS UBYTE VGA_HSSTRT               = &H0E
CONST AS UBYTE VGA_HSSTOP               = &H1C
CONST AS UBYTE VGA_HBSTOP               = &H1E
CONST AS UINTEGER VGA_VBSTRT            = &H0000
CONST AS UINTEGER VGA_VSSTRT            = &H0153
CONST AS UINTEGER VGA_VSSTOP            = &H0235
CONST AS UINTEGER VGA_VBSTOP            = &H0CCD

CONST AS UINTEGER VGA70_COLORCLOCKS     = (STANDARD_COLORCLOCKS/2)
CONST AS UINTEGER VGA70_TOTAL_ROWS      = 449
CONST AS UINTEGER VGA70_DENISE_MIN      = 59
CONST AS UINTEGER MIN_VGA70_ROW         = 35
CONST AS UBYTE VGA70_HBSTRT             = &H08
CONST AS UBYTE VGA70_HSSTRT             = &H0E
CONST AS UBYTE VGA70_HSSTOP             = &H1C
CONST AS UBYTE VGA70_HBSTOP             = &H1E
CONST AS UINTEGER VGA70_VBSTRT          = &H0000
CONST AS UINTEGER VGA70_VSSTRT          = &H02A6
CONST AS UINTEGER VGA70_VSSTOP          = &H0388
CONST AS UINTEGER VGA70_VBSTOP          = &H0F73
CONST AS UINTEGER VGA70_BEAMCON         = SPECIAL_BEAMCON XOR VSYNCTRUE
CONST AS UBYTE BROADCAST_HBSTRT         = &H01
CONST AS UBYTE BROADCAST_HSSTRT         = &H06
CONST AS UBYTE BROADCAST_HSSTOP         = &H17
CONST AS UBYTE BROADCAST_HBSTOP         = &H27
CONST AS UINTEGER BROADCAST_VBSTRT      = &H0000
CONST AS UINTEGER BROADCAST_VSSTRT      = &H02A6
CONST AS UINTEGER BROADCAST_VSSTOP      = &H054C
CONST AS UINTEGER BROADCAST_VBSTOP      = &H1C40
CONST AS UINTEGER BROADCAST_BEAMCON     = LOLDIS OR CSBLANK
CONST AS UINTEGER RATIO_FIXEDPART       = 4
CONST AS UINTEGER RATIO_UNITY           = 1 SHL RATIO_FIXEDPART

TYPE AnalogSignalInterval
    AS UINTEGER     asi_Start
    AS UINTEGER     asi_Stop
END TYPE

TYPE SpecialMonitor
    AS ExtendedNode             spm_Node
    AS UINTEGER                 spm_Flags
    AS FUNCTION AS LONG         do_monitor
    AS FUNCTION AS LONG         reserved1
    AS FUNCTION AS LONG         reserved2
    AS FUNCTION AS LONG         reserved3
    AS AnalogSignalInterval     hblank
    AS AnalogSignalInterval     vblank
    AS AnalogSignalInterval     hsync
    AS AnalogSignalInterval     vsync
END TYPE

TYPE GfxBase
    AS Library     LibNode
    AS View PTR    ActiView
    AS copinit PTR    copinit
    AS LONG PTR    cia
    AS LONG PTR    blitter
    AS UINTEGER PTR    LOFlist
    AS UINTEGER PTR    SHFlist
    AS bltnode PTR    blthd,blttl
    AS bltnode PTR    bsblthd,bsblttl
    AS Interrupt     vbsrv,timsrv,bltsrv
    AS List     TextFonts
    AS TextFont PTR    DefaultFont
    AS UINTEGER     Modes
    AS BYTE     VBlank
    AS BYTE     Debug
    AS INTEGER     BeamSync
    AS INTEGER     system_bplcon0
    AS UBYTE     SpriteReserved
    AS UBYTE     bytereserved
    AS UINTEGER     Flags
    AS INTEGER     BlitLock
    AS INTEGER     BlitNest
    AS List     BlitWaitQ
    AS Task PTR    BlitOwner
    AS List     TOF_WaitQ
    AS UINTEGER     DisplayFlags
    AS SimpleSprite PTR    SimpleSprites
    AS UINTEGER     MaxDisplayRow
    AS UINTEGER     MaxDisplayColumn
    AS UINTEGER     NormalDisplayRows
    AS UINTEGER     NormalDisplayColumns
    AS UINTEGER     NormalDPMX
    AS UINTEGER     NormalDPMY
    AS SignalSemaphore PTR    LastChanceMemory
    AS UINTEGER PTR    LCMptr
    AS UINTEGER     MicrosPerLine
    AS UINTEGER     MinDisplayColumn
    AS UBYTE     ChipRevBits0
    AS UBYTE     MemType
    AS UBYTE     crb_reserved(3)
    AS UINTEGER     monitor_id
    AS ULONG     hedley(7)
    AS ULONG     hedley_sprites(7)
    AS ULONG     hedley_sprites1(7)
    AS INTEGER     hedley_count
    AS UINTEGER     hedley_flags
    AS INTEGER     hedley_tmp
    AS LONG PTR    hash_table
    AS UINTEGER     current_tot_rows
    AS UINTEGER     current_tot_cclks
    AS UBYTE     hedley_hint
    AS UBYTE     hedley_hint2
    AS ULONG     nreserved(3)
    AS LONG PTR    a2024_sync_raster
    AS UINTEGER     control_delta_pal
    AS UINTEGER     control_delta_ntsc
    AS MonitorSpec PTR    current_monitor
    AS List     MonitorList
    AS MonitorSpec PTR    default_monitor
    AS SignalSemaphore PTR    MonitorListSemaphore
    AS ANY PTR     DisplayInfoDataBase
    AS UINTEGER     TopLine
    AS SignalSemaphore PTR    ActiViewCprSemaphore
    AS ULONG PTR    UtilBase
    AS ULONG PTR    ExecBase
    AS UBYTE PTR    bwshifts
    AS UINTEGER PTR    StrtFetchMasks
    AS UINTEGER PTR    StopFetchMasks
    AS UINTEGER PTR    Overrun
    AS INTEGER PTR    RealStops
    AS UINTEGER     SpriteWidth
    AS UINTEGER     SpriteFMode
    AS BYTE     SoftSprites
    AS BYTE     arraywidth
    AS UINTEGER     DefaultSpriteWidth
    AS BYTE     SprMoveDisable
    AS UBYTE     WantChips
    AS UBYTE     BoardMemType
    AS UBYTE     Bugs
    AS ULONG PTR    gb_LayersBase
    AS ULONG     ColorMask
    AS ANY PTR      IVector
    AS ANY PTR      IData
    AS ULONG     SpecialCounter
    AS ANY PTR      DBList
    AS UINTEGER     MonitorFlags
    AS UBYTE     ScanDoubledSprites
    AS UBYTE     BP3Bits
    AS AnalogSignalInterval     MonitorVBlank
    AS MonitorSpec PTR    natural_monitor
    AS ANY PTR      ProgData
    AS UBYTE     ExtSprites
    AS UBYTE     pad3
    AS UINTEGER     GfxFlags
    AS ULONG     VBCounter
    AS SignalSemaphore PTR    HashTableSemaphore
    AS ULONG PTR    HWEmul(8)
END TYPE

REM #define ChunkyToPlanarPtr HWEmul[0]

CONST AS UINTEGER NTSC = 1
CONST AS UINTEGER GENLOC = 2
CONST AS UINTEGER PAL = 4
CONST AS UINTEGER TODA_SAFE = 8
CONST AS UINTEGER REALLY_PAL = 16
CONST AS UINTEGER LPEN_SWAP_FRAMES = 32

CONST AS UINTEGER BLITMSG_FAULT = 4

CONST AS UBYTE GFXB_BIG_BLITS = 0
CONST AS UBYTE GFXB_HR_AGNUS = 0
CONST AS UBYTE GFXB_HR_DENISE = 1
CONST AS UBYTE GFXB_AA_ALICE = 2
CONST AS UBYTE GFXB_AA_LISA = 3
CONST AS UBYTE GFXB_AA_MLISA = 4
CONST AS UBYTE GFXF_BIG_BLITS = 1
CONST AS UBYTE GFXF_HR_AGNUS = 1
CONST AS UBYTE GFXF_HR_DENISE = 2
CONST AS UBYTE GFXF_AA_ALICE = 4
CONST AS UBYTE GFXF_AA_LISA = 8
CONST AS UBYTE GFXF_AA_MLISA = 16

CONST AS ULONG SETCHIPREV_A    = GFXF_HR_AGNUS
CONST AS ULONG SETCHIPREV_ECS  = GFXF_HR_AGNUS OR GFXF_HR_DENISE
CONST AS ULONG SETCHIPREV_AA   = GFXF_AA_ALICE OR GFXF_AA_LISA OR SETCHIPREV_ECS
CONST AS ULONG SETCHIPREV_BEST = &Hffffffff

CONST AS UBYTE BUS_16 = 0
CONST AS UBYTE NML_CAS = 0
CONST AS UBYTE BUS_32 = 1
CONST AS UBYTE DBL_CAS = 2
CONST AS UBYTE BANDWIDTH_1X    = BUS_16 OR NML_CAS
CONST AS UBYTE BANDWIDTH_2XNML = BUS_32
CONST AS UBYTE BANDWIDTH_2XDBL = DBL_CAS
CONST AS UBYTE BANDWIDTH_4X    = BUS_32 OR DBL_CAS

CONST AS UINTEGER NEW_DATABASE = 1

CONST AS UINTEGER BITSET = &H8000
CONST AS UINTEGER BITCLR = 0

TYPE BitMap
    AS UINTEGER     BytesPerRow
    AS UINTEGER     Rows
    AS UBYTE     Flags
    AS UBYTE     Depth
    AS UINTEGER     pad
    AS UBYTE PTR     Planes(7)
END TYPE

CONST AS ULONG BMB_CLEAR = 0
CONST AS ULONG BMB_DISPLAYABLE = 1
CONST AS ULONG BMB_INTERLEAVED = 2
CONST AS ULONG BMB_STANDARD = 3
CONST AS ULONG BMB_MINPLANES = 4
CONST AS ULONG BMF_CLEAR       = 1 SHL BMB_CLEAR
CONST AS ULONG BMF_DISPLAYABLE = 1 SHL BMB_DISPLAYABLE
CONST AS ULONG BMF_INTERLEAVED = 1 SHL BMB_INTERLEAVED
CONST AS ULONG BMF_STANDARD    = 1 SHL BMB_STANDARD
CONST AS ULONG BMF_MINPLANES   = 1 SHL BMB_MINPLANES

CONST AS ULONG BMA_HEIGHT = 0
CONST AS ULONG BMA_DEPTH = 4
CONST AS ULONG BMA_WIDTH = 8
CONST AS ULONG BMA_FLAGS = 12

TYPE Isrvstr
    AS Node     is_Node
    AS Isrvstr PTR    Iptr
    AS ANY PTR  code
    AS ANY PTR  ccode
    REM FIXME AS LONG     (*code)()
    REM FIXME AS LONG     (*ccode) __CLIB_PROTOTYPE((ANY PTR ))
    AS ANY PTR      Carg
END TYPE

CONST AS UINTEGER LAYERSIMPLE            = 1
CONST AS UINTEGER LAYERSMART             = 2
CONST AS UINTEGER LAYERSUPER             = 4
CONST AS UINTEGER LAYERUPDATING          = &H10
CONST AS UINTEGER LAYERBACKDROP          = &H40
CONST AS UINTEGER LAYERREFRESH           = &H80
CONST AS UINTEGER LAYERIREFRESH          = &H200
CONST AS UINTEGER LAYERIREFRESH2         = &H400
CONST AS UINTEGER LAYER_CLIPRECTS_LOST   = &H100

TYPE Layer_Info
    AS Layer PTR       top_layer
    AS Layer PTR       check_lp
    AS ClipRect PTR    obs
    AS ClipRect PTR    FreeClipRects
    AS LONG            PrivateReserve1
    AS LONG            PrivateReserve2
    AS SignalSemaphore Lock
    AS MinList         gs_Head
    AS INTEGER         PrivateReserve3
    AS ANY PTR         PrivateReserve4
    AS UINTEGER        Flags
    AS BYTE            fatten_count
    AS BYTE            LockLayersCount
    AS INTEGER         PrivateReserve5
    AS ANY PTR         BlankHook
    AS ANY PTR         LayerInfo_extra
END TYPE

CONST AS UINTEGER NEWLAYERINFO_CALLED = 1

CONST AS ULONG INVALID_ID    =        NOT 0

CONST AS ULONG MONITOR_ID_MASK = &HFFFF1000
CONST AS ULONG DEFAULT_MONITOR_ID = &H00000000
CONST AS ULONG NTSC_MONITOR_ID = &H00011000
CONST AS ULONG PAL_MONITOR_ID = &H00021000
CONST AS ULONG LORES_KEY = &H00000000
CONST AS ULONG HIRES_KEY = &H00008000
CONST AS ULONG SUPER_KEY = &H00008020
CONST AS ULONG HAM_KEY = &H00000800
CONST AS ULONG LORESLACE_KEY = &H00000004
CONST AS ULONG HIRESLACE_KEY = &H00008004
CONST AS ULONG SUPERLACE_KEY = &H00008024
CONST AS ULONG HAMLACE_KEY = &H00000804
CONST AS ULONG LORESDPF_KEY = &H00000400
CONST AS ULONG HIRESDPF_KEY = &H00008400
CONST AS ULONG SUPERDPF_KEY = &H00008420
CONST AS ULONG LORESLACEDPF_KEY = &H00000404
CONST AS ULONG HIRESLACEDPF_KEY = &H00008404
CONST AS ULONG SUPERLACEDPF_KEY = &H00008424
CONST AS ULONG LORESDPF2_KEY     = &H00000440
CONST AS ULONG HIRESDPF2_KEY     = &H00008440
CONST AS ULONG SUPERDPF2_KEY     = &H00008460
CONST AS ULONG LORESLACEDPF2_KEY = &H00000444
CONST AS ULONG HIRESLACEDPF2_KEY = &H00008444
CONST AS ULONG SUPERLACEDPF2_KEY = &H00008464
CONST AS ULONG EXTRAHALFBRITE_KEY = &H00000080
CONST AS ULONG EXTRAHALFBRITELACE_KEY = &H00000084
CONST AS ULONG HIRESHAM_KEY = &H00008800
CONST AS ULONG SUPERHAM_KEY = &H00008820
CONST AS ULONG HIRESEHB_KEY = &H00008080
CONST AS ULONG SUPEREHB_KEY = &H000080a0
CONST AS ULONG HIRESHAMLACE_KEY = &H00008804
CONST AS ULONG SUPERHAMLACE_KEY = &H00008824
CONST AS ULONG HIRESEHBLACE_KEY = &H00008084
CONST AS ULONG SUPEREHBLACE_KEY = &H000080a4
CONST AS ULONG LORESSDBL_KEY = &H00000008
CONST AS ULONG LORESHAMSDBL_KEY = &H00000808
CONST AS ULONG LORESEHBSDBL_KEY = &H00000088
CONST AS ULONG HIRESHAMSDBL_KEY = &H00008808
CONST AS ULONG VGA_MONITOR_ID = &H00031000
CONST AS ULONG VGAEXTRALORES_KEY = &H00031004
CONST AS ULONG VGALORES_KEY = &H00039004
CONST AS ULONG VGAPRODUCT_KEY = &H00039024
CONST AS ULONG VGAHAM_KEY = &H00031804
CONST AS ULONG VGAEXTRALORESLACE_KEY = &H00031005
CONST AS ULONG VGALORESLACE_KEY = &H00039005
CONST AS ULONG VGAPRODUCTLACE_KEY = &H00039025
CONST AS ULONG VGAHAMLACE_KEY = &H00031805
CONST AS ULONG VGAEXTRALORESDPF_KEY = &H00031404
CONST AS ULONG VGALORESDPF_KEY = &H00039404
CONST AS ULONG VGAPRODUCTDPF_KEY = &H00039424
CONST AS ULONG VGAEXTRALORESLACEDPF_KEY = &H00031405
CONST AS ULONG VGALORESLACEDPF_KEY = &H00039405
CONST AS ULONG VGAPRODUCTLACEDPF_KEY = &H00039425
CONST AS ULONG VGAEXTRALORESDPF2_KEY        = &H00031444
CONST AS ULONG VGALORESDPF2_KEY             = &H00039444
CONST AS ULONG VGAPRODUCTDPF2_KEY           = &H00039464
CONST AS ULONG VGAEXTRALORESLACEDPF2_KEY    = &H00031445
CONST AS ULONG VGALORESLACEDPF2_KEY         = &H00039445
CONST AS ULONG VGAPRODUCTLACEDPF2_KEY       = &H00039465
CONST AS ULONG VGAEXTRAHALFBRITE_KEY = &H00031084
CONST AS ULONG VGAEXTRAHALFBRITELACE_KEY = &H00031085
CONST AS ULONG VGAPRODUCTHAM_KEY = &H00039824
CONST AS ULONG VGALORESHAM_KEY = &H00039804
CONST AS ULONG VGAEXTRALORESHAM_KEY = VGAHAM_KEY
CONST AS ULONG VGAPRODUCTHAMLACE_KEY = &H00039825
CONST AS ULONG VGALORESHAMLACE_KEY = &H00039805
CONST AS ULONG VGAEXTRALORESHAMLACE_KEY = VGAHAMLACE_KEY
CONST AS ULONG VGAEXTRALORESEHB_KEY     = VGAEXTRAHALFBRITE_KEY
CONST AS ULONG VGAEXTRALORESEHBLACE_KEY = VGAEXTRAHALFBRITELACE_KEY
CONST AS ULONG VGALORESEHB_KEY = &H00039084
CONST AS ULONG VGALORESEHBLACE_KEY = &H00039085
CONST AS ULONG VGAEHB_KEY = &H000390a4
CONST AS ULONG VGAEHBLACE_KEY = &H000390a5
CONST AS ULONG VGAEXTRALORESDBL_KEY = &H00031000
CONST AS ULONG VGALORESDBL_KEY = &H00039000
CONST AS ULONG VGAPRODUCTDBL_KEY = &H00039020
CONST AS ULONG VGAEXTRALORESHAMDBL_KEY = &H00031800
CONST AS ULONG VGALORESHAMDBL_KEY = &H00039800
CONST AS ULONG VGAPRODUCTHAMDBL_KEY = &H00039820
CONST AS ULONG VGAEXTRALORESEHBDBL_KEY = &H00031080
CONST AS ULONG VGALORESEHBDBL_KEY = &H00039080
CONST AS ULONG VGAPRODUCTEHBDBL_KEY = &H000390a0
CONST AS ULONG A2024_MONITOR_ID = &H00041000
CONST AS ULONG A2024TENHERTZ_KEY        = &H00041000
CONST AS ULONG A2024FIFTEENHERTZ_KEY        = &H00049000
CONST AS ULONG PROTO_MONITOR_ID = &H00051000
CONST AS ULONG EURO72_MONITOR_ID        = &H00061000
CONST AS ULONG EURO72EXTRALORES_KEY     = &H00061004
CONST AS ULONG EURO72LORES_KEY          = &H00069004
CONST AS ULONG EURO72PRODUCT_KEY        = &H00069024
CONST AS ULONG EURO72HAM_KEY            = &H00061804
CONST AS ULONG EURO72EXTRALORESLACE_KEY = &H00061005
CONST AS ULONG EURO72LORESLACE_KEY      = &H00069005
CONST AS ULONG EURO72PRODUCTLACE_KEY        = &H00069025
CONST AS ULONG EURO72HAMLACE_KEY        = &H00061805
CONST AS ULONG EURO72EXTRALORESDPF_KEY      = &H00061404
CONST AS ULONG EURO72LORESDPF_KEY       = &H00069404
CONST AS ULONG EURO72PRODUCTDPF_KEY     = &H00069424
CONST AS ULONG EURO72EXTRALORESLACEDPF_KEY  = &H00061405
CONST AS ULONG EURO72LORESLACEDPF_KEY       = &H00069405
CONST AS ULONG EURO72PRODUCTLACEDPF_KEY = &H00069425
CONST AS ULONG EURO72EXTRALORESDPF2_KEY = &H00061444
CONST AS ULONG EURO72LORESDPF2_KEY      = &H00069444
CONST AS ULONG EURO72PRODUCTDPF2_KEY        = &H00069464
CONST AS ULONG EURO72EXTRALORESLACEDPF2_KEY = &H00061445
CONST AS ULONG EURO72LORESLACEDPF2_KEY      = &H00069445
CONST AS ULONG EURO72PRODUCTLACEDPF2_KEY    = &H00069465
CONST AS ULONG EURO72EXTRAHALFBRITE_KEY = &H00061084
CONST AS ULONG EURO72EXTRAHALFBRITELACE_KEY = &H00061085
CONST AS ULONG EURO72PRODUCTHAM_KEY     = &H00069824
CONST AS ULONG EURO72PRODUCTHAMLACE_KEY = &H00069825
CONST AS ULONG EURO72LORESHAM_KEY       = &H00069804
CONST AS ULONG EURO72LORESHAMLACE_KEY       = &H00069805
CONST AS ULONG EURO72EXTRALORESHAM_KEY      = EURO72HAM_KEY
CONST AS ULONG EURO72EXTRALORESHAMLACE_KEY  = EURO72HAMLACE_KEY
CONST AS ULONG EURO72EXTRALORESEHB_KEY      = EURO72EXTRAHALFBRITE_KEY
CONST AS ULONG EURO72EXTRALORESEHBLACE_KEY  = EURO72EXTRAHALFBRITELACE_KEY
CONST AS ULONG EURO72LORESEHB_KEY       = &H00069084
CONST AS ULONG EURO72LORESEHBLACE_KEY       = &H00069085
CONST AS ULONG EURO72EHB_KEY            = &H000690a4
CONST AS ULONG EURO72EHBLACE_KEY        = &H000690a5
CONST AS ULONG EURO72EXTRALORESDBL_KEY      = &H00061000
CONST AS ULONG EURO72LORESDBL_KEY       = &H00069000
CONST AS ULONG EURO72PRODUCTDBL_KEY     = &H00069020
CONST AS ULONG EURO72EXTRALORESHAMDBL_KEY   = &H00061800
CONST AS ULONG EURO72LORESHAMDBL_KEY        = &H00069800
CONST AS ULONG EURO72PRODUCTHAMDBL_KEY      = &H00069820
CONST AS ULONG EURO72EXTRALORESEHBDBL_KEY   = &H00061080
CONST AS ULONG EURO72LORESEHBDBL_KEY        = &H00069080
CONST AS ULONG EURO72PRODUCTEHBDBL_KEY      = &H000690a0
CONST AS ULONG EURO36_MONITOR_ID        = &H00071000
CONST AS ULONG SUPER72_MONITOR_ID       = &H00081000
CONST AS ULONG SUPER72LORESDBL_KEY      = &H00081008
CONST AS ULONG SUPER72HIRESDBL_KEY      = &H00089008
CONST AS ULONG SUPER72SUPERDBL_KEY      = &H00089028
CONST AS ULONG SUPER72LORESHAMDBL_KEY       = &H00081808
CONST AS ULONG SUPER72HIRESHAMDBL_KEY       = &H00089808
CONST AS ULONG SUPER72SUPERHAMDBL_KEY       = &H00089828
CONST AS ULONG SUPER72LORESEHBDBL_KEY       = &H00081088
CONST AS ULONG SUPER72HIRESEHBDBL_KEY       = &H00089088
CONST AS ULONG SUPER72SUPEREHBDBL_KEY       = &H000890a8
CONST AS ULONG DBLNTSC_MONITOR_ID = &H00091000
CONST AS ULONG DBLNTSCLORES_KEY = &H00091000
CONST AS ULONG DBLNTSCLORESFF_KEY = &H00091004
CONST AS ULONG DBLNTSCLORESHAM_KEY = &H00091800
CONST AS ULONG DBLNTSCLORESHAMFF_KEY = &H00091804
CONST AS ULONG DBLNTSCLORESEHB_KEY = &H00091080
CONST AS ULONG DBLNTSCLORESEHBFF_KEY = &H00091084
CONST AS ULONG DBLNTSCLORESLACE_KEY = &H00091005
CONST AS ULONG DBLNTSCLORESHAMLACE_KEY = &H00091805
CONST AS ULONG DBLNTSCLORESEHBLACE_KEY = &H00091085
CONST AS ULONG DBLNTSCLORESDPF_KEY = &H00091400
CONST AS ULONG DBLNTSCLORESDPFFF_KEY = &H00091404
CONST AS ULONG DBLNTSCLORESDPFLACE_KEY = &H00091405
CONST AS ULONG DBLNTSCLORESDPF2_KEY     = &H00091440
CONST AS ULONG DBLNTSCLORESDPF2FF_KEY       = &H00091444
CONST AS ULONG DBLNTSCLORESDPF2LACE_KEY = &H00091445
CONST AS ULONG DBLNTSCHIRES_KEY = &H00099000
CONST AS ULONG DBLNTSCHIRESFF_KEY = &H00099004
CONST AS ULONG DBLNTSCHIRESHAM_KEY = &H00099800
CONST AS ULONG DBLNTSCHIRESHAMFF_KEY = &H00099804
CONST AS ULONG DBLNTSCHIRESLACE_KEY = &H00099005
CONST AS ULONG DBLNTSCHIRESHAMLACE_KEY = &H00099805
CONST AS ULONG DBLNTSCHIRESEHB_KEY = &H00099080
CONST AS ULONG DBLNTSCHIRESEHBFF_KEY = &H00099084
CONST AS ULONG DBLNTSCHIRESEHBLACE_KEY = &H00099085
CONST AS ULONG DBLNTSCHIRESDPF_KEY = &H00099400
CONST AS ULONG DBLNTSCHIRESDPFFF_KEY = &H00099404
CONST AS ULONG DBLNTSCHIRESDPFLACE_KEY = &H00099405
CONST AS ULONG DBLNTSCHIRESDPF2_KEY     = &H00099440
CONST AS ULONG DBLNTSCHIRESDPF2FF_KEY       = &H00099444
CONST AS ULONG DBLNTSCHIRESDPF2LACE_KEY = &H00099445
CONST AS ULONG DBLNTSCEXTRALORES_KEY = &H00091200
CONST AS ULONG DBLNTSCEXTRALORESHAM_KEY = &H00091a00
CONST AS ULONG DBLNTSCEXTRALORESEHB_KEY = &H00091280
CONST AS ULONG DBLNTSCEXTRALORESDPF_KEY = &H00091600
CONST AS ULONG DBLNTSCEXTRALORESDPF2_KEY    = &H00091640
CONST AS ULONG DBLNTSCEXTRALORESFF_KEY = &H00091204
CONST AS ULONG DBLNTSCEXTRALORESHAMFF_KEY = &H00091a04
CONST AS ULONG DBLNTSCEXTRALORESEHBFF_KEY = &H00091284
CONST AS ULONG DBLNTSCEXTRALORESDPFFF_KEY = &H00091604
CONST AS ULONG DBLNTSCEXTRALORESDPF2FF_KEY  = &H00091644
CONST AS ULONG DBLNTSCEXTRALORESLACE_KEY = &H00091205
CONST AS ULONG DBLNTSCEXTRALORESHAMLACE_KEY = &H00091a05
CONST AS ULONG DBLNTSCEXTRALORESEHBLACE_KEY = &H00091285
CONST AS ULONG DBLNTSCEXTRALORESDPFLACE_KEY = &H00091605
CONST AS ULONG DBLNTSCEXTRALORESDPF2LACE_KEY    = &H00091645
CONST AS ULONG DBLPAL_MONITOR_ID = &H000a1000
CONST AS ULONG DBLPALLORES_KEY = &H000a1000
CONST AS ULONG DBLPALLORESFF_KEY = &H000a1004
CONST AS ULONG DBLPALLORESHAM_KEY = &H000a1800
CONST AS ULONG DBLPALLORESHAMFF_KEY = &H000a1804
CONST AS ULONG DBLPALLORESEHB_KEY = &H000a1080
CONST AS ULONG DBLPALLORESEHBFF_KEY = &H000a1084
CONST AS ULONG DBLPALLORESLACE_KEY = &H000a1005
CONST AS ULONG DBLPALLORESHAMLACE_KEY = &H000a1805
CONST AS ULONG DBLPALLORESEHBLACE_KEY = &H000a1085
CONST AS ULONG DBLPALLORESDPF_KEY = &H000a1400
CONST AS ULONG DBLPALLORESDPFFF_KEY = &H000a1404
CONST AS ULONG DBLPALLORESDPFLACE_KEY = &H000a1405
CONST AS ULONG DBLPALLORESDPF2_KEY      = &H000a1440
CONST AS ULONG DBLPALLORESDPF2FF_KEY        = &H000a1444
CONST AS ULONG DBLPALLORESDPF2LACE_KEY      = &H000a1445
CONST AS ULONG DBLPALHIRES_KEY = &H000a9000
CONST AS ULONG DBLPALHIRESFF_KEY = &H000a9004
CONST AS ULONG DBLPALHIRESHAM_KEY = &H000a9800
CONST AS ULONG DBLPALHIRESHAMFF_KEY = &H000a9804
CONST AS ULONG DBLPALHIRESLACE_KEY = &H000a9005
CONST AS ULONG DBLPALHIRESHAMLACE_KEY = &H000a9805
CONST AS ULONG DBLPALHIRESEHB_KEY = &H000a9080
CONST AS ULONG DBLPALHIRESEHBFF_KEY = &H000a9084
CONST AS ULONG DBLPALHIRESEHBLACE_KEY = &H000a9085
CONST AS ULONG DBLPALHIRESDPF_KEY = &H000a9400
CONST AS ULONG DBLPALHIRESDPFFF_KEY = &H000a9404
CONST AS ULONG DBLPALHIRESDPFLACE_KEY = &H000a9405
CONST AS ULONG DBLPALHIRESDPF2_KEY      = &H000a9440
CONST AS ULONG DBLPALHIRESDPF2FF_KEY        = &H000a9444
CONST AS ULONG DBLPALHIRESDPF2LACE_KEY      = &H000a9445
CONST AS ULONG DBLPALEXTRALORES_KEY = &H000a1200
CONST AS ULONG DBLPALEXTRALORESHAM_KEY = &H000a1a00
CONST AS ULONG DBLPALEXTRALORESEHB_KEY = &H000a1280
CONST AS ULONG DBLPALEXTRALORESDPF_KEY = &H000a1600
CONST AS ULONG DBLPALEXTRALORESDPF2_KEY = &H000a1640
CONST AS ULONG DBLPALEXTRALORESFF_KEY = &H000a1204
CONST AS ULONG DBLPALEXTRALORESHAMFF_KEY = &H000a1a04
CONST AS ULONG DBLPALEXTRALORESEHBFF_KEY = &H000a1284
CONST AS ULONG DBLPALEXTRALORESDPFFF_KEY = &H000a1604
CONST AS ULONG DBLPALEXTRALORESDPF2FF_KEY   = &H000a1644
CONST AS ULONG DBLPALEXTRALORESLACE_KEY = &H000a1205
CONST AS ULONG DBLPALEXTRALORESHAMLACE_KEY = &H000a1a05
CONST AS ULONG DBLPALEXTRALORESEHBLACE_KEY = &H000a1285
CONST AS ULONG DBLPALEXTRALORESDPFLACE_KEY = &H000a1605
CONST AS ULONG DBLPALEXTRALORESDPF2LACE_KEY = &H000a1645

CONST AS ULONG SPECIAL_FLAGS = DIPF_IS_DUALPF OR DIPF_IS_PF2PRI OR DIPF_IS_HAM OR DIPF_IS_EXTRAHALFBRITE

CONST AS ULONG BIDTAG_DIPFMustHave = &H80000001
CONST AS ULONG BIDTAG_DIPFMustNotHave = &H80000002
CONST AS ULONG BIDTAG_ViewPort = &H80000003
CONST AS ULONG BIDTAG_NominalWidth = &H80000004
CONST AS ULONG BIDTAG_NominalHeight = &H80000005
CONST AS ULONG BIDTAG_DesiredWidth = &H80000006
CONST AS ULONG BIDTAG_DesiredHeight = &H80000007
CONST AS ULONG BIDTAG_Depth = &H80000008
CONST AS ULONG BIDTAG_MonitorID = &H80000009
CONST AS ULONG BIDTAG_SourceID = &H8000000a
CONST AS ULONG BIDTAG_RedBits = &H8000000b
CONST AS ULONG BIDTAG_BlueBits = &H8000000c
CONST AS ULONG BIDTAG_GreenBits = &H8000000d
CONST AS ULONG BIDTAG_GfxPrivate = &H8000000e

TYPE AreaInfo
    AS INTEGER PTR    VctrTbl
    AS INTEGER PTR    VctrPtr
    AS BYTE PTR    FlagTbl
    AS BYTE PTR    FlagPtr
    AS INTEGER     Count
    AS INTEGER     MaxCount
    AS INTEGER     FirstX,FirstY
END TYPE

TYPE TmpRas
    AS BYTE PTR    RasPtr
    AS LONG        Size
END TYPE

TYPE GelsInfo
    AS BYTE          sprRsrvd
    AS UBYTE          Flags
    AS VSprite PTR    gelHead, gelTail
    AS INTEGER PTR    nextLine
    AS INTEGER PTR    lastColor
    AS collTable PTR  collHandler
    AS INTEGER        leftmost, rightmost, topmost, bottommost
    AS ANY PTR      firstBlissObj,lastBlissObj
END TYPE

TYPE RastPort
    AS Layer PTR    Layer
    AS BitMap PTR    BitMap
    AS UINTEGER PTR    AreaPtrn
    AS TmpRas PTR    TmpRas
    AS AreaInfo PTR    AreaInfo
    AS GelsInfo PTR    GelsInfo
    AS UBYTE     Mask
    AS BYTE     FgPen
    AS BYTE     BgPen
    AS BYTE     AOlPen
    AS BYTE     DrawMode
    AS BYTE     AreaPtSz
    AS BYTE     linpatcnt
    AS BYTE     dummy
    AS UINTEGER     Flags
    AS UINTEGER     LinePtrn
    AS INTEGER     cp_x, cp_y
    AS UBYTE     minterms(7)
    AS INTEGER     PenWidth
    AS INTEGER     PenHeight
    AS TextFont PTR    Font
    AS UBYTE     AlgoStyle
    AS UBYTE     TxFlags
    AS UINTEGER     TxHeight
    AS UINTEGER     TxWidth
    AS UINTEGER     TxBaseline
    AS INTEGER     TxSpacing
    AS ANY PTR      RP_User
    REM FIXME AS ANY PTR  PTR    RP_User
    AS ULONG     longreserved(1)
END TYPE

CONST AS BYTE JAM1  = 0
CONST AS BYTE JAM2  = 1
CONST AS BYTE COMPLEMENT = 2
CONST AS BYTE INVERSVID = 4
CONST AS UINTEGER FRST_DOT = &H01
CONST AS UINTEGER ONE_DOT = &H02
CONST AS UINTEGER DBUFFER = &H04

CONST AS UBYTE AREAOUTLINE = &H08
CONST AS UBYTE NOCROSSFILL = &H20

TYPE RegionRectangle
    AS RegionRectangle PTR    Next, Prev
    AS Rectangle     bounds
END TYPE

TYPE Region
    AS Rectangle     bounds
    AS RegionRectangle PTR    RegionRectangle
END TYPE

CONST AS ULONG RPTAG_Font = &H80000000
CONST AS ULONG RPTAG_APen = &H80000002
CONST AS ULONG RPTAG_BPen = &H80000003
CONST AS ULONG RPTAG_DrMd = &H80000004
CONST AS ULONG RPTAG_OutLinePen = &H80000005
CONST AS ULONG RPTAG_WriteMask = &H80000006
CONST AS ULONG RPTAG_MaxPen = &H80000007
CONST AS ULONG RPTAG_DrawBounds = &H80000008

TYPE BitScaleArgs
    AS UINTEGER     bsa_SrcX, bsa_SrcY
    AS UINTEGER     bsa_SrcWidth, bsa_SrcHeight
    AS UINTEGER     bsa_XSrcFactor, bsa_YSrcFactor
    AS UINTEGER     bsa_DestX, bsa_DestY
    AS UINTEGER     bsa_DestWidth, bsa_DestHeight
    AS UINTEGER     bsa_XDestFactor, bsa_YDestFactor
    AS BitMap PTR    bsa_SrcBitMap
    AS BitMap PTR    bsa_DestBitMap
    AS ULONG     bsa_Flags
    AS UINTEGER     bsa_XDDA, bsa_YDDA
    AS LONG     bsa_Reserved1
    AS LONG     bsa_Reserved2
END TYPE

CONST AS UBYTE SPRITE_ATTACHED = &H80

TYPE SimpleSprite
    AS UINTEGER PTR    posctldata
    AS UINTEGER     height
    AS UINTEGER     x,y
    AS UINTEGER     num
END TYPE

TYPE ExtSprite
    AS SimpleSprite     es_SimpleSprite
    AS UINTEGER     es_wordwidth
    AS UINTEGER     es_flags
END TYPE

CONST AS ULONG SPRITEA_Width = &H81000000
CONST AS ULONG SPRITEA_XReplication = &H81000002
CONST AS ULONG SPRITEA_YReplication = &H81000004
CONST AS ULONG SPRITEA_OutputHeight = &H81000006
CONST AS ULONG SPRITEA_Attached = &H81000008
CONST AS ULONG SPRITEA_OldDataFormat = &H8100000a
CONST AS ULONG GSTAG_SPRITE_NUM = &H82000020
CONST AS ULONG GSTAG_ATTACHED = &H82000022
CONST AS ULONG GSTAG_SOFTSPRITE = &H82000024
CONST AS ULONG GSTAG_SCANDOUBLED = &H83000000

CONST AS UBYTE FS_NORMAL = 0
CONST AS UBYTE FSB_UNDERLINED = 0
CONST AS UBYTE FSF_UNDERLINED = &H01
CONST AS UBYTE FSB_BOLD = 1
CONST AS UBYTE FSF_BOLD = &H02
CONST AS UBYTE FSB_ITALIC = 2
CONST AS UBYTE FSF_ITALIC = &H04
CONST AS UBYTE FSB_EXTENDED = 3
CONST AS UBYTE FSF_EXTENDED = &H08
CONST AS UBYTE FSB_COLORFONT = 6
CONST AS UBYTE FSF_COLORFONT = &H40
CONST AS UBYTE FSB_TAGGED = 7
CONST AS UBYTE FSF_TAGGED = &H80
CONST AS UBYTE FPB_ROMFONT = 0
CONST AS UBYTE FPF_ROMFONT = &H01
CONST AS UBYTE FPB_DISKFONT = 1
CONST AS UBYTE FPF_DISKFONT = &H02
CONST AS UBYTE FPB_REVPATH = 2
CONST AS UBYTE FPF_REVPATH = &H04
CONST AS UBYTE FPB_TALLDOT = 3
CONST AS UBYTE FPF_TALLDOT = &H08
CONST AS UBYTE FPB_WIDEDOT = 4
CONST AS UBYTE FPF_WIDEDOT = &H10
CONST AS UBYTE FPB_PROPORTIONAL = 5
CONST AS UBYTE FPF_PROPORTIONAL = &H20
CONST AS UBYTE FPB_DESIGNED = 6
CONST AS UBYTE FPF_DESIGNED = &H40
CONST AS UBYTE FPB_REMOVED = 7

TYPE TextAttr
    AS STRING      ta_Name
    AS UINTEGER    ta_YSize
    AS UBYTE       ta_Style
    AS UBYTE       ta_Flags
END TYPE

TYPE TTextAttr
    AS STRING       tta_Name
    AS UINTEGER     tta_YSize
    AS UBYTE        tta_Style
    AS UBYTE        tta_Flags
    AS TagItem PTR  tta_Tags
END TYPE

CONST AS ULONG TA_DeviceDPI = 1 OR TAG_USER

CONST AS UINTEGER MAXFONTMATCHWEIGHT = 32767

TYPE TextFont
    AS Message     tf_Message
    AS UINTEGER     tf_YSize
    AS UBYTE     tf_Style
    AS UBYTE     tf_Flags
    AS UINTEGER     tf_XSize
    AS UINTEGER     tf_Baseline
    AS UINTEGER     tf_BoldSmear
    AS UINTEGER     tf_Accessors
    AS UBYTE     tf_LoChar
    AS UBYTE     tf_HiChar
    AS ANY PTR      tf_CharData
    AS UINTEGER     tf_Modulo
    AS ANY PTR      tf_CharLoc
    AS ANY PTR      tf_CharSpace
    AS ANY PTR      tf_CharKern
END TYPE

CONST AS UBYTE TE0B_NOREMFONT = 0
CONST AS UBYTE TE0F_NOREMFONT = &H01

TYPE TextFontExtension
    AS UINTEGER     tfe_MatchWord
    AS UBYTE     tfe_Flags0
    AS UBYTE     tfe_Flags1
    AS TextFont PTR    tfe_BackPtr
    AS MsgPort PTR    tfe_OrigReplyPort
    AS TagItem PTR    tfe_Tags
    AS UINTEGER PTR    tfe_OFontPatchS
    AS UINTEGER PTR    tfe_OFontPatchK
END TYPE

CONST AS UINTEGER CT_COLORMASK = &H000F
CONST AS UINTEGER CT_COLORFONT = &H0001
CONST AS UINTEGER CT_GREYFONT = &H0002
CONST AS UINTEGER CT_ANTIALIAS = &H0004
CONST AS UINTEGER CTB_MAPCOLOR = 0
CONST AS UINTEGER CTF_MAPCOLOR = &H0001

TYPE ColorFontColors
    AS UINTEGER     cfc_Reserved
    AS UINTEGER     cfc_Count
    AS UINTEGER PTR    cfc_ColorTable
END TYPE

TYPE ColorTextFont
    AS TextFont     ctf_TF
    AS UINTEGER     ctf_Flags
    AS UBYTE     ctf_Depth
    AS UBYTE     ctf_FgColor
    AS UBYTE     ctf_Low
    AS UBYTE     ctf_High
    AS UBYTE     ctf_PlanePick
    AS UBYTE     ctf_PlaneOnOff
    AS ColorFontColors PTR    ctf_ColorFontColors
    AS ANY PTR      ctf_CharData(7)
END TYPE

TYPE TextExtent
    AS UINTEGER     te_Width
    AS UINTEGER     te_Height
    AS Rectangle     te_Extent
END TYPE

CONST AS ULONG VTAG_END_CM = &H00000000
CONST AS ULONG VTAG_CHROMAKEY_CLR = &H80000000
CONST AS ULONG VTAG_CHROMAKEY_SET = &H80000001
CONST AS ULONG VTAG_BITPLANEKEY_CLR = &H80000002
CONST AS ULONG VTAG_BITPLANEKEY_SET = &H80000003
CONST AS ULONG VTAG_BORDERBLANK_CLR = &H80000004
CONST AS ULONG VTAG_BORDERBLANK_SET = &H80000005
CONST AS ULONG VTAG_BORDERNOTRANS_CLR = &H80000006
CONST AS ULONG VTAG_BORDERNOTRANS_SET = &H80000007
CONST AS ULONG VTAG_CHROMA_PEN_CLR = &H80000008
CONST AS ULONG VTAG_CHROMA_PEN_SET = &H80000009
CONST AS ULONG VTAG_CHROMA_PLANE_SET = &H8000000A
CONST AS ULONG VTAG_ATTACH_CM_SET = &H8000000B
CONST AS ULONG VTAG_NEXTBUF_CM = &H8000000C
CONST AS ULONG VTAG_BATCH_CM_CLR = &H8000000D
CONST AS ULONG VTAG_BATCH_CM_SET = &H8000000E
CONST AS ULONG VTAG_NORMAL_DISP_GET = &H8000000F
CONST AS ULONG VTAG_NORMAL_DISP_SET = &H80000010
CONST AS ULONG VTAG_COERCE_DISP_GET = &H80000011
CONST AS ULONG VTAG_COERCE_DISP_SET = &H80000012
CONST AS ULONG VTAG_VIEWPORTEXTRA_GET = &H80000013
CONST AS ULONG VTAG_VIEWPORTEXTRA_SET = &H80000014
CONST AS ULONG VTAG_CHROMAKEY_GET = &H80000015
CONST AS ULONG VTAG_BITPLANEKEY_GET = &H80000016
CONST AS ULONG VTAG_BORDERBLANK_GET = &H80000017
CONST AS ULONG VTAG_BORDERNOTRANS_GET = &H80000018
CONST AS ULONG VTAG_CHROMA_PEN_GET = &H80000019
CONST AS ULONG VTAG_CHROMA_PLANE_GET = &H8000001A
CONST AS ULONG VTAG_ATTACH_CM_GET = &H8000001B
CONST AS ULONG VTAG_BATCH_CM_GET = &H8000001C
CONST AS ULONG VTAG_BATCH_ITEMS_GET = &H8000001D
CONST AS ULONG VTAG_BATCH_ITEMS_SET = &H8000001E
CONST AS ULONG VTAG_BATCH_ITEMS_ADD = &H8000001F
CONST AS ULONG VTAG_VPMODEID_GET = &H80000020
CONST AS ULONG VTAG_VPMODEID_SET = &H80000021
CONST AS ULONG VTAG_VPMODEID_CLR = &H80000022
CONST AS ULONG VTAG_USERCLIP_GET = &H80000023
CONST AS ULONG VTAG_USERCLIP_SET = &H80000024
CONST AS ULONG VTAG_USERCLIP_CLR = &H80000025
CONST AS ULONG VTAG_PF1_BASE_GET        = &H80000026
CONST AS ULONG VTAG_PF2_BASE_GET        = &H80000027
CONST AS ULONG VTAG_SPEVEN_BASE_GET = &H80000028
CONST AS ULONG VTAG_SPODD_BASE_GET = &H80000029
CONST AS ULONG VTAG_PF1_BASE_SET        = &H8000002a
CONST AS ULONG VTAG_PF2_BASE_SET        = &H8000002b
CONST AS ULONG VTAG_SPEVEN_BASE_SET = &H8000002c
CONST AS ULONG VTAG_SPODD_BASE_SET = &H8000002d
CONST AS ULONG VTAG_BORDERSPRITE_GET = &H8000002e
CONST AS ULONG VTAG_BORDERSPRITE_SET = &H8000002f
CONST AS ULONG VTAG_BORDERSPRITE_CLR = &H80000030
CONST AS ULONG VTAG_SPRITERESN_SET = &H80000031
CONST AS ULONG VTAG_SPRITERESN_GET = &H80000032
CONST AS ULONG VTAG_PF1_TO_SPRITEPRI_SET    = &H80000033
CONST AS ULONG VTAG_PF1_TO_SPRITEPRI_GET    = &H80000034
CONST AS ULONG VTAG_PF2_TO_SPRITEPRI_SET    = &H80000035
CONST AS ULONG VTAG_PF2_TO_SPRITEPRI_GET    = &H80000036
CONST AS ULONG VTAG_IMMEDIATE = &H80000037
CONST AS ULONG VTAG_FULLPALETTE_SET = &H80000038
CONST AS ULONG VTAG_FULLPALETTE_GET = &H80000039
CONST AS ULONG VTAG_FULLPALETTE_CLR = &H8000003A
CONST AS ULONG VTAG_DEFSPRITERESN_SET = &H8000003B
CONST AS ULONG VTAG_DEFSPRITERESN_GET = &H8000003C
CONST AS ULONG VC_IntermediateCLUpdate = &H80000080
CONST AS ULONG VC_IntermediateCLUpdate_Query = &H80000081
CONST AS ULONG VC_NoColorPaletteLoad = &H80000082
CONST AS ULONG VC_NoColorPaletteLoad_Query = &H80000083
CONST AS ULONG VC_DUALPF_Disable = &H80000084
CONST AS ULONG VC_DUALPF_Disable_Query = &H80000085

TYPE View
    AS ViewPort PTR    ViewPort
    AS cprlist PTR    LOFCprList
    AS cprlist PTR    SHFCprList
    AS INTEGER     DyOffset,DxOffset
    AS UINTEGER     Modes
END TYPE

TYPE ViewExtra
    AS ExtendedNode     n
    AS View PTR    View
    AS MonitorSpec PTR    Monitor
    AS UINTEGER     TopLine
END TYPE

TYPE ViewPortExtra
    AS ExtendedNode     n
    AS ViewPort PTR    ViewPort
    AS Rectangle     DisplayClip
    AS ANY PTR      VecTable
    AS ANY PTR      DriverData(1)
    AS UINTEGER     Flags
    AS Point     Origin(1)
    AS ULONG     cop1ptr
    AS ULONG     cop2ptr
END TYPE

CONST AS UINTEGER VPXB_FREE_ME       = 0
CONST AS UINTEGER VPXF_FREE_ME       = 1 SHL VPXB_FREE_ME
CONST AS UINTEGER VPXB_LAST          = 1
CONST AS UINTEGER VPXF_LAST          = 1 SHL VPXB_LAST
CONST AS UINTEGER VPXB_STRADDLES_256 =  4
CONST AS UINTEGER VPXF_STRADDLES_256 = 1 SHL VPXB_STRADDLES_256
CONST AS UINTEGER VPXB_STRADDLES_512 = 5
CONST AS UINTEGER VPXF_STRADDLES_512 = 1 SHL VPXB_STRADDLES_512

CONST AS UINTEGER EXTEND_VSTRUCT = &H1000
CONST AS UINTEGER VPF_A2024 = &H40
CONST AS UINTEGER VPF_TENHZ = &H20
CONST AS UINTEGER VPB_A2024 = 6
CONST AS UINTEGER VPB_TENHZ = 4
CONST AS UINTEGER GENLOCK_VIDEO = &H0002
CONST AS UINTEGER LACE = &H0004
CONST AS UINTEGER DOUBLESCAN = &H0008
CONST AS UINTEGER SUPERHIRES = &H0020
CONST AS UINTEGER PFBA = &H0040
CONST AS UINTEGER EXTRA_HALFBRITE = &H0080
CONST AS UINTEGER GENLOCK_AUDIO = &H0100
CONST AS UINTEGER DUALPF = &H0400
CONST AS UINTEGER HAM = &H0800
CONST AS UINTEGER EXTENDED_MODE = &H1000
CONST AS UINTEGER VP_HIDE = &H2000
CONST AS UINTEGER SPRITES = &H4000
CONST AS UINTEGER HIRES = &H8000

TYPE RasInfo
    AS RasInfo PTR    Next
    AS BitMap PTR    BitMap
    AS INTEGER     RxOffset,RyOffset
END TYPE

CONST AS UBYTE COLORMAP_TYPE_V1_2   = &H00
CONST AS UBYTE COLORMAP_TYPE_V1_4   = &H01
CONST AS UBYTE COLORMAP_TYPE_V36    = COLORMAP_TYPE_V1_4
CONST AS UBYTE COLORMAP_TYPE_V39    = &H02

CONST AS UBYTE COLORMAP_TRANSPARENCY = &H01
CONST AS UBYTE COLORPLANE_TRANSPARENCY = &H02
CONST AS UBYTE BORDER_BLANKING = &H04
CONST AS UBYTE BORDER_NOTRANSPARENCY = &H08
CONST AS UBYTE VIDEOCONTROL_BATCH = &H10
CONST AS UBYTE USER_COPPER_CLIP = &H20
CONST AS UBYTE BORDERSPRITES = &H40
CONST AS UBYTE CMF_CMTRANS = 0
CONST AS UBYTE CMF_CPTRANS = 1
CONST AS UBYTE CMF_BRDRBLNK = 2
CONST AS UBYTE CMF_BRDNTRAN = 3
CONST AS UBYTE CMF_BRDRSPRT = 6
CONST AS UBYTE SPRITERESN_ECS = 0
CONST AS UBYTE SPRITERESN_140NS = 1
CONST AS UBYTE SPRITERESN_70NS  = 2
CONST AS UBYTE SPRITERESN_35NS  = 3
CONST AS UBYTE SPRITERESN_DEFAULT = -1
CONST AS UBYTE CMAB_FULLPALETTE = 0
CONST AS UBYTE CMAF_FULLPALETTE = 1 SHL CMAB_FULLPALETTE
CONST AS UBYTE CMAB_NO_INTERMED_UPDATE = 1
CONST AS UBYTE CMAF_NO_INTERMED_UPDATE = 1 SHL CMAB_NO_INTERMED_UPDATE
CONST AS UBYTE CMAB_NO_COLOR_LOAD = 2
CONST AS UBYTE CMAF_NO_COLOR_LOAD = 1 SHL CMAB_NO_COLOR_LOAD
CONST AS UBYTE CMAB_DUALPF_DISABLE = 3
CONST AS UBYTE CMAF_DUALPF_DISABLE = 1 SHL CMAB_DUALPF_DISABLE

TYPE PaletteExtra
    AS SignalSemaphore     pe_Semaphore
    AS UINTEGER     pe_FirstFree
    AS UINTEGER     pe_NFree
    AS UINTEGER     pe_FirstShared
    AS UINTEGER     pe_NShared
    AS UBYTE PTR    pe_RefCnt
    AS UBYTE PTR    pe_AllocList
    AS ViewPort PTR    pe_ViewPort
    AS UINTEGER     pe_SharableColors
END TYPE

CONST AS ULONG PENB_EXCLUSIVE     = 0
CONST AS ULONG PENB_NO_SETCOLOR   = 1
CONST AS ULONG PENF_EXCLUSIVE     = 1 SHL PENB_EXCLUSIVE
CONST AS ULONG PENF_NO_SETCOLOR   = 1 SHL PENB_NO_SETCOLOR
CONST AS ULONG PEN_EXCLUSIVE      = PENF_EXCLUSIVE
CONST AS ULONG PEN_NO_SETCOLOR    = PENF_NO_SETCOLOR
CONST AS ULONG PRECISION_EXACT    = -1
CONST AS ULONG PRECISION_IMAGE    = 0
CONST AS ULONG PRECISION_ICON     = 16
CONST AS ULONG PRECISION_GUI      = 32
CONST AS ULONG OBP_Precision      = &H84000000
CONST AS ULONG OBP_FailIfBad      = &H84000001

CONST AS ULONG MVP_OK = 0
CONST AS ULONG MVP_NO_MEM = 1
CONST AS ULONG MVP_NO_VPE = 2
CONST AS ULONG MVP_NO_DSPINS = 3
CONST AS ULONG MVP_NO_DISPLAY = 4
CONST AS ULONG MVP_OFF_BOTTOM = 5
CONST AS ULONG MCOP_OK = 0
CONST AS ULONG MCOP_NO_MEM = 1
CONST AS ULONG MCOP_NOP = 2

TYPE DBufInfo
    AS ANY PTR      dbi_Link1
    AS ULONG     dbi_Count1
    AS Message     dbi_SafeMessage
    AS ANY PTR      dbi_UserData1
    AS ANY PTR      dbi_Link2
    AS ULONG     dbi_Count2
    AS Message     dbi_DispMessage

    AS ANY PTR      dbi_UserData2
    AS ULONG     dbi_MatchLong
    AS ANY PTR      dbi_CopPtr1
    AS ANY PTR      dbi_CopPtr2
    AS ANY PTR      dbi_CopPtr3
    AS UINTEGER     dbi_BeamPos1
    AS UINTEGER     dbi_BeamPos2
END TYPE

