4 ; Bounding box calculations for Sculptrix borders
6 ; © 1995-1998 Straylight
9 ;----- Licensing note -------------------------------------------------------
11 ; This file is part of Straylight's Sculptrix.
13 ; Sculptrix is free software; you can redistribute it and/or modify
14 ; it under the terms of the GNU General Public License as published by
15 ; the Free Software Foundation; either version 2, or (at your option)
18 ; Sculptrix is distributed in the hope that it will be useful,
19 ; but WITHOUT ANY WARRANTY; without even the implied warranty of
20 ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 ; GNU General Public License for more details.
23 ; You should have received a copy of the GNU General Public License
24 ; along with Sculptrix. If not, write to the Free Software Foundation,
25 ; 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 ;----- Standard header ------------------------------------------------------
34 ;----- External dependencies ------------------------------------------------
39 ;----- Main code ------------------------------------------------------------
41 AREA |Module$$Code|,CODE,READONLY
45 ; On entry: R1 == pointer to icon block
47 ; On exit: R0 == 0 if there was no border, or nonzero otherwise
49 ; Use: Updates the block to represent the size of the border.
54 STMFD R13!,{R1-R4,R14} ;Save some registers
55 BL vString_read ;Read the validation string
56 BCC %85bbox_calc ;If no border, return
58 ; --- Work out where to go ---
60 AND R14,R0,#&0000FF00 ;Extract the general code
61 CMP R14,#(%10-%00)<<6 ;Check it's in range
62 ADDCC PC,PC,R14,LSR #6 ;Yes -- dispatch it then
63 B %85bbox_calc ;Otherwise ignore it
65 00 B %10bbox_calc ;A simple border type
66 B %20bbox_calc ;A group box
67 B %85bbox_calc ;A text+sprite icon
69 ; --- A normal icon ---
71 10bbox_calc AND R0,R0,#&FF ;Leave only the subtype
72 ADR R14,bbox__table ;Point to a smart table
73 LDRB R0,[R14,R0] ;Load the sizes out
75 LDMIA R1,{R2-R4,R14} ;Load the bounding box
76 SUB R2,R2,R0 ;Modify the bounding box
80 STMIA R1,{R2-R4,R14} ;Save modified box back
81 MOV R0,#-1 ;Return a mystic value
82 B %90bbox_calc ;And return to caller
86 20bbox_calc LDMIA R1,{R2-R4,R14} ;Load the bounding box
87 SUB R2,R2,#8 ;Modify the bounding box
91 STMIA R1,{R2-R4,R14} ;Save modified box back
92 MOV R0,#-1 ;Return a mystic value
93 B %90bbox_calc ;And return to caller
97 85bbox_calc MOV R0,#0 ;Nothing happened here
98 90bbox_calc LDMFD R13!,{R1-R4,PC}^ ;Return to caller
100 bbox__table DCB 4,12,8,12,8
104 ;----- That's all, folks ----------------------------------------------------