; ; bbox.s ; ; Bounding box calculations for Sculptrix borders ; ; © 1995-1998 Straylight ; ;----- Licensing note ------------------------------------------------------- ; ; This file is part of Straylight's Sculptrix. ; ; Sculptrix is free software; you can redistribute it and/or modify ; it under the terms of the GNU General Public License as published by ; the Free Software Foundation; either version 2, or (at your option) ; any later version. ; ; Sculptrix is distributed in the hope that it will be useful, ; but WITHOUT ANY WARRANTY; without even the implied warranty of ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ; GNU General Public License for more details. ; ; You should have received a copy of the GNU General Public License ; along with Sculptrix. If not, write to the Free Software Foundation, ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. ;----- Standard header ------------------------------------------------------ GET libs:header GET libs:swis GET libs:stream ;----- External dependencies ------------------------------------------------ GET sh.vString GET sh.wSpace ;----- Main code ------------------------------------------------------------ AREA |Module$$Code|,CODE,READONLY ; --- bbox_calc --- ; ; On entry: R1 == pointer to icon block ; ; On exit: R0 == 0 if there was no border, or nonzero otherwise ; ; Use: Updates the block to represent the size of the border. EXPORT bbox_calc bbox_calc ROUT STMFD R13!,{R1-R4,R14} ;Save some registers BL vString_read ;Read the validation string BCC %85bbox_calc ;If no border, return ; --- Work out where to go --- AND R14,R0,#&0000FF00 ;Extract the general code CMP R14,#(%10-%00)<<6 ;Check it's in range ADDCC PC,PC,R14,LSR #6 ;Yes -- dispatch it then B %85bbox_calc ;Otherwise ignore it 00 B %10bbox_calc ;A simple border type B %20bbox_calc ;A group box B %85bbox_calc ;A text+sprite icon ; --- A normal icon --- 10bbox_calc AND R0,R0,#&FF ;Leave only the subtype ADR R14,bbox__table ;Point to a smart table LDRB R0,[R14,R0] ;Load the sizes out LDMIA R1,{R2-R4,R14} ;Load the bounding box SUB R2,R2,R0 ;Modify the bounding box SUB R3,R3,R0 ADD R4,R4,R0 ADD R14,R14,R0 STMIA R1,{R2-R4,R14} ;Save modified box back MOV R0,#-1 ;Return a mystic value B %90bbox_calc ;And return to caller ; --- A group box --- 20bbox_calc LDMIA R1,{R2-R4,R14} ;Load the bounding box SUB R2,R2,#8 ;Modify the bounding box SUB R3,R3,#8 ADD R4,R4,#8 ADD R14,R14,#32 STMIA R1,{R2-R4,R14} ;Save modified box back MOV R0,#-1 ;Return a mystic value B %90bbox_calc ;And return to caller ; --- Return then --- 85bbox_calc MOV R0,#0 ;Nothing happened here 90bbox_calc LDMFD R13!,{R1-R4,PC}^ ;Return to caller bbox__table DCB 4,12,8,12,8 LTORG ;----- That's all, folks ---------------------------------------------------- END