sys7.1-doc-wip/Internal/Asm/ColorEqu.a

500 lines
19 KiB
Plaintext
Raw Normal View History

2019-07-27 14:37:48 +00:00
;
; File: ColorEqu.a
;
; Copyright: © 1986-1991 by Apple Computer, Inc., all rights reserved.
;
; Change History (most recent first):
;
; <23> 10/1/91 KON Removed nsStackErr and noMemForPicPlayBack error since they are
; defined in SysErr.a
; <22> 8/21/91 JSM Clean up header.
; <21> 6/14/91 JL Removed Quickdraw glue vectors from this file because they have
; been shipping in Private.a. Added Inclusion of Private.a. Also
; put conditional in to make sure prNonPortable gets set to one.
; <20> 3/31/91 dba gbm: get rid of symbols from QuickDraw (some day someone will
; conditionally turn them back on again)
; <19> 3/11/91 JT Added new opcode for glyph state and a field in the picSave
; record for tracking this opcode during picture spooling. Code
; checked by KON. BRC numbers 82651 and 79185. Worksheet number
; KON-022. Also added an ALIGN statement to the UNLINK macro to
; squash the assembler warnings about code alignment.
; <18> 1/30/91 gbm sab, #38: Change the already including this file variable to
; all uppercase (for security reasons)
; <17> 12/13/90 KON Add color table signature for recording pixmaps without a color
; table into pictures. [smc]
; <16> 11/12/90 CL (reviewed by PKE)onMac is defined to a non-zero value in the
; system builds even though there is non mac plus code being built
; for it. Changing the onMac flag to different name which is not
; used.
; <15> 11/9/90 PKE (really CEL, reviewed by PKE) Make JStdTbTbl depend on onMac
; conditional to fix it for Mac Plus.
; <14> 10/31/90 SMC Added equates for internal grafVars fields.
; <13> 8/24/90 PKE Delete old names picSMgrChar and picSMgrSlop. Remove duplicate
; definition of nsStackerr (now in SysErr.a).
; <12> 8/23/90 PKE (per JT) Renamed picSMgrChar and picSMgrSlop to picQdChExtra and
; picQdRunSlop. Keep old names too until we can update all
; relevant sources.
; <11> 8/21/90 KON Add noMemForPictPlayback error.
; <10> 8/2/90 gbm change LEFTEDGE and RIGHTEDGE in oval state record to avoid
; conflicts with symbols elsewhere
; <9> 7/26/90 KON Moved nsStackerr from QD.a.
; <8> 6/29/90 KON ci ROM routines expect order of picSave record not to change, so
; I moved the new Char and Slop fields to the bottom so the
; pattern fields stay in the same place.
; <7> 6/21/90 CL Needed to make JStdTxMeas conditionalized for TrueType build so
; this file could be used. This only effects b&w since the base of
; the trap table is different for the Mac Plus compare to the SE
; or Portable.
; <1.6> 11/15/89 KON Changed UNLINK macro and added RTD_ macro to make friendly with
; B&W machines
; <•1.6> 11/15/89 KON Overwriting because EASE screwed up and didn't accept last
; version.
; <1.5> 11/1/89 BAL Added opFontName to the picture opcodes. Grew picSave by 12
; bytes.
; <1.4> 6/30/89 BAL Added equate for qdStackXtra
; <1.3> 6/10/89 CEL Moved Private.a QuickDraw Equates into proper QuickDraw private
; file (colorequ.a), got rid of QuickDraw nFiles dependencies and
; fixed up necessary files…
; <•1.2> 4/12/89 BAL Blasting in 32-Bit QuickDraw 1.0B1
; <•1.1> 4/12/89 BAL Blasting in 32-Bit QuickDraw 1.0B1
; <1.0> 11/16/88 CCH Adding from System Build.
; 10/3/88 CCH Took out UNLINK macro (duplicated in private.a)
; <C533> 12/15/86 DAF added gamma table format
; <C434> 11/18/86 CRC added fractional pen field in graf port
; <C387> 11/9/86 DAF added request list structure
; <C314> 10/31/86 DAF renamed GDevice dummy field
; <A283> 10/28/86 bbm moved location of the toolbox trap table.
; <C188> 9/30/86 EHB Merged in latest colorequ changes
; <C153> 9/13/86 EHB Moved CQD trap definitions to NEWEQU.a
; <C146> 9/8/86 BBM Used JStdTbTbl, which is the toolbox jump table.
;
;___________________________________________________________________________
IF (&TYPE('NEED_JSTDTXMEAS') = 'UNDEFINED') THEN ;
NEED_JSTDTXMEAS EQU 1
ENDIF
IF (&TYPE('isMacPlus') = 'UNDEFINED') THEN ;<16-CEL,PKE>
isMacPlus EQU 0
ENDIF
IF &TYPE('__INCLUDINGCOLOREQU__') = 'UNDEFINED' THEN
__INCLUDINGCOLOREQU__ SET 1
IF (&TYPE('PrNonPortable') = 'UNDEFINED') THEN
PrNonPortable EQU 1
ENDIF
IF PrNonPortable = 0 THEN
PrNonPortable EQU 1
ENDIF
include 'private.a'
;-----------------------------------------------
;
; Misc. Equates without another home
;
cTabSignature EQU $4B4F ;signature that PixMap has NIL color table
;-----------------------------------------------
;
; PRIVATE QUICKDRAW EQUATES
;
; additional private low memory globals
SaveFondFlags EQU $986 ;important byte from current FOND flags
FondState EQU $903 ;saved FOND purge state
; additional private low memory globals for nuMacs and later <C346>
SynListHandle EQU $0D32 ;a handle to a list of synthesized fonts
LastFore EQU $0D36 ;8 bytes: last foreground and background colors (FM)
LastMode EQU $0D3E ;word: last text mode (Font Manager)
LastDepth EQU $0D40 ;word: last depth font prepared for
FMExist EQU $0D42 ;byte: clear if InitFonts has already been called
SavedHilite EQU $0D43 ;byte: used for state across Mac II QD patches
;-----------------------------------------------------
; Region State record
rgnPtr EQU $0 ; [handle]
dataPtr EQU $4 ; [handle]
scanBuf EQU $8 ; [pointer]
scanSize EQU $C ; [word]
thisV EQU $E ; [word]
nextV EQU $10 ; [word]
minH EQU $12 ; [word]
maxH EQU $14 ; [word]
leftH EQU $16 ; [word]
rgnRec EQU $18 ; size of as region record
;------------------------------------------------------
;
; OFFSETS IN AN OVAL STATE RECORD:
;
OVALTOP EQU 0 ;INTEGER
OVALBOT EQU OVALTOP+2 ;INTEGER
OVALY EQU OVALBOT+2 ;INTEGER
RSQYSQ EQU OVALY+2 ;LONGINT
SQUARE EQU RSQYSQ+4 ;64 BIT LONGFIX
ODDNUM EQU SQUARE+8 ;64 BIT LONGFIX
ODDBUMP EQU ODDNUM+8 ;64 BIT LONGFIX
LEFTMOSTEDGE EQU ODDBUMP+8 ;32 BIT FIXED POINT
RIGHTMOSTEDGE EQU LEFTMOSTEDGE+4 ;32 BIT FIXED POINT
ONEHALF EQU RIGHTMOSTEDGE+4 ;32 BIT FIXED POINT
OVALSIZE EQU ONEHALF+4 ;SIZE OF AN OVALREC
;-----------------------------------------------------
;
; OFFSETS IN A PICSAVE RECORD:
;
thePic EQU 0 ;PICHANDLE
picMax EQU 4 ;LongInt
picIndex EQU 8 ;LongInt
picClipRgn EQU 12 ;RgnHandle
picBkPat EQU 16 ;Pattern
picTxFont EQU 24 ;WORD
picTxFace EQU 26 ;Style
picTxMode EQU 28 ;WORD
picTxSize EQU 30 ;WORD
picSpExtra EQU 32 ;Fixed Point
picTxNumer EQU 36 ;Point
picTxDenom EQU 40 ;Point
picTxLoc EQU 44 ;Point
picPnLoc EQU 48 ;Point
picPnSize EQU 52 ;Point
picPnMode EQU 56 ;WORD
picPnPat EQU 58 ;Pattern
picFillPat EQU 66 ;Pattern
picTheRect EQU 74 ;Rect
picOvSize EQU 82 ;Point
picOrigin EQU 86 ;Point
picFgColor EQU 90 ;Long
picBkColor EQU 94 ;Long
picSaveRec EQU 98 ;total size in bytes
picVersion EQU 98 ;WORD
picRGBFgCol EQU 100 ;RGB (6 bytes)
picRGBBkCol EQU 106 ;RGB (6 bytes)
picChExtra EQU 112 ;WORD
picLocHFrac EQU 114 ;WORD
picRGBOpColor EQU 116 ;RGB (6 bytes)
picRGBHiColor EQU 122 ;RGB (6 bytes)
picFillPP EQU 128 ;Handle
picPnPP EQU 132 ;Handle
picBkPP EQU 136 ;Handle
picFontList EQU 140 ;Handle
picQdChExtra EQU 144 ;Fixed (moved below pattern stuff) <29JUN90 KON><12>
picQdRunSlop EQU 148 ;Fixed (moved below pattern stuff) <29JUN90 KON><12>
picGlyphState EQU 152 ;Long, outline preferred, preserve glyph, fractional widths, scale disable flags <19>
picReserve1 EQU 156 ;Handle
npicSaveRec EQU 160 ;total size in bytes
pictVersion EQU 1 ;version number for pict
npicVersion EQU $2FF ;version number for npic
;-----------------------------------------------
;
; PICTURE OPCODES
;
opNOP EQU $0 ; nop opcode
opClip EQU $1 ; clip opcode
opBkPat EQU $2 ; background pattern opcode
opTxFont EQU $3 ; text font opcode
opTxFace EQU $4 ; text face opcode
opTxMode EQU $5 ; text mode opcode
opSpExtra EQU $6 ; space extra opcode
opPnSize EQU $7 ; pen size opcode
opPnMode EQU $8 ; pen mode opcode
opPnPat EQU $9 ; pen pattern opcode
opFillPat EQU $A ; fill pattern opcode
opOvSize EQU $B ; oval size opcode
opOrigin EQU $C ; origin opcode
opTxSize EQU $D ; text size opcode
opFgColor EQU $E ; foreground color opcode
opBkColor EQU $F ; background color opcode
opTxRatio EQU $10 ; text ratio opcode
opVersion EQU $11 ; version opcode
opBkPixPat EQU $12 ; color background pattern opcode
opPnPixPat EQU $13 ; color pen pattern opcode
opFillPixPat EQU $14 ; color fill pattern opcode
opPnLocHFrac EQU $15 ; fractional pen position opcode
opChExtra EQU $16 ; extra for each character
; opcode $17 unused
opIFore EQU $18 ; foreColor index opcode
opIBack EQU $19 ; backColor index opcode
opRGBFgCol EQU $1A ; RGB foreColor opcode
opRGBBkCol EQU $1B ; RGB backColor opcode
opHiliteMode EQU $1C ; hilite mode flag
opHiliteColor EQU $1D ; RGB hilite color
opDefHilite EQU $1E ; Use default hilite color
opOpColor EQU $1F ; RGB OpColor for arithmetic modes
opLine EQU $20 ; line opcode
opLineFrom EQU $21 ; line from opcode
opShortLine EQU $22 ; short line opcode
opShortLineFrom EQU $23 ; short line from opcode
opLongText EQU $28 ; long text opcode
opDHText EQU $29 ; dh text opcode
opDVText EQU $2A ; dv text opcode
opDHDVText EQU $2B ; dh,dv text opcode
opFontName EQU $2C ; font name/id binding
opLineLayout EQU $2D ; script manager line-layout state
opGlyphState EQU $2E ; TrueType glyph drawing state <19>
opBitsRect EQU $90 ; copybits, rect clipped opcode
opBitsRgn EQU $91 ; copybits, rgn clipped opcode
opPackBitsRect EQU $98 ; packed copybits, rect clipped opcode
opPackBitsRgn EQU $99 ; packed copybits, rgn clipped opcode
opShortComment EQU $A0 ; short comment opcode
opLongComment EQU $A1 ; long comment opcode
opEndPic EQU $FF ; end of picture opcode
ngHeaderOp EQU $0C00 ; NuGraf Header opcode
;-----------------------------------------------
;
; COLOR QUICKDRAW EQUATES
;
nurbMask EQU $7FFF ; mask top 2 bits of rowbytes
rbMask EQU $1FFF ; mask top 3 bits of rowbytes
PMFlag EQU $8000 ; flag to say it's a new pixMap
cPortFlag EQU $C000 ; isPixMap+isCPort
pixVersion EQU $0000 ; isPixMap
qdStackXtra EQU $0640 ; stack space left for interrupts <1.4> BAL
isPixMap EQU 15 ; for testing high bit of pRowbytes
isCPort EQU 14 ; indicates that "bitmap" belongs to port
;-----------------------------------------------
;
; COLOR QUICKDRAW OFFSETS
;
;-----------------------------------------------
;
; OFFSETS WITHIN A PIXELMAP
;
pBaseAddr EQU 0 ; [long]
pNewFlag EQU pBaseAddr+4 ; [1 bit] upper bit of rowbytes is flag
pRowBytes EQU pBaseAddr+4 ; [word]
pBounds EQU pRowBytes+2 ; [rect]
IF 0 THEN ; Seems pretty Scary Bruce
pmVersion EQU pBounds+8 ; [word] pixMap version number
ENDIF
packType EQU pmVersion+2 ; [word] defines packing format
packSize EQU packType+2 ; [long] size of pixel data
hRes EQU packSize+4 ; [fixed] h. resolution (ppi)
vRes EQU hRes+4 ; [fixed] v. resolution (ppi)
pixelType EQU vRes+4 ; [word] defines pixel type
pixelSize EQU pixelType+2 ; [word] # bits in pixel
cmpCount EQU pixelSize+2 ; [word] # components in pixel
cmpSize EQU cmpCount+2 ; [word] # bits per field
planeBytes EQU cmpSize+2 ; [long] offset to next plane
IF 0 THEN
pmTable EQU planeBytes+4 ; [long] color map
pmReserved EQU pmTable+4 ; [long] MUST BE 0
pmRec EQU pmReserved+4 ; size of pixelMap record
ENDIF
;------------------------------
; <14> OFFSETS WITHIN GRAFVARS:
;
;rgbOpColor EQU 0 ; [6 bytes] color for addPin, subPin and average
;rgbHiliteColor EQU rgbOpColor+6 ; [6 bytes] color for hiliting
;pmFgColor EQU rgbHiliteColor+6 ; [4 bytes] palette handle for foreground color
;pmFgIndex EQU pmFgColor+4 ; [2 bytes] index value for foreground
;pmBkColor EQU pmFgIndex+2 ; [4 bytes] palette handle for background color
;pmBkIndex EQU pmBkColor+4 ; [2 bytes] index value for background
;pmFlags EQU pmBkIndex+2 ; [2 bytes] flags for Palette Manager
;grafVarRec EQU pmFlags+2 ; size of grafVar record
gworldstuff EQU grafVarRec ;[6 bytes] stuff that gworlds add to grafvars
foreStream EQU gworldstuff+6 ;[4 bytes] foreground stream ID number
foreRatio EQU foreStream+4 ;[2 bytes] foreground transparency ratio
backStream EQU foreRatio+2 ;[4 bytes] background stream ID number
backRatio EQU backStream+4 ;[2 bytes] background transparency ratio
streamFiller EQU backRatio+2 ;[1 byte] currently unused byte
streamMode EQU streamFiller+1 ;[1 byte] alpha channel mode
newGrafVarRec EQU streamMode+1 ;size of full grafVar record
;------------------
; fields within patXMap
patXRow EQU 0 ; [word] rowbytes of expanded pattern
patXHMask EQU patXRow+2 ; [word] horizontal mask
patXVMask EQU patXHMask+2 ; [word] vertical mask
LastCTable EQU patXVMask+2 ; [long] seed value for last color table
LastOfst EQU LastCTable+4 ; [word] last global-local offset
LastInvert EQU LastOfst+2 ; [long] last invert value
LastAlign EQU LastInvert+4 ; [long] last horizontal align
LastStretch EQU LastAlign+4 ; [word] last stretch
ppXInfo EQU LastStretch+2 ; size of expanded data
ScrnActive EQU 15 ; 1 if in use
; inverse Table structure (shouldn't be a public structure, but is obvious) <C96/29Jul86>DAF
ITabSeed EQU $0 ;[long] ID of owning color table
iTabRes EQU $4 ;[word] resolution of this table
iTTable EQU $6 ;table of indices starts here
ITabHidden EQU $00 ;number of hidden entries (0 for balanced table)
ITabFlags EQU $02 ;[word] flags for this table <BAL 16Mar89>
ITabReserved EQU $04 ;[word] reserved for future use
ITabInfo EQU $06
ITabLuma EQU $106 ;1 bytes per color at the moment <BAL 18Mar89>
ITExtraSize EQU $206 ;1 bytes per color at the moment <BAL 18Mar89>
;-----------------------------------------------------
;
; EQUATES FOR COLOR CURSOR SAVE AREA
;
; NOTE THAT THE FIRST FOUR FIELDS ARE PARALLEL TO THE FIRST FOUR FIELDS
; OF A PATTERN SO THAT PATCONVERT CAN BE USED TO EXPAND A CURSOR
;
CCTYPE EQU 0 ;[WORD] CURSOR TYPE
CCMAP EQU CCTYPE+2 ;[LONG] HANDLE TO CURSOR'S PIXMAP
CCDATA EQU CCMAP+4 ;[LONG] HANDLE TO CURSOR'S COLOR DATA
CCXDATA EQU CCDATA+4 ;[LONG] HANDLE TO EXPANDED DATA
CCXMASK EQU CCXDATA+4 ;[LONG] HANDLE TO EXPANDED MASK
CCSAVE EQU CCXMASK+4 ;[LONG] HANDLE TO SAVE BITS UNDER CURSOR
CCLASTCRSR EQU CCSAVE+4 ;[32 BYTES] DATA FOR LAST B/W CURSOR DRAWN
CCID EQU CCLASTCRSR+32 ;[LONG] ID FOR LAST COLOR CURSOR DRAWN
CCDEPTH EQU CCID+4 ;[WORD] DEPTH FOR LAST CURSOR DRAWN
CCSTATEREGS EQU CCDEPTH+2 ;[16 BYTES] STATE INFO OF SAVED DATA
CCBYTES EQU CCSTATEREGS+16 ;[WORD] ROWBYTES OF EXPANDED DATA
CCMAXDEPTH EQU CCBYTES+2 ;[WORD] MAXIMUM SCREEN DEPTH
CCSAVEREC EQU CCMAXDEPTH+2 ;SIZE OF CURSOR SAVE AREA
; Font Manager low mem
;
FontFlag EQU $15E ; font manager loop flag [byte]
FOutError EQU $998 ; error code
FOutFontHandle EQU $99A ; handle to font bits
FOutBold EQU $99E ; bolding factor
FOutItalic EQU $99F ; italic factor
FOutULOffset EQU $9A0 ; underline offset
FOutULShadow EQU $9A1 ; underline halo
FOutULThick EQU $9A2 ; underline thickness
FOutShadow EQU $9A3 ; shadow factor
FOutExtra EQU $9A4 ; extra horizontal width
FOutAscent EQU $9A5 ; height above baseline
FOutDescent EQU $9A6 ; height below baseline
FOutWidMax EQU $9A7 ; maximum width of character
FOutLeading EQU $9A8 ; space between lines
FOutUnused EQU $9A9 ; unused byte (must have even number)
FOutNumer EQU $9AA ; point for numerators of scale factor
FOutDenom EQU $9AE ; point for denominators of scale factor
;----------------------------------------------
;
; Trap table equates used by QuickDraw:
;
IF isMacPlus THEN ;<16-CEL,PKE>
JStdTbTbl EQU $0C00 ;<15-CEL,PKE>
ELSE
JStdTbTbl EQU $0E00 ; <C146><A283>
ENDIF
JStdArc EQU JStdTbTbl+(4*$BD)
JStdBits EQU JStdTbTbl+(4*$EB)
JStdComment EQU JStdTbTbl+(4*$F1)
JStdGetPic EQU JStdTbTbl+(4*$EE)
JStdLine EQU JStdTbTbl+(4*$90)
JStdOval EQU JStdTbTbl+(4*$B6)
JStdPoly EQU JStdTbTbl+(4*$C5)
JStdPutPic EQU JStdTbTbl+(4*$F0)
JStdRect EQU JStdTbTbl+(4*$A0)
JStdRgn EQU JStdTbTbl+(4*$D1)
JStdRRect EQU JStdTbTbl+(4*$AF)
JStdText EQU JStdTbTbl+(4*$82)
IF NEED_JSTDTXMEAS THEN
JStdTxMeas EQU JStdTbTbl+(4*$ED)
ENDIF
JStdOpcode EQU JStdTbTbl+(4*$3F8)
MACRO
UNLINK
.*--------------------------------------------------------------
.*
.* UNLINK A6, STRIP PARAMETERS, AND RETURN.
.*
.* FIRST PARAM IS NUMBER OF BYTES OF STACK BIAS.
.*
UNLK A6 ;RELEASE LOCAL VARIABLES
.*
IF &Eval(&Syslst[1])=0 THEN;NO PARAMETERS ?
RTS ;THEN JUST RTS
.*
ELSEIF &Eval(&Syslst[1])=4 THEN;4 BYTES ?
MOVE.L (SP)+, (SP) ;STRIP PARAMETERS
RTS ;RETURN
ELSE
RTD_ &Eval(&Syslst[1]) ;STRIP PARAMETERS AND RETURN
ENDIF
if 0 then ; turn this on again some day <20>
dc.b &Syslst[2] ;PUT OUT THE STRING
align ; align code for next function or procedure <19>
endif
.*
ENDM
MACRO
_StackAvail
MOVE.L $400+4*$65,A0 ;get address of stack space routine
JSR (A0) ;get stack space into D0 and return
ENDM
MACRO
_GetScrnBits ; it's in crsrcore!!
DC.W ($A833) ;new trap number
ENDM
MACRO
_SwapFont
MOVE.L $8E0,A0 ;get pointer to FMSwapFont
JSR (A0) ;call font manager
ENDM
MACRO
RTD_ &parm1
IF &SETTING('MACHINE') <> 'MC68000' THEN
RTD #&parm1
ELSE
IF &Eval(&parm1) = 0 THEN
rts
ELSEIF &Eval(&parm1)=4 THEN;4 BYTES ?
move.l (SP)+, (SP) ;STRIP PARAMETERS
rts ;RETURN
ELSEIF &Eval(&parm1)<=8 THEN
move.l (sp), &parm1(sp)
addq #&parm1, sp
rts
ELSE
move.l (sp), &parm1(sp)
add.w #&parm1, sp
rts
ENDIF
ENDIF
ENDM
ENDIF ; ...already included