LOAD 'Macros.dump' INCLUDE 'Pict.equ' INCLUDE 'Driver.equ' IMPORT Q_ChangePictSize IMPORT Q_Copy2 IMPORT Q_JustRect IMPORT D_NeedHandle IMPORT Q_Nop IMPORT D_ZeroBlock IMPORT Q_addbytes IMPORT Q_center IMPORT count IMPORT Q_half IMPORT newptr IMPORT oldptr IMPORT Q_pictSCB IMPORT Q_picterr IMPORT Q_printsquare IMPORT Q_square import temp IMPORT thepoint IMPORT what ENTRY Q_FlipHRgn ENTRY Q_FlipVRgn ENTRY MangleRgn ENTRY Q_RotLRgn ENTRY Q_RotRRgn ENTRY Q_flipdx ENTRY flipdy **************************************************************** * ; * Q_Region flipping and rotating routines ; *______________________________________________________________* * ; * Q_MangleRegion(rgn:l,what:w,prerec:l):newrgn:l ; *______________________________________________________________* * ; * NOTE! The Apple Q_Region data structure is proprietary, ; * and as such, this code may legally belong to Apple, if ; * they ask for it. ; * ; **************************************************************** *--------------------------------------------------------------* * Copy a Q_Region picture opcode and mangle its data ; *--------------------------------------------------------------* Q_Region PROC EXPORT ;Using Q_PictData EXPORT Q_JustRgn jsl Q_Nop ; copy the opcode Q_JustRgn ; cmpw [ clc adc Q_center+2 ; pt.x <= pt.y - Q_center.y + Q_center.x sec sbc Q_center sta temp ; (divide by 2, preserving asl temp ; the sign) ror a ; clc adc Q_Point rts Q_flipdx ; sta Q_Point lda Q_center ; pt.y <= pt.x - Q_center.x + Q_center.y and #1 ; clc adc Q_center sec sbc Q_center+2 sta temp ; (divide by 2, preserving asl temp ; the sign) ror a ; clc adc Q_Point rts *--------------------------------------------------------------* preprgn spacelong pushword #0 pushword rgnsize pushword #$8000 jsl D_NeedHandle sta Q_picterr pulllong newrgn jcs prepped movelong [newrgn],newrptr moveword rgnsize,[newrptr] ; copy the size ldy #2 ; mangle the bounding Q_Rect lda [oldrptr],y jsr flipdy ldy #4 sta [newrptr],y ldy #4 lda [oldrptr],y jsr Q_flipdx ldy #2 sta [newrptr],y ldy #6 lda [oldrptr],y jsr flipdy ldy #8 sta [newrptr],y ldy #8 lda [oldrptr],y jsr Q_flipdx ldy #6 sta [newrptr],y clc ; SIGH prepped rts Q_Point DS.B 2 temp DS.B 2 ENDP **************************************************************** * * Q_RotRRgn -- rotate a Q_Region clockwise * **************************************************************** Q_RotRRgn PROC EXPORT ;Using Q_PictData input oldrgn:l output newrgn:l local tmprgn:l begin spacelong pushlong oldrgn jsl Q_FlipDRgn sta Q_picterr pulllong tmpRgn bcs notmp spacelong pushlong tmprgn jsl Q_FlipHRgn sta Q_picterr pulllong newrgn pushlong tmprgn _DisposeHandle notmp return Q_picterr ENDP **************************************************************** * * Q_RotLRgn -- rotate a Q_Region anticlockwise * **************************************************************** Q_RotLRgn PROC EXPORT ;Using Q_PictData input oldrgn:l output newrgn:l local tmprgn:l begin spacelong pushlong oldrgn jsl Q_FlipHRgn sta Q_picterr pulllong tmpRgn bcs notmp spacelong pushlong tmprgn jsl Q_FlipDRgn sta Q_picterr pulllong newrgn pushlong tmprgn _DisposeHandle notmp return Q_picterr ENDP END