mac-rom/QuickDraw/LCursor.a
2017-10-08 23:26:23 +08:00

175 lines
4.5 KiB
Plaintext

;
; File: LCursor.a
;
; Contains: xxx put contents here (or delete the whole line) xxx
;
; Written by: xxx put name of writer here (or delete the whole line) xxx
;
; Copyright: © 1981-1990 by Apple Computer, Inc., all rights reserved.
;
; This file is used in these builds: Mac32 Bigbang Sys606
;
; Change History (most recent first):
;
; <3> 9/17/90 BG Removed <2>. 040s are now behaving more reliably.
; <2> 6/26/90 BG Added EclipseNOPs for flakey 040s.
; <¥1.4> 5/29/89 BAL Blasting in 32-Bit QuickDraw version 1.0 Final
; <¥1.3> 4/12/89 BAL Blasting in 32-Bit QuickDraw 1.0B1
; 10/13/86 EHB Moved AllocCrsr to CRSRCORE; Call it from AllocCursor
; 10/6/86 EHB Redid AllocCrsr to lock handles down and expand data.
; 10/3/86 EHB Moved AllocCrsr here from GrafAsm Added routine SetCCursor
;
BLANKS ON
STRING ASIS
;------------------------------------------------------------------
;
; --> LCURSOR.TEXT
;
; Interfaces to low-level cursor routines.
;
; New color cursor support routines.
;
;------------------------------------------------------------------
AllocCursor PROC EXPORT
IMPORT AllocCrsr
;----------------------------------------------------------
;
; PROCEDURE AllocCursor;
;
LEA AllocCrsr,A0 ;get default cursor routine
MOVE.L JAllocCrsr,D0 ;has vector been initialized?
BEQ.S @0 ;=>no, use default routine
MOVE.L D0,A0 ;else use routine in vector
@0 JMP (A0) ;and call it
InitCursor PROC EXPORT
;----------------------------------------------------------
;
; PROCEDURE InitCursor;
;
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
PEA ARROW(A0) ;PUSH ADDR OF ARROW
_SetCursor ;INSTALL ARROW CURSOR
MOVE.L JInitCrsr,A0 ;get lo mem pointer
JMP (A0) ;and call it
SetCursor PROC EXPORT
;---------------------------------------------------
;
; PROCEDURE SetCursor(crsr: Cursor);
;
MOVE.L 4(SP),A0 ;Point to Cursor
MOVE.L HOTSPOT+V(A0),-(SP) ;PUSH HOTX & HOTY
MOVE #16,-(SP) ;HEIGHT:=16
PEA DATA(A0) ;PUSH ADDR OF DATA
PEA MASK(A0) ;PUSH ADDR OF MASK
MOVE.L JSetCrsr,A0 ;get lo mem vector
JSR (A0) ;call vector
MOVE.L (SP)+,(SP) ;strip param
RTS ;and return
SetCCursor PROC EXPORT
;---------------------------------------------------
;
; PROCEDURE SetCCursor(CCRSR: CCrsrHandle);
;
; For compatibility with other cursor drawing routines, set up the
; old cursor data as before, but make sure it's hidden so the B/W cursor
; isn't displayed.
; _HideCursor ; make sure it's hidden
; MOVE.L 4(SP),A0 ; get the color cursor handle
; MOVE.L (A0),A0 ; get the color cursor pointer
; PEA CRSR1DATA(A0) ; point to the old-style cursor
; _SetCursor ; and set it the old way
MOVE.L 4(SP),-(SP) ; Push handle to color cursor
MOVE.L JSetCCrsr,A0 ; get lo mem vector
JSR (A0) ; call vector (but don't call him hector)
; _ShowCursor ; balance is a virtue
MOVE.L (SP)+,(SP) ; strip param
RTS ; and return
HideCursor PROC EXPORT
;---------------------------------------------------------
;
; PROCEDURE HideCursor;
;
; ALL REGS PRESERVED.
;
MOVE.L JHideCursor,-(SP) ;get lo mem vector
RTS ;and call it
ShowCursor PROC EXPORT
;---------------------------------------------------------
;
; PROCEDURE ShowCursor;
;
; ALL REGS PRESERVED.
;
MOVE.L JShowCursor,-(SP) ;get lo mem vector
RTS ;and call it
ShieldCursor PROC EXPORT
;---------------------------------------------------------
;
; PROCEDURE ShieldCursor(shieldRect: Rect; offset: Point);
;
; ALL REGS PRESERVED.
;
MOVEM.L D0-D3/A0-A1,-(SP) ;SAVE REGS
MOVE.L 32(SP),A0 ;POINT TO SHIELDRECT
MOVEM.W (A0)+,D0/D1/D2/D3 ;GET TOP ... RIGHT
LEA 28(SP),A1
SUB (A1),D0 ;TOP - OFFSET.V
SUB (A1)+,D2 ;BOTTOM - OFFSET.V
SUB (A1),D1 ;LEFT - OFFSET.H
SUB (A1),D3 ;RIGHT - OFFSET.H
MOVE D1,-(SP) ;PUSH GLOBAL LEFT
MOVE D0,-(SP) ;PUSH GLOBAL TOP
MOVE D3,-(SP) ;PUSH GLOBAL RIGHT
MOVE D2,-(SP) ;PUSH GLOBAL BOTTOM
MOVE.L JShieldCursor,A0 ;get lo mem vector
JSR (A0) ;and call it
MOVEM.L (SP)+,D0-D3/A0-A1 ;RESTORE REGS
MOVE.L (SP)+,(SP)
MOVE.L (SP)+,(SP) ;STRIP 8 BYTES
RTS ;AND RETURN
ObscureCursor PROC EXPORT
;---------------------------------------------------------
;
; PROCEDURE ObscureCursor;
;
; Hide the cursor image until the next time the mouse moves.
;
MOVE.L JCrsrObscure,A0 ;get lo mem vector
JMP (A0) ;and call it
ds.b 32
ENDPROC