mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2025-01-15 12:30:53 +00:00
168 lines
4.0 KiB
Plaintext
168 lines
4.0 KiB
Plaintext
|
;
|
|||
|
; File: ColorPicker.a
|
|||
|
;
|
|||
|
; Contains: Assembly language goodies to go with the Color Picker
|
|||
|
;;
|
|||
|
; Copyright: <09> 1987-1990 by Apple Computer, Inc., all rights reserved.
|
|||
|
;
|
|||
|
; Change History (most recent first):
|
|||
|
;
|
|||
|
; <2> 8/28/90 dvb NEEDED FOR SIXPACK: Fix to work w/o 32bit qd
|
|||
|
; <<3C>1.1> 7/24/89 CSD FOR 6.0.4. Forcing submission to upgrade to the 32-Bit QuickDraw
|
|||
|
; Color Picker.
|
|||
|
;
|
|||
|
; To Do:
|
|||
|
;
|
|||
|
|
|||
|
;EASE$$$ READ ONLY COPY of file <20>ColorPicker.a<>
|
|||
|
;<3B>1.1 CSD 07/24/1989 FOR 6.0.4. Forcing submission to upgrade to the 32-Bit
|
|||
|
; QuickDraw Color Picker.
|
|||
|
;----------------------------------------------------------------
|
|||
|
;
|
|||
|
; Assembly glue for Color Picker package
|
|||
|
;
|
|||
|
; Copyright <20> 1987, 1988 Apple Computer, Inc. All rights reserved.
|
|||
|
;
|
|||
|
;-----------------------------------------------------------------
|
|||
|
|
|||
|
BLANKS ON
|
|||
|
|
|||
|
INCLUDE 'Traps.a'
|
|||
|
|
|||
|
Picker MAIN EXPORT
|
|||
|
|
|||
|
IMPORT glueFix2SmallFract
|
|||
|
IMPORT glueSmallFract2Fix
|
|||
|
IMPORT glueCMY2RGB
|
|||
|
IMPORT glueRGB2CMY
|
|||
|
IMPORT glueHSL2RGB
|
|||
|
IMPORT glueRGB2HSL
|
|||
|
IMPORT glueHSV2RGB
|
|||
|
IMPORT glueRGB2HSV
|
|||
|
IMPORT glueGetColor
|
|||
|
|
|||
|
bra.s Dispatch
|
|||
|
|
|||
|
dc.w 0 ;start of package header (need doc)
|
|||
|
dc.l 'PACK'
|
|||
|
dc.w 12 ;package number
|
|||
|
dc.w 1 ;version number
|
|||
|
Dispatch
|
|||
|
lea Picker, a0 ;get our address
|
|||
|
_RecoverHandle ;get our master pointer
|
|||
|
_HLock ;lock us down
|
|||
|
move.l (sp)+,a0 ;pop return address
|
|||
|
move.w (sp)+,d0 ;get routine selector
|
|||
|
move.l a0,-(sp) ;restore return address
|
|||
|
asl.w #1,d0 ;make routine selector word index
|
|||
|
move.w JTab-2(d0.w),d0 ;get routine offset
|
|||
|
jmp JTab(d0.w) ;go to selected routine
|
|||
|
JTab
|
|||
|
dc.w glueFix2SmallFract-JTab
|
|||
|
dc.w glueSmallFract2Fix-JTab
|
|||
|
dc.w glueCMY2RGB-JTab
|
|||
|
dc.w glueRGB2CMY-JTab
|
|||
|
dc.w glueHSL2RGB-JTab
|
|||
|
dc.w glueRGB2HSL-JTab
|
|||
|
dc.w glueHSV2RGB-JTab
|
|||
|
dc.w glueRGB2HSV-JTab
|
|||
|
dc.w glueGetColor-JTab
|
|||
|
;
|
|||
|
;-------------------------------------------------------------------------------------
|
|||
|
; Next: Routines for unpacking the tightly-wadded 32-bit wedges.
|
|||
|
|
|||
|
; FUNCTION: NibbleUnpack(src,dst: Pointer):LONGINT;
|
|||
|
;
|
|||
|
; Unpack data pointed to by src, and deposit it starting at dest.
|
|||
|
;
|
|||
|
; Data are unpacked as follows:
|
|||
|
; A control byte is followed by two data bytes. The high nibble of the control byte
|
|||
|
; specifies the repeat count for the first data byte, and the low nibble of the
|
|||
|
; control byte specifies the repeat count for the second data byte.
|
|||
|
; A control byte of ZERO indicates end of data.
|
|||
|
;
|
|||
|
; Unpack the data. Return number of source bytes unpacked.
|
|||
|
;
|
|||
|
NibbleUnpack PROC EXPORT
|
|||
|
|
|||
|
UnPackVars RECORD {A6Link},DECREMENT
|
|||
|
result DS.B 4 ;result: Long
|
|||
|
src DS.B 4 ;WindowPtr
|
|||
|
dst DS.B 4 ;EventRecord
|
|||
|
return DS.B 4 ;return address
|
|||
|
A6Link DS.B 4 ;old contents of A6
|
|||
|
|
|||
|
linkSize DS.B 0 ;linky number
|
|||
|
ENDR
|
|||
|
|
|||
|
WITH UnPackVars
|
|||
|
|
|||
|
|
|||
|
LINK A6, #linkSize
|
|||
|
MOVEM.L D3-D6,-(SP) ;save all regs
|
|||
|
|
|||
|
MOVE.L src(A6),A0 ;A0->source
|
|||
|
MOVE.L dst(A6),A1 ;A1->destination
|
|||
|
|
|||
|
@com CLR.L D0 ;trash the upper bits
|
|||
|
CLR.L D1
|
|||
|
MOVE.B (A0)+,D0 ;D0 = two counts
|
|||
|
BEQ.S @alldone ; Zero? => end of sequence
|
|||
|
|
|||
|
MOVE.B D0,D1
|
|||
|
LSR #4,D1
|
|||
|
MOVE.B (A0)+,D2
|
|||
|
BRA.S @end1
|
|||
|
@sing1 MOVE.B D2,(A1)+ ;Move a byte...
|
|||
|
@end1 DBRA D1,@sing1
|
|||
|
|
|||
|
MOVE.B D0,D1
|
|||
|
AND #$F,D1
|
|||
|
MOVE.B (A0)+,D2
|
|||
|
BRA.S @end2
|
|||
|
@sing2 MOVE.B D2,(A1)+ ;Move a byte...
|
|||
|
@end2 DBRA D1,@sing2
|
|||
|
|
|||
|
BRA.S @com
|
|||
|
|
|||
|
@alldone
|
|||
|
SUBA.L src(A6),A0 ;A0 = number of bytes read
|
|||
|
MOVE.L A0,result(A6) ;return that value
|
|||
|
|
|||
|
MOVEM.L (SP)+,D3-D6 ;restore them regs
|
|||
|
UNLK A6
|
|||
|
MOVE.L (SP),A0 ;A0->return address
|
|||
|
ADD.L #result-return,SP ;Remove calling stack
|
|||
|
JMP (A0) ;Leave
|
|||
|
|
|||
|
PROC
|
|||
|
EXPORT SetGray25Pat,SetGray50Pat,SetGray75Pat,SetGray50BPat
|
|||
|
|
|||
|
thatGray25Pat
|
|||
|
DC.B $55,$00,$55,$00,$55,$00,$55,$00
|
|||
|
thatGray50Pat
|
|||
|
DC.B $55,$AA,$55,$AA,$55,$AA,$55,$AA
|
|||
|
thatGray75Pat ;
|
|||
|
DC.B $FF,$AA,$FF,$AA,$FF,$AA,$FF,$AA
|
|||
|
thatGray50BPat ; stripes, to checker over
|
|||
|
DC.B $FF,$00,$FF,$00,$FF,$00,$FF,$00
|
|||
|
|
|||
|
SetGray25Pat
|
|||
|
PEA thatGray25Pat
|
|||
|
share _PenPat
|
|||
|
RTS
|
|||
|
SetGray50Pat
|
|||
|
PEA thatGray50Pat
|
|||
|
BRA.S share
|
|||
|
SetGray75Pat
|
|||
|
PEA thatGray75Pat
|
|||
|
BRA.S share
|
|||
|
SetGray50BPat
|
|||
|
PEA thatGray50BPat
|
|||
|
BRA.S share
|
|||
|
|
|||
|
END
|
|||
|
|
|||
|
|
|||
|
|