Go to most recent revision | Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
3470 | mario79 | 1 | ;************************************************************** |
2 | ; Frame Macro for Kolibri OS |
||
3 | ; Copyright (c) 2013, Marat Zakiyanov aka Mario79, aka Mario |
||
4 | ; All rights reserved. |
||
5 | ; |
||
6 | ; Redistribution and use in source and binary forms, with or without |
||
7 | ; modification, are permitted provided that the following conditions are met: |
||
8 | ; * Redistributions of source code must retain the above copyright |
||
9 | ; notice, this list of conditions and the following disclaimer. |
||
10 | ; * Redistributions in binary form must reproduce the above copyright |
||
11 | ; notice, this list of conditions and the following disclaimer in the |
||
12 | ; documentation and/or other materials provided with the distribution. |
||
13 | ; * Neither the name of the |
||
14 | ; names of its contributors may be used to endorse or promote products |
||
15 | ; derived from this software without specific prior written permission. |
||
16 | ; |
||
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
||
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
||
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
||
20 | ; DISCLAIMED. IN NO EVENT SHALL |
||
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
||
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
||
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
||
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
||
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
||
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
||
27 | ;***************************************************************************** |
||
28 | macro frame_start |
||
29 | { |
||
30 | pusha |
||
31 | mov edi,dword [esp+36] |
||
32 | } |
||
33 | ;***************************************************************************** |
||
34 | macro frame_exit |
||
35 | { |
||
36 | popa |
||
37 | ret 4 |
||
38 | } |
||
39 | ;***************************************************************************** |
||
40 | macro use_frame |
||
41 | { |
||
42 | frame: |
||
43 | fr_type equ [edi] ;dword |
||
44 | fr_size_x equ [edi+4] ;word |
||
45 | fr_start_x equ [edi+6] ;word |
||
46 | fr_size_y equ [edi+8] ;word |
||
47 | fr_start_y equ [edi+10] ;word |
||
48 | fr_ext_fr_col equ [edi+12] ;dword |
||
49 | fr_int_fr_col equ [edi+16] ;dword |
||
50 | fr_draw_text_flag equ [edi+20] ;dword 0-not,1-yes |
||
51 | fr_text_pointer equ [edi+24] ;dword |
||
52 | fr_text_position equ [edi+28] ;dword 0-up,1-bottom |
||
53 | fr_font_number equ [edi+32] ;dword 0-monospace,1-variable |
||
54 | fr_font_size_y equ [edi+36] ;dword |
||
55 | fr_font_color equ [edi+40] ;dword |
||
56 | fr_font_backgr_color equ [edi+44] ;dword |
||
57 | ;***************************************************************************** |
||
58 | ;***************************************************************************** |
||
59 | ; draw event |
||
60 | ;***************************************************************************** |
||
61 | ;***************************************************************************** |
||
62 | align 4 |
||
63 | .draw: |
||
64 | frame_start |
||
65 | ;------------------------------------- |
||
66 | ; in |
||
67 | ; ebx = [coordinate on axis x]*65536 + [size on axis x] |
||
68 | ; ecx = [coordinate on axis y]*65536 + [size on axis y] |
||
69 | ;-------------------------------------- |
||
70 | ; top |
||
71 | mov bx,fr_start_x |
||
72 | shl ebx,16 |
||
73 | mov bx,fr_start_x |
||
74 | add bx,fr_size_x |
||
75 | |||
76 | mov cx,fr_start_y |
||
77 | shl ecx,16 |
||
78 | mov cx,fr_start_y |
||
79 | |||
80 | mcall 38,,,fr_ext_fr_col |
||
81 | |||
82 | add ecx,1 shl 16 +1 |
||
83 | add ebx,1 shl 16 |
||
84 | dec ebx |
||
85 | |||
86 | mcall ,,,fr_int_fr_col |
||
87 | ;-------------------------------------- |
||
88 | ; bottom |
||
89 | mov bx,fr_start_x |
||
90 | shl ebx,16 |
||
91 | mov bx,fr_start_x |
||
92 | add bx,fr_size_x |
||
93 | |||
94 | mov cx,fr_start_y |
||
95 | add cx,fr_size_y |
||
96 | shl ecx,16 |
||
97 | mov cx,fr_start_y |
||
98 | add cx,fr_size_y |
||
99 | |||
100 | mcall ,,,fr_ext_fr_col |
||
101 | |||
102 | sub ecx,1 shl 16 +1 |
||
103 | add ebx,1 shl 16 |
||
104 | dec ebx |
||
105 | |||
106 | mcall ,,,fr_int_fr_col |
||
107 | ;-------------------------------------- |
||
108 | ; left |
||
109 | mov bx,fr_start_x |
||
110 | shl ebx,16 |
||
111 | mov bx,fr_start_x |
||
112 | |||
113 | mov cx,fr_start_y |
||
114 | shl ecx,16 |
||
115 | mov cx,fr_start_y |
||
116 | add cx,fr_size_y |
||
117 | |||
118 | mcall ,,,fr_ext_fr_col |
||
119 | |||
120 | add ebx,1 shl 16 +1 |
||
121 | add ecx,1 shl 16 |
||
122 | dec ecx |
||
123 | |||
124 | mcall ,,,fr_int_fr_col |
||
125 | |||
126 | ;-------------------------------------- |
||
127 | ; right |
||
128 | mov bx,fr_start_x |
||
129 | add bx,fr_size_x |
||
130 | shl ebx,16 |
||
131 | mov bx,fr_start_x |
||
132 | add bx,fr_size_x |
||
133 | |||
134 | mov cx,fr_start_y |
||
135 | shl ecx,16 |
||
136 | mov cx,fr_start_y |
||
137 | add cx,fr_size_y |
||
138 | |||
139 | mcall ,,,fr_ext_fr_col |
||
140 | |||
141 | sub ebx,1 shl 16 +1 |
||
142 | add ecx,1 shl 16 |
||
143 | dec ecx |
||
144 | |||
145 | mcall ,,,fr_int_fr_col |
||
146 | ;---------------------------------------------------------------------- |
||
147 | cmp fr_draw_text_flag,dword 0 |
||
148 | je .exit |
||
149 | |||
150 | mov ecx,0xC0000000 |
||
151 | mov eax,fr_font_number |
||
152 | and eax,11b |
||
153 | shl eax,28 |
||
154 | add ecx,eax |
||
155 | mov eax,fr_font_color |
||
156 | and eax,0xffffff |
||
157 | add ecx,eax |
||
158 | |||
159 | mov edx,fr_text_pointer |
||
160 | |||
161 | mov eax,fr_font_backgr_color |
||
162 | and eax,0xffffff |
||
163 | |||
164 | xor esi,esi |
||
165 | |||
166 | mov bx,fr_start_x |
||
167 | add bx,10 |
||
168 | shl ebx,16 |
||
169 | mov bx,fr_font_size_y |
||
170 | shr bx,1 |
||
171 | |||
172 | not bx |
||
173 | add bx,fr_start_y |
||
174 | |||
175 | test fr_font_size_y,word 1b |
||
176 | jz @f |
||
177 | |||
178 | inc bx |
||
179 | ;-------------------------------------- |
||
180 | align 4 |
||
181 | @@: |
||
182 | cmp fr_text_position,dword 0 |
||
183 | je .draw_1 |
||
184 | |||
185 | add bx,fr_size_y |
||
186 | ;-------------------------------------- |
||
187 | align 4 |
||
188 | .draw_1: |
||
189 | push edi |
||
190 | mov edi,eax |
||
191 | mcall 4 |
||
192 | pop edi |
||
193 | ;---------------------------------------------------------------------- |
||
194 | align 4 |
||
195 | .exit: |
||
196 | frame_exit |
||
197 | } |
||
198 | ;***************************************************************************** |