sys7.1-doc-wip/Internal/Asm/PalettePriv.a
2019-07-27 22:37:48 +08:00

187 lines
7.9 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

;
; File: PalettePriv.a
;
; Copyright: © 1990 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <8> 1/30/91 gbm sab, #38: Change the already including this file variable to
; all uppercase (for security reasons)
; <7> 12/13/90 dvb Make .h and .p and .a files consistent.
; <6> 10/31/90 SMC Added equate for flag bit in pmFlags.
; <5> 7/11/90 gbm axe some more multiply defined things
; <4> 7/11/90 gbm axe some multiply defined things
; <3> 6/19/90 DVB Add whiteBit and blackBit
; <1> 1/18/90 DVB first checked in
;
; To Do:
;
IF &TYPE('__INCLUDINGPALETTEPRIV__') = 'UNDEFINED' THEN
__INCLUDINGPALETTEPRIV__ SET 1
;---------------------------------------------------
;
; Palette Manager private equates
;
ctMatchBit EQU 3 ; bit in value field saying "been checked"
ctScatterBit EQU 4 ; bit in value field saying "scatter me" <dvb3>
ctScatterVal EQU $1000 ; word-write equivalent of ctScatterBit <dvb3>
ctTolBit EQU 5 ; bit in value field saying "I've been yanked"
ctTolVal EQU $2000
ctReserveBit EQU 6
ctReserveVal EQU $4000
IF &TYPE('Nil') = 'UNDEFINED' THEN
Nil: Equ 0
ENDIF
DitheredBit Equ 0
TolerantBit Equ 1
AnimatedBit Equ 2
ExplicitBit Equ 3
WhiteBit EQU 4
;BlackBit EQU 5
HandledBit Equ 15
ClearBits Equ $3F3F
NNewBit equ 15 ; if set then we interpret it as new AWC PB223
NForeBit equ 14 ; new flag, user wants foreground update AWC PB223
NBackBit equ 13 ; new flag, user wants background update AWC PB223
CForeBit equ 15 ; if set, this palette wants the window updated at Activate time
CBackBit equ 14 ; if set, update this window if someone else Activates
DirtyBit equ 13 ; if set, this palette has been changed by SetEntryColor/Usage
DisposeBit equ 12 ; if set, this palette should be disposed of automatically
PIdMask equ $0FFF ; bits used to record number of the palette in pmPrivate
PmFgBit equ 0 ; bit number set in GrafVars^^.PmFlags if pmForeColor was used
PmBkBit eqU 1 ; bit number set in GrafVars^^.PmFlags if pmBackColor was used
PmNewGVBit equ 15 ; bit number set in GrafVars^^.PmFlags if grafvars are new, larger size
; Juggler™ information AWC PB224
JugglerTrap equ $A88F ; the Juggler trap
UnimplementedTrap equ $A89F ; a guaranteed unimplemented trap
ColorInvalRect equ $0025 ; the ColorInvalRect Selector
_Juggler OPWORD $A88F ; a macro that excutes Erich's disgusting C code
; Palette Manager data structures - the data is kept in a handle at $08B4 which
; lives across launches so that Juggler applications can share the Palette Manager.
PMgrHandle Equ $0DC8
PMgrNil Equ $FFFFFFFF
DevLimit Equ 32
; What's in the palette structure? Here are the "missing fields:"
pmWindow EQU $0002 ; parent window [long]
pmPrivate EQU $0006 ; private [short]
pmDevices EQU $0008 ; private [long]
pmSeeds EQU $000C ; private [long]
; What's in a ciInfo structure? More secret fields:
ciFlags EQU $000A ; private [short]
ciPrivate EQU $000C ; private [long]
; pmDev fields - a link consists of a key, a device (0..31), and an entry (0..255).
; For a link, the key (bits 13-15) is 100 binary. In either direction the list
; is terminated by a key of 011. For a forward link the remainder of the word
; specifies the palette number. For a backward link the remainder specifies the
; index. Of course this is a kludge; your superior proposal gladly accepted.
ForeLink Equ 0 ; 100 [NextDevice{5}] [NextEntry{8}]
BackLink Equ ForeLink+2 ; [PaletteEntry]
pmDevSz Equ BackLink+2 ; size of record
; DevInfo record - one of these in PMgrHandle for DevLimit CLUT devices. The DevFrontMost
; field is used to find the FrontMost window for each CLUT device.
DevHandle Equ 0 ; offset to handle within DevInfo
DevFrontMost Equ DevHandle+4 ; offset to FrontMost window field AWC PB223
DevInfoSz Equ DevFrontMost+4 ; size of DevInfo record
; Histogram record - this record consists of a reference count and a pixel value. It
; is mapped onto the scratch handle InfoHandle when the latter is used by Allocate to
; allocate animating entries. It is passed through SortPoints (the Quickdraw call used
; for region manipulation) in order to perform a QuickSort. The reference counts are
; never allowed to go negative.
HistCount Equ 0 ; offset to reference count within HistRecord
HistIndex Equ HistCount+2 ; offset to index field within HistRecord
; PMgrHandle fields
nDevs Equ 0 ; number of active Clut devices (>0 or no PMgrHandle)
SeedHSize Equ nDevs+2 ; size of pmSeeds handles (integer, nDevs*4)
PListHandle Equ SeedHSize+2 ; handle to hold handles of palettes which animate
APalettes Equ PListHandle+4 ; number of animating PaletteHandles
FreeSpaces Equ APalettes+2 ; number of free spaces for PaletteHandles
SysPalette Equ FreeSpaces+2 ; system palette, if any
scatterDevs EQU SysPalette+4 ; bitmask of devices needing scattering <dvb3>
updateDevs EQU ScatterDevs+4 ; bitmask of devices needing updating <dvb5>
OldExitToShell EQU updateDevs+4 ; For our Exit patch
sevenCluts EQU OldExitToShell+4 ; Handles to purgeable cluts for:1,2g,2c,4g,4c,8g,8c
DevHandles Equ sevenCluts+28 ; first CLUT device handle
; PMgrDataSz is presumed to be long word aligned by a clearing routine below. Keep
; this assumption correct.
PMgrDataSz Equ DevHandles+DevLimit*DevInfoSz
LinkTabs Equ PMgrDataSz
; PListEntry record and PListHandle constants
PaletteRef equ 0 ; a copy of PaletteHandle allocated by NewPalette
Reserves equ PaletteRef+4 ; number of animating entries reserved by palette
PLstEntrySz eQU Reserves+4 ; size of a PListEntry record
ListSpace Equ 16 ; increment for handles in PListHandle
; DevLink record - one of these for each CLUT entry per device
DevLinkSz Equ 2 ; device (part of 1), index (1)
InfoHandSz Equ 512 ; size of scratch area (enough for 256 words)
; SetPalette stack frame, global so it can be used by subsidiary procedures (each of which
; must build a stack frame on A4 and not A6). [spDefs]
WindowCopy equ -4 ; a copy of the window parameter
PaletteH equ WindowCopy-4 ; a copy of the window's palette
PalettePtr equ PaletteH-4 ; locked, dereferenced pointer (PaletteH^)
myEntries equ PalettePtr-2 ; copy of pmEntries
PMgrPtr equ myEntries-4 ; locked, dereferenced pointer (PMgrHandle^)
PDevPtr equ PMgrPtr-4 ; pointer to start of PMgrDevices
PListPtr equ PDevPtr-4 ; locked, dereferenced pointer (PListHandle^)
CurDevice equ PListPtr-2 ; device counter used by SetPalette, SetDev
DevLinks equ CurDevice-4 ; pointer to device link table for current device
Devices equ DevLinks-2 ; copy of PMgrHandle^^.nDev
DevIndexes equ Devices-2 ; number of indexes available on current device
DevCTab equ DevIndexes-4 ; current device ColorTable handle
DeviceSet equ DevCTab-4 ; a set of 0..31, 0th element is least sign. bit
FrontSet equ DeviceSet-4 ; set of devices on which the window is frontmost AWC PB223
WindowRect equ FrontSet-8 ; this is pmWindow's PortRect in global coordinates
InfoHandle equ WindowRect-4 ; handle of our scratch area
InfoPtr equ InfoHandle-4 ; InfoHandle^
SaveGDev equ InfoPtr-4 ; place to save theGDevice
BlackIndex equ SaveGDev-2 ; for current device, this is the last index (ctSize)
MAnimators equ BlackIndex-2 ; master number of animating entries
MTolerators equ MAnimators-2 ; master number of tolerant entries
Animators equ MTolerators-2 ; number of animating entries
Tolerators equ Animators-2 ; number of tolerant entries
Pillages equ Tolerators-2 ; number of entries reserved by other palettes
Updates equ Pillages-2 ; number of updates we've done to DevCTab
Histogram equ Updates-2 ; number of histogram entry to examine next
AvailBits equ Histogram-32 ; one bit each, for up to 256 indices. Used to avoid explicit collisions
spVarSize equ AvailBits ; total of SetPalette stack frame
ENDIF ; ...already included