mirror of
https://github.com/elliotnunn/mac-rom.git
synced 2025-01-05 08:30:14 +00:00
4325cdcc78
Resource forks are included only for .rsrc files. These are DeRezzed into their data fork. 'ckid' resources, from the Projector VCS, are not included. The Tools directory, containing mostly junk, is also excluded.
588 lines
17 KiB
Plaintext
588 lines
17 KiB
Plaintext
;
|
|
; File: GrafAsm.m.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: © 1988-1990 by Apple Computer, Inc., all rights reserved.
|
|
;
|
|
; Change History (most recent first):
|
|
;
|
|
; <3> 10/10/90 JL Change SysError to MSysError to avoid conflict with Traps.a
|
|
; <2> 5/30/90 JT Adding to BBS for the first time. OpenPort, InitPort, and
|
|
; SetPort now reset the horizontal pen fraction.
|
|
; <1.2> 7/6/89 GGD Un-Proc'd InitPort so that alignment wouldn't screw up OpenPort
|
|
; falling into it.
|
|
; <1.1> 11/11/88 CCH Fixed Header.
|
|
; <1.0> 11/9/88 CCH Adding to EASE.
|
|
; <1.2> 10/12/88 CCH Changed Òm.GrafType.aÓ to ÒGrafType.m.aÓ.
|
|
; <1.1> 5/18/88 MSH Changed inclides to use m.GRAPHTYPES to work under EASE.
|
|
; <1.0> 2/11/88 BBM Adding file for the first time into EASEÉ
|
|
;
|
|
; To Do:
|
|
;
|
|
|
|
;EASE$$$ READ ONLY COPY of file ÒGRAFASM.m.aÓ
|
|
; 1.2 GGD 07/06/1989 Un-Proc'd InitPort so that alignment wouldn't screw up OpenPort falling into it.
|
|
; 1.1 CCH 11/11/1988 Fixed Header.
|
|
; 1.0 CCH 11/ 9/1988 Adding to EASE.
|
|
; OLD REVISIONS BELOW
|
|
; 1.2 CCH 10/12/1988 Changed Òm.GrafType.aÓ to ÒGrafType.m.aÓ.
|
|
; 1.1 MSH 5/18/88 Changed inclides to use m.GRAPHTYPES to work under EASE.
|
|
; 1.0 BBM 2/11/88 Adding file for the first time into EASEÉ
|
|
; END EASE MODIFICATION HISTORY
|
|
|
|
|
|
|
|
BLANKS ON
|
|
STRING ASIS
|
|
|
|
INCLUDE 'GRAFTYPES.m.a'
|
|
|
|
IF (&TYPE('hasPenFraction') = 'UNDEFINED') THEN
|
|
IF forROM THEN
|
|
hasPenFraction EQU 0
|
|
ELSEIF (sysVers >= $700) THEN
|
|
hasPenFraction EQU 1
|
|
ELSE
|
|
hasPenFraction EQU 0
|
|
ENDIF
|
|
ENDIF
|
|
|
|
;------------------------------------------------------------
|
|
;
|
|
; --> GRAFASM.TEXT
|
|
;
|
|
; Miscellaneous unclassified routines.
|
|
;
|
|
|
|
|
|
NewHandle FUNC EXPORT
|
|
EXPORT SetHSize
|
|
;------------------------------------------------
|
|
;
|
|
; FUNCTION NewHandle(byteCount: INTEGER): Ptr;
|
|
;
|
|
MOVEQ #0,D0 ;clear out high part
|
|
MOVE.L (SP)+,A1 ;get return address
|
|
MOVE.W (SP)+,D0 ;get the byte count
|
|
_NewHandle ;ask OS to do request
|
|
BNE.S MemFull ;if memory full, deep shit!
|
|
MOVE.L A0,(SP) ;return result handle on stack
|
|
JMP (A1) ;return to caller
|
|
|
|
; handle the memory full error by deep-shitting
|
|
|
|
MemFull MOVEQ #25,D0 ;Deep Shit memory full error code
|
|
_MSysError
|
|
DC.W $A9FF ;invoke debugger just in case it comes back
|
|
|
|
;
|
|
; PROCEDURE SetHSize(h: Handle; newSize: INTEGER);
|
|
;
|
|
SetHSize MOVEQ #0,D0 ;clear high word
|
|
MOVE.L (SP)+,A1 ;pop return address
|
|
MOVE.W (SP)+,D0 ;pop the new size
|
|
MOVE.L (SP)+,A0 ;pop the handle
|
|
_SetHandleSize ;let OS do it
|
|
BNE.S MemFull ;if out of memory, deepShit
|
|
JMP (A1) ;return to caller
|
|
|
|
|
|
|
|
InitGraf PROC EXPORT
|
|
;--------------------------------------------------
|
|
;
|
|
; PROCEDURE InitGraf(globalPtr: Ptr);
|
|
;
|
|
;
|
|
PARAMSIZE EQU 4
|
|
GLOBALPTR EQU PARAMSIZE+8-4 ;LONG
|
|
|
|
LINK A6,#0 ;NO LOCALS
|
|
MOVE.L A4,-(SP) ;SAVE REG
|
|
MOVE.L GLOBALPTR(A6),A4 ;GET POINTER TO QUICKDRAW GLOBALS
|
|
MOVE.L A4,GRAFGLOBALS(A5) ;SAVE IN MAGIC LOCATION
|
|
;
|
|
; new addition 22 Apr 85
|
|
;
|
|
CLR.B $8F3 ; set lo-mem flag, QDExist
|
|
|
|
LEA lastGrafGlob(A4),A0 ;SET UP START POINTER
|
|
LEA thePort+4(A4),A1 ;SET UP LIMIT POINTER
|
|
CLRLP CLR.W (A0)+ ;CLEAR A WORD
|
|
CMPA.L A1,A0 ;CHECK LIMIT POINTER
|
|
BNE CLRLP ;CLEAR ALL GLOBALS
|
|
|
|
;QDSpareD..QDSpare4 = all zeros
|
|
;playIndex := 0
|
|
;fontPtr = Nil
|
|
;FixTxWid := 0.0
|
|
;patAlign := (0,0)
|
|
;polyMax := 0
|
|
;thePoly := Nil
|
|
;QDSpare0 := 0
|
|
;playPic := Nil
|
|
;rgnMax := 0
|
|
;rgnIndex := 0
|
|
;rgnBuf := Nil
|
|
|
|
LEA wideData(A4),A4
|
|
MOVE.L A4,D0 ;REMEMBER ADDR OF WIDEDATA
|
|
MOVE #10,(A4)+ ;wideData.rgnSize := 10
|
|
MOVE.L #$80018001,(A4)+ ;wideData.rgnBBox :=
|
|
MOVE.L #$7FFF7FFF,(A4)+ ;(-32767,-32767,32767,32767)
|
|
MOVE.L A4,D1 ;REMEMBER ADDR OF WIDEMASTER
|
|
MOVE.L D0,(A4)+ ;wideMaster := @wideData
|
|
MOVE.L D1,(A4)+ ;wideOpen := @wideMaster
|
|
MOVEQ #1,D0
|
|
MOVE.L D0,(A4)+ ;randSeed := 1
|
|
MOVE.L A4,-(SP) ;point to screenBits
|
|
_GetScrnBits ;fill in screenBits
|
|
ADD #14,A4 ;bump past screenBits
|
|
MOVEQ #26,D0 ;INIT LOOP COUNT
|
|
LEA CURDATA,A0 ;POINT TO CURSOR DATA
|
|
CRSRLP MOVE.L (A0)+,(A4)+ ;COPY A LONG INTO GLOBALS
|
|
DBRA D0,CRSRLP ;LOOP FOR 27 LONGS
|
|
;thePort := NIL
|
|
MOVE.L (SP)+,A4 ;RESTORE REG
|
|
UNLINK PARAMSIZE,'INITGRAF'
|
|
|
|
|
|
CURDATA DC.W $0000,$4000,$6000,$7000 ;ARROW.DATA
|
|
DC.W $7800,$7C00,$7E00,$7F00
|
|
DC.W $7F80,$7C00,$6C00,$4600
|
|
DC.W $0600,$0300,$0300,$0000
|
|
|
|
DC.W $C000,$E000,$F000,$F800 ;ARROW.MASK
|
|
DC.W $FC00,$FE00,$FF00,$FF80
|
|
DC.W $FFC0,$FFE0,$FE00,$EF00
|
|
DC.W $CF00,$8780,$0780,$0380
|
|
|
|
DC.W $0001,$0001 ;ARROW.HOTSPOT := (1,1)
|
|
|
|
DC.L $77DD77DD,$77DD77DD ;dkGray
|
|
DC.L $88228822,$88228822 ;ltGray
|
|
DC.L $AA55AA55,$AA55AA55 ;gray
|
|
DC.L $FFFFFFFF,$FFFFFFFF ;black
|
|
DC.L $00000000,$00000000 ;white
|
|
|
|
|
|
|
|
OpenPort PROC EXPORT
|
|
IMPORT NewRgn
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE OpenPort(port: GrafPtr);
|
|
; { allocate clipRgn and visRgn, then call InitPort.
|
|
;
|
|
CLR.L -(SP) ;MAKE ROOM FOR FUNCTION RESULT
|
|
JSR NEWRGN ;ALLOCATE A NEW REGION
|
|
CLR.L -(SP) ;MAKE ROOM FOR FUNCTION RESULT
|
|
JSR NEWRGN ;ALLOCATE A SECOND NEW REGION
|
|
MOVE.L 12(SP),A0 ;POINT TO PORT
|
|
MOVE.L (SP)+,CLIPRGN(A0) ;INSTALL NEW REGION INTO CLIPRGN
|
|
MOVE.L (SP)+,VISRGN(A0) ;AND OTHER INTO VISRGN
|
|
;FALL THRU TO InitPort
|
|
|
|
|
|
EXPORT InitPort ; <1.2>
|
|
IMPORT RectRgn,CopyRgn ; <1.2>
|
|
InitPort ; <1.2>
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE InitPort(port: GrafPtr);
|
|
;
|
|
; { initialize all fields of an existing GrafPort }
|
|
;
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L 4(SP),A1 ;GET PORT PARAM
|
|
MOVE.L A1,THEPORT(A0) ;SetPort(port)
|
|
IF hasPenFraction THEN
|
|
move.w #$8000,pnLocFixed(a0) ; reset pen fraction.
|
|
ENDIF
|
|
CLR.W (A1)+ ;DEVICE := 0
|
|
LEA SCREENBITS(A0),A0 ;POINT TO SCREENBITS
|
|
MOVE.L (A0)+,(A1)+ ;portBits := screenBits
|
|
MOVE.W (A0)+,(A1)+ ;COPY ROWBYTES
|
|
MOVE.L (A0),(A1)+ ;COPY TOPLEFT
|
|
MOVE.L 4(A0),(A1)+ ;COPY BOTRIGHT
|
|
MOVE.L (A0),(A1)+ ;portRect := screenBits.bounds
|
|
MOVE.L 4(A0),(A1)+ ;all 8 bytes
|
|
MOVE.L (A1)+,-(SP) ;visRgn := screenBits.bounds
|
|
MOVE.L A0,-(SP)
|
|
JSR RECTRGN
|
|
MOVE.L 4(SP),A1 ;GET PORT PARAM
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L WIDEOPEN(A0),-(SP) ;PUSH WIDE OPEN RGN
|
|
MOVE.L CLIPRGN(A1),-(SP) ;PUSH CLIPRGN
|
|
JSR COPYRGN ;SET TO WIDE OPEN
|
|
MOVE.L 4(SP),A1 ;GET PORT PARAM
|
|
LEA BKPAT(A1),A1
|
|
CLR.L (A1)+ ;bkPat := white
|
|
CLR.L (A1)+
|
|
MOVEQ #-1,D0
|
|
MOVE.L D0,(A1)+ ;fillPat := Black
|
|
MOVE.L D0,(A1)+
|
|
CLR.L (A1)+ ;pnLoc := (0,0)
|
|
MOVE.L #$00010001,(A1)+ ;pnSize := (1,1)
|
|
MOVE #8,(A1)+ ;pnMode := patCopy
|
|
MOVE.L D0,(A1)+ ;pnPat := black
|
|
MOVE.L D0,(A1)+
|
|
CLR.W (A1)+ ;pnVis := 0
|
|
CLR.L (A1)+ ;txFont, txFace := 0
|
|
MOVE #1,(A1)+ ;txMode := srcOr
|
|
CLR (A1)+ ;txSize := 0
|
|
CLR.L (A1)+ ;spExtra := 0.0
|
|
MOVE.L #blackColor,(A1)+ ;fgColor := blackColor
|
|
MOVE.L #whiteColor,(A1)+ ;bkColor := whiteColor
|
|
CLR.L (A1)+ ;colrBit,patStretch := 0
|
|
CLR.L (A1)+ ;picSave := Nil
|
|
CLR.L (A1)+ ;rgnSave := Nil
|
|
CLR.L (A1)+ ;polySave := Nil
|
|
CLR.L (A1)+ ;grafProcs := Nil
|
|
MOVE.L (SP)+,(SP) ;STRIP PARAM
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
ClosePort PROC EXPORT
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE ClosePort(port: GrafPtr);
|
|
;
|
|
; { just disposes of clipRgn and visRgn }
|
|
;
|
|
MOVE.L 4(SP),A0 ;GET PORT
|
|
MOVE.L CLIPRGN(A0),A0 ;GET CLIPRGN HANDLE
|
|
_DisposHandle ;DISCARD IT
|
|
MOVE.L 4(SP),A0 ;GET PORT
|
|
MOVE.L VISRGN(A0),A0 ;GET VISRGN HANDLE
|
|
_DisposHandle ;DISCARD IT
|
|
MOVE.L (SP)+,(SP) ;STRIP PARAM
|
|
RTS ;AND RETURN
|
|
|
|
|
|
SetStdProcs PROC EXPORT
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetStdProcs(VAR procs: QDProcs);
|
|
;
|
|
MOVE.L (SP)+,A0 ;pop return addr
|
|
MOVE.L (SP)+,A1 ;pop addr of proc record
|
|
MOVE.L JStdText,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdLine,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdRect,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdRRect,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdOval,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdArc,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdPoly,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdRgn,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdBits,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdComment,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdTxMeas,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdGetPic,(A1)+ ;copy piece of trap table
|
|
MOVE.L JStdPutPic,(A1)+ ;copy piece of trap table
|
|
JMP (A0) ;and return
|
|
|
|
|
|
|
|
LocalToGlobal PROC EXPORT
|
|
EXPORT GlobalToLocal,AddPt,SubPt,SetPort,GetPort
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE LocalToGlobal(VAR pt: Point);
|
|
;
|
|
; restores all registers.
|
|
;
|
|
MOVEM.L D0-D2/A0/A1,-(SP) ;SAVE REGS
|
|
MOVE.L #1,D2 ;INDICATE SUB
|
|
BRA.S SHARE
|
|
|
|
|
|
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE GlobalToLocal(VAR pt: Point);
|
|
;
|
|
; restores all registers.
|
|
;
|
|
GlobalToLocal
|
|
MOVEM.L D0-D2/A0/A1,-(SP) ;SAVE REGS
|
|
MOVE.L #0,D2 ;INDICATE ADD
|
|
SHARE MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;POINT TO CURRENT GRAFPORT
|
|
MOVE.L 24(SP),A1 ;POINT TO VAR PT
|
|
MOVE PORTBITS+BOUNDS+TOP(A0),D0 ;GET DV
|
|
MOVE PORTBITS+BOUNDS+LEFT(A0),D1 ;GET DH
|
|
BSR.S ADDSUB ;CONVERT TO LOCAL
|
|
MOVEM.L (SP)+,D0-D2/A0/A1 ;RESTORE REGS
|
|
BRA.S SHARE3 ;STRIP 4 BYTES AND RETURN
|
|
;
|
|
;
|
|
;
|
|
ADDSUB TST D2
|
|
BEQ.S JUSTADD
|
|
NEG D0
|
|
NEG D1
|
|
JUSTADD ADD D0,(A1)+
|
|
ADD D1,(A1)+
|
|
RTS
|
|
|
|
|
|
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE AddPt(src: Point; VAR dst: Point);
|
|
; { add two points together, restores all regs }
|
|
;
|
|
AddPt MOVEM.L D0-D2/A1,-(SP) ;SAVE REGS
|
|
MOVE.L #0,D2 ;INDICATE ADD
|
|
BRA.S SHARE2
|
|
|
|
|
|
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE SubPt(src: Point; VAR dst: Point);
|
|
; { subtract src Point from dst point, restores all regs }
|
|
;
|
|
SubPt MOVEM.L D0-D2/A1,-(SP) ;SAVE REGS
|
|
MOVE.L #1,D2 ;INDICATE SUB
|
|
SHARE2 MOVE.L 20(SP),A1 ;POINT TO DST
|
|
MOVE 24+V(SP),D0 ;GET SRC.V
|
|
MOVE 24+H(SP),D1 ;GET SRC.H
|
|
BSR.S ADDSUB
|
|
MOVEM.L (SP)+,D0-D2/A1 ;RESTORE REGS
|
|
MOVE.L (SP)+,(SP)
|
|
SHARE3 MOVE.L (SP)+,(SP)
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetPort(gp: GrafPtr);
|
|
; { switch the current port to a different GrafPort }
|
|
;
|
|
SetPort MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L 4(SP),THEPORT(A0) ;INSTALL INTO THEPORT
|
|
IF hasPenFraction THEN
|
|
move.w #$8000,pnLocFixed(a0) ; reset pen fraction.
|
|
ENDIF
|
|
BRA.S SHARE3 ;STRIP 4 BYTES AND RETURN
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE GetPort(VAR gp: GrafPtr);
|
|
; { inquire the current GrafPort }
|
|
;
|
|
GetPort MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L 4(SP),A1 ;POINT TO VAR GP
|
|
MOVE.L THEPORT(A0),(A1) ;COPY FROM THEPORT
|
|
BRA.S SHARE3 ;STRIP 4 BYTES AND RETURN
|
|
|
|
|
|
|
|
GrafDevice PROC EXPORT
|
|
IMPORT PortWord
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE GrafDevice(device: INTEGER);
|
|
;
|
|
MOVEQ #DEVICE,D0 ;PUT PORT OFFSET IN D0
|
|
JMP PORTWORD ;INSTALL PARAM INTO THEPORT
|
|
|
|
|
|
|
|
SetPortBits PROC EXPORT
|
|
EXPORT BackPat
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetPortBits(bm: BitMap);
|
|
; { re-direct output to a different BitMap }
|
|
;
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
LEA PORTBITS(A0),A0 ;POINT TO PORTBITS
|
|
MOVE.L 4(SP),A1 ;POINT TO BITMAP
|
|
MOVE.L (A1)+,(A0)+ ;COPY BASEADDR
|
|
MOVE.W (A1)+,(A0)+ ;COPY ROWBYTES
|
|
SHARE MOVE.L (A1)+,(A0)+ ;COPY BOUNDS.TOPLEFT
|
|
MOVE.L (A1)+,(A0)+ ;COPY BOUNDS.BOTRIGHT
|
|
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE BackPat(pat: Pattern);
|
|
; { set the background pattern }
|
|
;
|
|
BackPat MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
LEA BKPAT(A0),A0 ;POINT TO BKPAT
|
|
MOVE.L 4(SP),A1 ;GET ADDR OF PATTERN
|
|
BRA.S SHARE
|
|
|
|
|
|
|
|
PortSize PROC EXPORT
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE PortSize(width,height: INTEGER);
|
|
;
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
MOVE PORTRECT+LEFT(A0),D0 ;GET PORTRECT.LEFT
|
|
ADD 6(SP),D0 ;ADD WIDTH
|
|
MOVE D0,PORTRECT+RIGHT(A0) ;UPDATE PORTRECT.RIGHT
|
|
MOVE PORTRECT+TOP(A0),D0 ;GET PORTRECT.TOP
|
|
ADD 4(SP),D0 ;ADD HEIGHT
|
|
MOVE D0,PORTRECT+BOTTOM(A0) ;UPDATE PORTRECT.BOTTOM
|
|
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
MovePortTo PROC EXPORT
|
|
EXPORT SetOrigin,ClipRect
|
|
IMPORT OffsetRgn,RectRgn
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE MovePortTo(leftGlobal,topGlobal: INTEGER);
|
|
; { move portRect to a different part of the bitmap }
|
|
;
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
MOVE PORTRECT+LEFT(A0),D0 ;GET PORTRECT.LEFT
|
|
SUB PORTBITS+BOUNDS+LEFT(A0),D0 ;CONVERT TO GLOBAL
|
|
SUB 6(SP),D0 ;SUB LEFTGLOBAL FOR DH
|
|
MOVE PORTRECT+TOP(A0),D1 ;GET PORTRECT.TOP
|
|
SUB PORTBITS+BOUNDS+TOP(A0),D1 ;CONVERT TO GLOBAL
|
|
SUB 4(SP),D1 ;SUB TOPGLOBAL FOR DV
|
|
MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
|
|
OFSPORT LEA PORTBITS+BOUNDS(A0),A0 ;OFFSET PORTBITS.BOUNDS DH,DV
|
|
OFSRECT ADD D1,(A0)+ ;OFFSET TOP
|
|
ADD D0,(A0)+ ;OFFSET LEFT
|
|
ADD D1,(A0)+ ;OFFSET BOTTOM
|
|
ADD D0,(A0)+ ;OFFSET RIGHT
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetOrigin(h,v: INTEGER);
|
|
; { re-define the local coords by adjusting portBits.bounds, }
|
|
; { portRect, and visRgn }
|
|
;
|
|
SetOrigin
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
MOVE.L 4(SP),D0 ;GET V AND H BOTH
|
|
CMP.L PORTRECT+TOPLEFT(A0),D0 ;SAME AS ALREADY IN THEPORT ?
|
|
BEQ.S DONE ;YES, QUIT
|
|
MOVE 6(SP),D0 ;GET H
|
|
SUB PORTRECT+LEFT(A0),D0 ;DH:=H-PORTRECT.LEFT
|
|
MOVE 4(SP),D1 ;GET V
|
|
SUB PORTRECT+TOP(A0),D1 ;DV:=V-PORTRECT.TOP
|
|
MOVE.L VISRGN(A0),-(SP) ;PUSH PARMS FOR LATER
|
|
MOVE D0,-(SP)
|
|
MOVE D1,-(SP)
|
|
BSR.S OFSPORT ;OFFSET PORTBITS.BOUNDS
|
|
LEA PORTRECT-PORTBITS-BOUNDS-8(A0),A0 ;POINT A0 AT PORTRECT
|
|
BSR.S OFSRECT ;OFFSET PORTRECT
|
|
JSR OFFSETRGN
|
|
DONE MOVE.L (SP)+,(SP) ;STRIP 4 BYTES
|
|
RTS ;AND RETURN
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE ClipRect(r: Rect);
|
|
; { Make the current grafport's clipRgn match a given rectangle }
|
|
;
|
|
ClipRect
|
|
MOVE.L GRAFGLOBALS(A5),A0 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A0),A0 ;GET CURRENT GRAFPORT
|
|
MOVE.L CLIPRGN(A0),-(SP) ;PUSH CLIPRGN
|
|
MOVE.L 8(SP),-(SP) ;PUCH ADDR OF RECT
|
|
JSR RECTRGN
|
|
BRA.S DONE
|
|
|
|
|
|
|
|
SetClip PROC EXPORT
|
|
EXPORT GetClip
|
|
IMPORT CopyRgn
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetClip(rgn: RgnHandle);
|
|
;
|
|
; copy rgn into theport^.clipRgn
|
|
;
|
|
MOVE.L (SP)+,A0 ;POP RETURN ADDR
|
|
MOVE.L GRAFGLOBALS(A5),A1 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A1),A1 ;GET CURRENT GRAFPORT
|
|
MOVE.L CLIPRGN(A1),-(SP) ;PUSH THEPORT^.CLIPRGN
|
|
BRA.S SHARE
|
|
|
|
|
|
|
|
;----------------------------------------------------------
|
|
;
|
|
; PROCEDURE GetClip(rgn: RgnHandle);
|
|
;
|
|
; copy from theport^.clipRgn into rgn.
|
|
;
|
|
GetClip
|
|
MOVE.L (SP)+,A0 ;POP RETURN ADDR
|
|
MOVE.L (SP)+,D0 ;POP RGN HANDLE
|
|
MOVE.L GRAFGLOBALS(A5),A1 ;POINT TO QUICKDRAW GLOBALS
|
|
MOVE.L THEPORT(A1),A1 ;GET CURRENT GRAFPORT
|
|
MOVE.L CLIPRGN(A1),-(SP) ;PUSH THEPORT^.CLIPRGN
|
|
MOVE.L D0,-(SP) ;PUSH RGN
|
|
SHARE MOVE.L A0,-(SP) ;RESTORE RETURN ADDR
|
|
JMP COPYRGN ;AND GO TO COPYRGN
|
|
|
|
|
|
|
|
SetPt PROC EXPORT
|
|
;-------------------------------------------------------------
|
|
;
|
|
; PROCEDURE SetPt(VAR pt: Point; h,v: INTEGER);
|
|
;
|
|
MOVE.L (SP)+,A0 ;POP RETURN ADDR
|
|
MOVE.L (SP)+,D0 ;POP H,V
|
|
MOVE.L (SP)+,A1 ;POP VAR ADDR OF PT
|
|
MOVE.L D0,(A1) ;STORE H,V INTO PT
|
|
JMP (A0) ;RETURN
|
|
|
|
|
|
EqualPt FUNC EXPORT
|
|
;----------------------------------------------------------
|
|
;
|
|
; FUNCTION EqualPt(pt1,pt2: Point): BOOLEAN;
|
|
;
|
|
; CLOBBERS D0,A0.
|
|
;
|
|
MOVE.L (SP)+,A0 ;POP RETURN ADDR
|
|
MOVE.L (SP)+,D0 ;pop point1
|
|
CMP.L (SP)+,D0 ;is point2 = point1 ?
|
|
SEQ (SP) ;IF YES, SET TO TRUE
|
|
NEG.B (SP) ;CONVERT -1 TO 1
|
|
JMP (A0) ;RETURN
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|