mirror of
https://github.com/elliotnunn/supermario.git
synced 2024-12-01 02:51:04 +00:00
110 lines
3.2 KiB
Plaintext
110 lines
3.2 KiB
Plaintext
;EASE$$$ READ ONLY COPY of file “PUTRGN.m.a”
|
|
; 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'
|
|
|
|
;----------------------------------------------------------------
|
|
;
|
|
; MODIFICATION HISTORY
|
|
;
|
|
; C179/EHB 26Sep86 Fixed rectangular region bug in putRgn
|
|
;
|
|
|
|
PUTRGN PROC EXPORT
|
|
IMPORT SETHSIZE
|
|
;----------------------------------------------------------------
|
|
;
|
|
; PROCEDURE PutRgn(Rgn: RgnHandle; bufHandle: Handle; VAR index,size: INTEGER);
|
|
;
|
|
; Expands a region out to an array of inversion points.
|
|
;
|
|
|
|
|
|
;------------------------------------------------
|
|
;
|
|
; A6 OFFSETS OF PARAMETERS AFTER LINK:
|
|
;
|
|
PARAMSIZE EQU 16 ;TOTAL SIZE OF PARAMETERS
|
|
RGNHANDLE EQU PARAMSIZE+8-4 ;LONG,RGNHANDLE
|
|
BUFHANDLE EQU RGNHANDLE-4 ;LONG, HANDLE
|
|
INDEX EQU BUFHANDLE-4 ;LONG, VAR
|
|
SIZE EQU INDEX-4 ;LONG, VAR
|
|
|
|
|
|
LINK A6,#0 ;NO LOCAL VARS
|
|
MOVEM.L D7/A2-A4,-(SP) ;SAVE REGS
|
|
|
|
;-------------------------------------------------------
|
|
;
|
|
; EXPAND BUF TO FIT WORST CASE BYTESNEEDED = RGNSIZE * 2
|
|
;
|
|
MOVE.L BUFHANDLE(A6),A4 ;GET BUFHANDLE
|
|
MOVE.L RGNHANDLE(A6),A3 ;GET RGNHANDLE
|
|
MOVE.L INDEX(A6),A2 ;POINT TO CURRENT INDEX
|
|
MOVE.L (A3),A0 ;DE-REFERENCE RGN
|
|
MOVE (A0),D7 ;GET RGNSIZE
|
|
ADD D7,D7 ;TIMES 2
|
|
ADD (A2),D7 ;ADD CURRENT INDEX
|
|
MOVE.L SIZE(A6),A1 ;POINT TO SIZE
|
|
CMP (A1),D7 ;IS REQUIRED > CURRENT SIZE ?
|
|
BLE.S NOGROW ;NO, CONTINUE
|
|
|
|
ADD #256,D7 ;GROW IN CHUNKS
|
|
MOVE D7,(A1) ;UPDATE CURRENT SIZE
|
|
MOVE.L A4,-(SP) ;PUSH BUFHANDLE
|
|
MOVE D7,-(SP) ;PUSH NEW SIZE
|
|
JSR SETHSIZE ;MAKE ROOM IN BUF
|
|
MOVE.L (A3),A0 ;RE-DEREFERENCE RGNHANDLE
|
|
MOVE.L INDEX(A6),A2 ;GET ADDR OF INDEX AGAIN
|
|
|
|
NOGROW MOVE.L (A4),A1 ;DE-REFERENCE BUFHANDLE
|
|
ADD (A2),A1 ;ADD INDEX TO BUFPTR
|
|
CMP #10,RGNSIZE(A0) ;IS REGION RECTANGULAR ?
|
|
BNE.S NOTRECT ;NO, CONTINUE
|
|
ADD #2,A0 ;YES, POINT TO BBOX TOPLEFT
|
|
MOVE.L (A0),(A1)+ ;COPY TOPLEFT <EHB 26Sep86>
|
|
MOVE (A0)+,(A1)+ ;COPY TOP <EHB 26Sep86>
|
|
MOVE (A0)+,D0 ;GET LEFT <EHB 26Sep86>
|
|
MOVE.L (A0),D1 ;GET BOTRIGHT <EHB 26Sep86>
|
|
MOVE D1,(A1)+ ;COPY RIGHT <EHB 26Sep86>
|
|
MOVE (A0),(A1)+ ;COPY BOT <EHB 26Sep86>
|
|
MOVE D0,(A1)+ ;COPY LEFT <EHB 26Sep86>
|
|
MOVE.L D1,(A1)+ ;COPY BOTRIGHT <EHB 26Sep86>
|
|
BRA.S DONE ;UPDATE INDEX AND QUIT
|
|
|
|
NOTRECT LEA RGNDATA(A0),A0 ;POINT TO TOP VERT IN RGN
|
|
NXTVERT MOVE.L (A0)+,D7 ;GET VERT AND HORIZ COORDS
|
|
NXTHOR MOVE.L D7,(A1)+ ;PUT LEFT POINT TO DST
|
|
MOVE (A0)+,D7 ;GET HORIZ COORD
|
|
MOVE.L D7,(A1)+ ;PUT RIGHT POINT TO DST
|
|
MOVE (A0)+,D7 ;GET NEXT HORIZ COORD
|
|
CMP #32767,D7 ;END OF SCAN FLAG ?
|
|
BNE NXTHOR ;NO, GO FOR MORE
|
|
CMP #32767,(A0) ;END OF REGION ?
|
|
BNE NXTVERT ;NO, LOOP FOR MORE
|
|
|
|
DONE SUB.L (A4),A1 ;CALC DSTPTR - DSTSTART
|
|
MOVE A1,(A2) ;UPDATE VAR INDEX
|
|
GOHOME MOVEM.L (SP)+,D7/A2-A4 ;RESTORE REGISTERS
|
|
UNLINK PARAMSIZE,'PUTRGN '
|
|
|
|
|
|
|
|
|
|
END
|
|
|
|
|
|
|
|
|
|
|