Rev 109 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 109 | Rev 485 | ||
---|---|---|---|
Line 12... | Line 12... | ||
12 | dd 0x100000 ; memory for app |
12 | dd 0x100000 ; memory for app |
13 | dd 0x7fff0 ; esp |
13 | dd 0x7fff0 ; esp |
14 | dd 0x0 , 0x0 ; I_Param , I_Icon |
14 | dd 0x0 , 0x0 ; I_Param , I_Icon |
Line 15... | Line 15... | ||
15 | 15 | ||
16 | include 'lang.inc' |
16 | include 'lang.inc' |
Line 17... | Line 17... | ||
17 | include 'macros.inc' |
17 | include '..\..\..\macros.inc' |
18 | 18 | ||
Line 19... | Line 19... | ||
19 | window_x_size equ 346 |
19 | window_x_size equ 346 |
Line 31... | Line 31... | ||
31 | 31 | ||
Line 32... | Line 32... | ||
32 | still: |
32 | still: |
33 | 33 | ||
34 | mov eax,23 ; wait here for event |
34 | mov eax,23 ; wait here for event |
Line 35... | Line 35... | ||
35 | mov ebx,1 ; for 1ms |
35 | mov ebx,1 ; for 1ms |
36 | int 0x40 |
36 | mcall |
37 | 37 | ||
38 | cmp eax,1 ; redraw request ? |
38 | cmp eax,1 ; redraw request ? |
Line 48... | Line 48... | ||
48 | call draw_window ; draw our window |
48 | call draw_window ; draw our window |
49 | jmp check_mouse ; start the loop again |
49 | jmp check_mouse ; start the loop again |
50 | key: |
50 | key: |
Line 51... | Line 51... | ||
51 | 51 | ||
52 | mov eax,2 ; get a key |
52 | mov eax,2 ; get a key |
53 | int 0x40 ; do it |
53 | mcall ; do it |
54 | shr eax,8 ; move it to al |
54 | shr eax,8 ; move it to al |
55 | cmp byte [editstate],0 ; are we in edit mode |
55 | cmp byte [editstate],0 ; are we in edit mode |
56 | je check_mouse ; if not start loop again |
56 | je check_mouse ; if not start loop again |
57 | cmp al,8 ; is it a backspace |
57 | cmp al,8 ; is it a backspace |
Line 92... | Line 92... | ||
92 | no_lit: |
92 | no_lit: |
93 | jmp check_mouse ; start loop again |
93 | jmp check_mouse ; start loop again |
Line 94... | Line 94... | ||
94 | 94 | ||
95 | button: ; button |
95 | button: ; button |
96 | mov eax,17 ; get id |
96 | mov eax,17 ; get id |
Line 97... | Line 97... | ||
97 | int 0x40 |
97 | mcall |
98 | 98 | ||
99 | cmp ah,1 ; button id=1 ? |
99 | cmp ah,1 ; button id=1 ? |
100 | jne button_3 |
100 | jne button_3 |
101 | mov eax,-1 ; close this program |
101 | mov eax,-1 ; close this program |
102 | int 0x40 |
102 | mcall |
103 | button_3: |
103 | button_3: |
104 | cmp ah,3 ; was it button 3 - FILENAME |
104 | cmp ah,3 ; was it button 3 - FILENAME |
105 | jne button_4 ; no then try button 4 |
105 | jne button_4 ; no then try button 4 |
Line 132... | Line 132... | ||
132 | cmp ah,6 ; was it button 6 - CLEAR ICON |
132 | cmp ah,6 ; was it button 6 - CLEAR ICON |
133 | jne button_7 ; no then try button 7 |
133 | jne button_7 ; no then try button 7 |
134 | mov byte [editstate],0 ; dont want to be in edit mode |
134 | mov byte [editstate],0 ; dont want to be in edit mode |
135 | call draw_filename ; update filename |
135 | call draw_filename ; update filename |
136 | call clear_graph_icon ; clear the icon and edit screens |
136 | call clear_graph_icon ; clear the icon and edit screens |
- | 137 | jmp check_mouse |
|
- | 138 | ||
137 | button_7: |
139 | button_7: |
138 | cmp ah,7 ; was it button 7 - FLIP ICON |
140 | cmp ah,7 ; was it button 7 - FLIP ICON |
139 | jne button_8 ; no then try button 8 |
141 | jne button_8 ; no then try button 8 |
140 | call flip_icon ; flip |
142 | call flip_icon ; flip |
- | 143 | jmp check_mouse |
|
- | 144 | ||
141 | button_8: |
145 | button_8: |
142 | cmp ah,8 ; was it button 8 - MIRROR ICON |
146 | cmp ah,8 ; was it button 8 - MIRROR ICON |
143 | jne button_9 ; no then try button 9 |
147 | jne button_9 ; no then try button 9 |
144 | call flip_diag ; flip L/R and U/D |
148 | call flip_diag ; flip L/R and U/D |
145 | call flip_icon ; cheated now have to flip it |
149 | call flip_icon ; cheated now have to flip it |
- | 150 | jmp check_mouse |
|
- | 151 | ||
146 | button_9: |
152 | button_9: |
147 | cmp ah,9 ; was it button 9 - FLIP L/R and U/D |
153 | cmp ah,9 ; was it button 9 - FLIP L/R and U/D |
148 | jne button_10 ; no then try button 10 |
154 | jne button_10 ; no then try button 10 |
149 | call flip_diag ; flip L/R and U/D |
155 | call flip_diag ; flip L/R and U/D |
150 | call draw_icon ; update icon |
156 | call draw_icon ; update icon |
151 | call draw_graph ; update graph |
157 | call draw_graph ; update graph |
- | 158 | jmp check_mouse |
|
- | 159 | ||
152 | button_10: |
160 | button_10: |
153 | cmp ah,10 ; was it button 9 - SET AS BGR |
161 | cmp ah,10 ; was it button 9 - SET AS BGR |
154 | jne check_mouse ; no then exit |
162 | jne check_mouse ; no then exit |
155 | call set_background ; set as background |
163 | call set_background ; set as background |
Line 161... | Line 169... | ||
161 | ; ********************************************* |
169 | ; ********************************************* |
162 | draw_window: |
170 | draw_window: |
Line 163... | Line 171... | ||
163 | 171 | ||
164 | mov eax,12 ; function 12:tell os about windowdraw |
172 | mov eax,12 ; function 12:tell os about windowdraw |
165 | mov ebx,1 ; 1, start of draw |
173 | mov ebx,1 ; 1, start of draw |
166 | int 0x40 |
174 | mcall |
167 | ; DRAW WINDOW |
175 | ; DRAW WINDOW |
168 | mov eax,0 ; function 0 : define and draw window |
176 | mov eax,0 ; function 0 : define and draw window |
169 | mov ebx,100*65536+window_x_size ; [x start] *65536 + [x size] |
177 | mov ebx,100*65536+window_x_size ; [x start] *65536 + [x size] |
170 | mov ecx,100*65536+window_y_size ; [y start] *65536 + [y size] |
178 | mov ecx,100*65536+window_y_size ; [y start] *65536 + [y size] |
171 | mov edx,0x03ffffff ; color of work area 0x00RRGGBB |
- | |
172 | mov esi,0x807799bb ; color of grab bar 0x00RRGGBB |
- | |
173 | mov edi,0x007799bb ; color of frames 0x00RRGGBB |
- | |
174 | int 0x40 |
179 | mov edx,0x13ffffff ; color of work area 0x00RRGGBB |
175 | ; WINDOW LABEL |
- | |
176 | mov eax,4 ; function 4 : write text to window |
- | |
177 | mov ebx,7*65536+7 ; [x start] *65536 + [y start] |
- | |
178 | mov ecx,0xddeeff ; color of text 0x00RRGGBB |
- | |
179 | mov edx,labelt ; pointer to text beginning |
- | |
180 | mov esi,11 ; text length |
180 | mov edi,title ; WINDOW LABEL |
181 | int 0x40 |
- | |
- | 181 | mcall |
|
182 | ; DRAW BUTTON BAR |
182 | |
183 | mov eax,13 ; function 13 : draw bar |
183 | mov eax,13 ; function 13 : draw bar |
184 | mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size] |
184 | mov ebx,5*65536+window_x_size-9 ; [x start] *65536 + [x size] |
185 | mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size] |
185 | mov ecx,(window_y_size-20)*65536+16 ; [y start] *65536 + [y size] |
186 | mov edx,0x7799bb ; colour 0x00RRGGBB |
186 | mov edx,0x7799bb ; colour 0x00RRGGBB |
187 | int 0x40 |
187 | mcall |
188 | ; DEFINE BUTTON 3 : FILENAME |
188 | ; DEFINE BUTTON 3 : FILENAME |
189 | mov eax,8 ; function 8 : define button |
189 | mov eax,8 ; function 8 : define button |
190 | mov ebx,5*65536+62 ; [x start] *65536 + [x size] |
190 | mov ebx,5*65536+62 ; [x start] *65536 + [x size] |
191 | mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size] |
191 | mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size] |
192 | mov edx,3 ; button id number |
192 | mov edx,3 ; button id number |
193 | mov esi,0x7799bb ; button color 0x00RRGGBB |
193 | mov esi,0x7799bb ; button color 0x00RRGGBB |
194 | int 0x40 |
194 | mcall |
195 | ; BUTTON 3 TEXT |
195 | ; BUTTON 3 TEXT |
196 | mov eax,4 ; function 4 : write text to window |
196 | mov eax,4 ; function 4 : write text to window |
197 | mov ebx,13*65536+window_y_size-15 ; [x start] *65536 + [y start] |
197 | mov ebx,13*65536+window_y_size-15 ; [x start] *65536 + [y start] |
198 | mov ecx,0xddeeff ; text color 0x00RRGGBB |
198 | mov ecx,0xddeeff ; text color 0x00RRGGBB |
199 | mov edx,button_text_3 ; pointer to text beginning |
199 | mov edx,button_text_3 ; pointer to text beginning |
200 | mov esi,8 ; text length |
200 | mov esi,8 ; text length |
Line 201... | Line 201... | ||
201 | int 0x40 |
201 | mcall |
Line 202... | Line 202... | ||
202 | 202 | ||
203 | call draw_filename ; update filename |
203 | call draw_filename ; update filename |
204 | 204 | ||
205 | ; DEFINE BUTTON 4 : LOAD |
205 | ; DEFINE BUTTON 4 : LOAD |
206 | mov eax,8 ; function 8 : define button |
206 | mov eax,8 ; function 8 : define button |
207 | mov ebx,(window_x_size-87)*65536+38 ; [x start] *65536 + [x size] |
207 | mov ebx,(window_x_size-87)*65536+38 ; [x start] *65536 + [x size] |
208 | mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size] |
208 | mov ecx,(window_y_size-19)*65536+14 ; [y start] *65536 + [y size] |
209 | mov edx,4 ; button id number |
209 | mov edx,4 ; button id number |
210 | mov esi,0x7799bb ; button color 0x00RRGGBB |
210 | mov esi,0x7799bb ; button color 0x00RRGGBB |
211 | int 0x40 |
211 | mcall |
212 | ; DEFINE BUTTON 5 : SAVE |
212 | ; DEFINE BUTTON 5 : SAVE |
213 | mov ebx,(window_x_size-43)*65536+38 ; [x start] *65536 + [x size] |
213 | mov ebx,(window_x_size-43)*65536+38 ; [x start] *65536 + [x size] |
214 | mov edx,5 ; button id number |
214 | mov edx,5 ; button id number |
215 | int 0x40 |
215 | mcall |
216 | ; DEFINE BUTTON 6 : CLEAR ICON |
216 | ; DEFINE BUTTON 6 : CLEAR ICON |
217 | mov ebx,268*65536+72 ; [x start] *65536 + [x size] |
217 | mov ebx,268*65536+72 ; [x start] *65536 + [x size] |
218 | mov ecx,65*65536+14 ; [y start] *65536 + [y size] |
218 | mov ecx,65*65536+14 ; [y start] *65536 + [y size] |
219 | mov edx,6 ; button id number |
219 | mov edx,6 ; button id number |
220 | int 0x40 |
220 | mcall |
221 | ; DEFINE BUTTON 7 : FLIP VERTICAL |
221 | ; DEFINE BUTTON 7 : FLIP VERTICAL |
222 | mov ecx,85*65536+14 ; [y start] *65536 + [y size] |
222 | mov ecx,85*65536+14 ; [y start] *65536 + [y size] |
223 | mov edx,7 ; button id number |
223 | mov edx,7 ; button id number |
224 | int 0x40 |
224 | mcall |
225 | ; DEFINE BUTTON 8 : FLIP HORIZONTAL |
225 | ; DEFINE BUTTON 8 : FLIP HORIZONTAL |
226 | mov ecx,105*65536+14 ; [y start] *65536 + [y size] |
226 | mov ecx,105*65536+14 ; [y start] *65536 + [y size] |
227 | mov edx,8 ; button id number |
227 | mov edx,8 ; button id number |
228 | int 0x40 |
228 | mcall |
229 | ; DEFINE BUTTON 9 : SET AS BACKGROUND |
229 | ; DEFINE BUTTON 9 : SET AS BACKGROUND |
230 | mov ecx,125*65536+14 ; [y start] *65536 + [y size] |
230 | mov ecx,125*65536+14 ; [y start] *65536 + [y size] |
231 | mov edx,9 ; button id number |
231 | mov edx,9 ; button id number |
232 | int 0x40 |
232 | mcall |
233 | ; DEFINE BUTTON 10 : SET AS BACKGROUND |
233 | ; DEFINE BUTTON 10 : SET AS BACKGROUND |
234 | mov ecx,145*65536+14 ; [y start] *65536 + [y size] |
234 | mov ecx,145*65536+14 ; [y start] *65536 + [y size] |
235 | mov edx,10 ; button id number |
235 | mov edx,10 ; button id number |
236 | int 0x40 |
236 | mcall |
237 | ; BUTTON 4 TEXT |
237 | ; BUTTON 4 TEXT |
238 | mov eax,4 ; function 4 : write text to window |
238 | mov eax,4 ; function 4 : write text to window |
239 | mov ebx,267*65536+window_y_size-15 ; [x start] *65536 + [y start] |
239 | mov ebx,267*65536+window_y_size-15 ; [x start] *65536 + [y start] |
240 | mov ecx,0xddeeff ; text color 0x00RRGGBB |
240 | mov ecx,0xddeeff ; text color 0x00RRGGBB |
241 | mov edx,button_text_4 ; pointer to text beginning |
241 | mov edx,button_text_4 ; pointer to text beginning |
242 | mov esi,4 ; text length |
242 | mov esi,4 ; text length |
243 | int 0x40 |
243 | mcall |
244 | ; BUTTON 5 TEXT |
244 | ; BUTTON 5 TEXT |
245 | mov ebx,311*65536+window_y_size-15 ; [x start] *65536 + [y start] |
245 | mov ebx,311*65536+window_y_size-15 ; [x start] *65536 + [y start] |
246 | mov edx,button_text_5 ; pointer to text beginning |
246 | mov edx,button_text_5 ; pointer to text beginning |
247 | int 0x40 |
247 | mcall |
248 | ; BUTTON 6 TEXT |
248 | ; BUTTON 6 TEXT |
249 | mov ebx,275*65536+69 ; [x start] *65536 + [y start] |
249 | mov ebx,275*65536+69 ; [x start] *65536 + [y start] |
250 | mov edx,button_text_6 ; pointer to text beginning |
250 | mov edx,button_text_6 ; pointer to text beginning |
251 | mov esi,10 ; text length |
251 | mov esi,10 ; text length |
252 | int 0x40 |
252 | mcall |
253 | ; BUTTON 7 TEXT |
253 | ; BUTTON 7 TEXT |
254 | mov ebx,275*65536+89 ; [x start] *65536 + [y start] |
254 | mov ebx,275*65536+89 ; [x start] *65536 + [y start] |
255 | mov edx,button_text_7 ; pointer to text beginning |
255 | mov edx,button_text_7 ; pointer to text beginning |
256 | int 0x40 |
256 | mcall |
257 | ; BUTTON 8 TEXT |
257 | ; BUTTON 8 TEXT |
258 | mov ebx,275*65536+109 ; [x start] *65536 + [y start] |
258 | mov ebx,275*65536+109 ; [x start] *65536 + [y start] |
259 | mov edx,button_text_8 ; pointer to text beginning |
259 | mov edx,button_text_8 ; pointer to text beginning |
260 | int 0x40 |
260 | mcall |
261 | ; BUTTON 9 TEXT |
261 | ; BUTTON 9 TEXT |
262 | mov ebx,275*65536+129 ; [x start] *65536 + [y start] |
262 | mov ebx,275*65536+129 ; [x start] *65536 + [y start] |
263 | mov edx,button_text_9 ; pointer to text beginning |
263 | mov edx,button_text_9 ; pointer to text beginning |
264 | int 0x40 |
264 | mcall |
265 | ; BUTTON 10 TEXT |
265 | ; BUTTON 10 TEXT |
266 | mov ebx,275*65536+149 ; [x start] *65536 + [y start] |
266 | mov ebx,275*65536+149 ; [x start] *65536 + [y start] |
267 | mov edx,button_text_10 ; pointer to text beginning |
267 | mov edx,button_text_10 ; pointer to text beginning |
268 | int 0x40 |
268 | mcall |
269 | ; DRAW GRAPH BACKGROUND |
269 | ; DRAW GRAPH BACKGROUND |
270 | mov eax,13 ; function 13 : draw bar |
270 | mov eax,13 ; function 13 : draw bar |
271 | mov ebx,6*65536+257 ; [x start] *65536 + [x size] |
271 | mov ebx,6*65536+257 ; [x start] *65536 + [x size] |
272 | mov ecx,26*65536+257 ; [y start] *65536 + [y size] |
272 | mov ecx,26*65536+257 ; [y start] *65536 + [y size] |
273 | mov edx,0x7799bb ; colour 0x00RRGGBB |
273 | mov edx,0x7799bb ; colour 0x00RRGGBB |
274 | int 0x40 |
274 | mcall |
275 | ; DRAW ICON BACKGROUND |
275 | ; DRAW ICON BACKGROUND |
276 | mov ebx,268*65536+34 ; [x start] *65536 + [x size] |
276 | mov ebx,268*65536+34 ; [x start] *65536 + [x size] |
277 | mov ecx,26*65536+34 ; [y start] *65536 + [y size] |
277 | mov ecx,26*65536+34 ; [y start] *65536 + [y size] |
278 | int 0x40 |
278 | mcall |
279 | ; DRAW PALETTE BACKGROUND |
279 | ; DRAW PALETTE BACKGROUND |
280 | mov ebx,268*65536+34 ; [x start] *65536 + [x size] |
280 | mov ebx,268*65536+34 ; [x start] *65536 + [x size] |
281 | mov ecx,217*65536+33 ; [y start] *65536 + [y size] |
281 | mov ecx,217*65536+33 ; [y start] *65536 + [y size] |
282 | int 0x40 |
282 | mcall |
283 | ; DRAW PALETTE BACKGROUND |
283 | ; DRAW PALETTE BACKGROUND |
284 | mov ebx,268*65536+33 ; [x start] *65536 + [x size] |
284 | mov ebx,268*65536+33 ; [x start] *65536 + [x size] |
285 | mov ecx,250*65536+33 ; [y start] *65536 + [y size] |
285 | mov ecx,250*65536+33 ; [y start] *65536 + [y size] |
286 | int 0x40 |
286 | mcall |
287 | ; DRAW PALETTE BACKGROUND |
287 | ; DRAW PALETTE BACKGROUND |
288 | mov ebx,301*65536+33 ; [x start] *65536 + [x size] |
288 | mov ebx,301*65536+33 ; [x start] *65536 + [x size] |
289 | mov ecx,249*65536+34 ; [y start] *65536 + [y size] |
289 | mov ecx,249*65536+34 ; [y start] *65536 + [y size] |
290 | int 0x40 |
290 | mcall |
291 | ; DRAW GREYSCALE BACKGROUND |
291 | ; DRAW GREYSCALE BACKGROUND |
292 | mov ebx,307*65536+34 ; [x start] *65536 + [x size] |
292 | mov ebx,307*65536+34 ; [x start] *65536 + [x size] |
293 | mov ecx,210*65536+34 ; [y start] *65536 + [y size] |
293 | mov ecx,210*65536+34 ; [y start] *65536 + [y size] |
294 | int 0x40 |
294 | mcall |
295 | ; DRAW SELECTED COLOUR BACKGROUND |
295 | ; DRAW SELECTED COLOUR BACKGROUND |
296 | mov ebx,268*65536+73 ; [x start] *65536 + [x size] |
296 | mov ebx,268*65536+73 ; [x start] *65536 + [x size] |
297 | mov ecx,171*65536+34 ; [y start] *65536 + [y size] |
297 | mov ecx,171*65536+34 ; [y start] *65536 + [y size] |
298 | int 0x40 |
298 | mcall |
299 | ; DRAW WHITE TO START |
299 | ; DRAW WHITE TO START |
300 | mov ebx,269*65536+71 ; [x start] *65536 + [x size] |
300 | mov ebx,269*65536+71 ; [x start] *65536 + [x size] |
301 | mov ecx,172*65536+32 ; [y start] *65536 + [y size] |
301 | mov ecx,172*65536+32 ; [y start] *65536 + [y size] |
302 | mov edx,0xffffff ; colour 0x00RRGGBB |
302 | mov edx,0xffffff ; colour 0x00RRGGBB |
303 | int 0x40 |
303 | mcall |
304 | ; DRAW PALETTE RED + GREEN SECTION |
304 | ; DRAW PALETTE RED + GREEN SECTION |
305 | xor edi,edi ; clear column loop count |
305 | xor edi,edi ; clear column loop count |
Line 317... | Line 317... | ||
317 | sub edx,edi ; minus column count |
317 | sub edx,edi ; minus column count |
318 | shl edx,8 ; into position 0x0000RR00 |
318 | shl edx,8 ; into position 0x0000RR00 |
319 | add edx,255 ; maximum green |
319 | add edx,255 ; maximum green |
320 | sub edx,esi ; minus line count |
320 | sub edx,esi ; minus line count |
321 | shl edx,8 ; into position 0x00RRGG00 |
321 | shl edx,8 ; into position 0x00RRGG00 |
322 | int 0x40 |
322 | mcall |
323 | add esi,5 ; colour in steps of 5 to keep small |
323 | add esi,5 ; colour in steps of 5 to keep small |
324 | cmp esi,255 ; have we done a line |
324 | cmp esi,255 ; have we done a line |
325 | jne next_r_g_inner ; nop then do next pixel |
325 | jne next_r_g_inner ; nop then do next pixel |
326 | add edi,5 ; colour in steps of 5 to keep small |
326 | add edi,5 ; colour in steps of 5 to keep small |
327 | cmp edi,255 ; have we done all columns |
327 | cmp edi,255 ; have we done all columns |
Line 341... | Line 341... | ||
341 | add ecx,250 |
341 | add ecx,250 |
342 | mov edx,255 |
342 | mov edx,255 |
343 | sub edx,edi |
343 | sub edx,edi |
344 | shl edx,16 |
344 | shl edx,16 |
345 | add edx,esi |
345 | add edx,esi |
346 | int 0x40 |
346 | mcall |
347 | add esi,5 |
347 | add esi,5 |
348 | cmp esi,255 |
348 | cmp esi,255 |
349 | jne next_g_b_inner |
349 | jne next_g_b_inner |
350 | add edi,5 |
350 | add edi,5 |
351 | cmp edi,255 |
351 | cmp edi,255 |
Line 364... | Line 364... | ||
364 | shr ecx,3 |
364 | shr ecx,3 |
365 | add ecx,250 |
365 | add ecx,250 |
366 | mov edx,edi |
366 | mov edx,edi |
367 | shl edx,8 |
367 | shl edx,8 |
368 | add edx,esi |
368 | add edx,esi |
369 | int 0x40 |
369 | mcall |
370 | add esi,5 |
370 | add esi,5 |
371 | cmp esi,255 |
371 | cmp esi,255 |
372 | jne next_b_r_inner |
372 | jne next_b_r_inner |
373 | add edi,5 |
373 | add edi,5 |
374 | cmp edi,255 |
374 | cmp edi,255 |
Line 389... | Line 389... | ||
389 | mov edx,esi |
389 | mov edx,esi |
390 | shl edx,8 |
390 | shl edx,8 |
391 | add edx,esi |
391 | add edx,esi |
392 | shl edx,8 |
392 | shl edx,8 |
393 | add edx,esi |
393 | add edx,esi |
394 | int 0x40 |
394 | mcall |
395 | add esi,5 |
395 | add esi,5 |
396 | cmp esi,255 |
396 | cmp esi,255 |
397 | jne next_b_w_inner |
397 | jne next_b_w_inner |
398 | add edi,5 |
398 | add edi,5 |
399 | cmp edi,255 |
399 | cmp edi,255 |
Line 407... | Line 407... | ||
407 | call draw_icon ; draw icon area |
407 | call draw_icon ; draw icon area |
408 | call draw_graph ; draw edit area |
408 | call draw_graph ; draw edit area |
Line 409... | Line 409... | ||
409 | 409 | ||
410 | mov eax,12 ; function 12:tell os about windowdraw |
410 | mov eax,12 ; function 12:tell os about windowdraw |
411 | mov ebx,2 ; 2, end of draw |
411 | mov ebx,2 ; 2, end of draw |
Line 412... | Line 412... | ||
412 | int 0x40 |
412 | mcall |
Line 413... | Line 413... | ||
413 | 413 | ||
414 | ret ; return |
414 | ret ; return |
Line 439... | Line 439... | ||
439 | 439 | ||
440 | mov eax,15 ; background |
440 | mov eax,15 ; background |
441 | mov ebx,1 ; set background size |
441 | mov ebx,1 ; set background size |
442 | mov ecx,32 ; x size |
442 | mov ecx,32 ; x size |
- | 443 | mov edx,32 ; y size |
|
443 | mov edx,32 ; y size |
444 | mcall ; do it |
- | 445 | mov ebx,4 ; type of background draw |
|
- | 446 | mov ecx,1 ; tile |
|
444 | int 0x40 ; do it |
447 | mcall ; do it |
445 | mov ebx,5 ; blockmove image to os bgr memory |
448 | mov ebx,5 ; blockmove image to os bgr memory |
446 | mov ecx,image+3600 ; point to image |
449 | mov ecx,image+3600 ; point to image |
447 | mov edx,0 ; start of bgr memory |
450 | mov edx,0 ; start of bgr memory |
448 | mov esi,32*32*3 ; byte count |
- | |
449 | int 0x40 ; do it |
- | |
450 | mov ebx,4 ; type of background draw |
- | |
451 | mov ecx,1 ; tile |
451 | mov esi,32*32*3 ; byte count |
452 | int 0x40 ; do it |
452 | mcall ; do it |
453 | mov ebx,3 ; draw background |
453 | mov ebx,3 ; draw background |
Line 454... | Line 454... | ||
454 | int 0x40 ; do it |
454 | mcall ; do it |
Line 455... | Line 455... | ||
455 | 455 | ||
456 | ret ; return |
456 | ret ; return |
457 | 457 | ||
458 | ; ********************************************* |
458 | ; ********************************************* |
Line 459... | Line 459... | ||
459 | ; ******* GET SCREEN X and Y SIZE ******** |
459 | ; ******* GET SCREEN X and Y SIZE ******** |
460 | ; ********************************************* |
460 | ; ********************************************* |
461 | get_screen_size: |
461 | get_screen_size: |
462 | 462 | ||
463 | mov eax,14 ; function 14 : get screen max |
463 | mov eax,14 ; function 14 : get screen max |
464 | int 0x40 ; returns eax : 0xXXXXYYYY |
464 | mcall ; returns eax : 0xXXXXYYYY |
465 | push eax ; save reg |
465 | push eax ; save reg |
Line 481... | Line 481... | ||
481 | mov eax,6 ; function 6 : load file |
481 | mov eax,6 ; function 6 : load file |
482 | mov ebx,icon ; point to the name |
482 | mov ebx,icon ; point to the name |
483 | mov ecx,0 ; reserved |
483 | mov ecx,0 ; reserved |
484 | mov edx,200000 ; reserved |
484 | mov edx,200000 ; reserved |
485 | mov esi,image ; point to image buffer |
485 | mov esi,image ; point to image buffer |
486 | int 0x40 ; do it |
486 | mcall ; do it |
Line 487... | Line 487... | ||
487 | 487 | ||
Line 488... | Line 488... | ||
488 | ret ; return |
488 | ret ; return |
489 | 489 | ||
Line 495... | Line 495... | ||
495 | mov eax,33 ; function 33 : save file |
495 | mov eax,33 ; function 33 : save file |
496 | mov ebx,icon ; point to name |
496 | mov ebx,icon ; point to name |
497 | mov ecx,image ; point to our data |
497 | mov ecx,image ; point to our data |
498 | mov edx,54+32*32*3 ; how much data to transfer |
498 | mov edx,54+32*32*3 ; how much data to transfer |
499 | xor esi,esi ; 0 - create a new file |
499 | xor esi,esi ; 0 - create a new file |
500 | int 0x40 ; do it |
500 | mcall ; do it |
Line 501... | Line 501... | ||
501 | 501 | ||
Line 502... | Line 502... | ||
502 | ret ; return |
502 | ret ; return |
503 | 503 | ||
Line 509... | Line 509... | ||
509 | pusha ; save all registers on stack |
509 | pusha ; save all registers on stack |
510 | mov eax,13 ; function 13 : draw bar |
510 | mov eax,13 ; function 13 : draw bar |
511 | mov ebx,73*65536+81 ; [x start] *65536 + [x size] |
511 | mov ebx,73*65536+81 ; [x start] *65536 + [x size] |
512 | mov ecx,(window_y_size-19)*65536+15 ; [y start] *65536 + [y size] |
512 | mov ecx,(window_y_size-19)*65536+15 ; [y start] *65536 + [y size] |
513 | mov edx,0x557799 ; colour 0x00RRGGBB |
513 | mov edx,0x557799 ; colour 0x00RRGGBB |
514 | int 0x40 |
514 | mcall |
Line 515... | Line 515... | ||
515 | 515 | ||
516 | mov eax,4 ; function 4 : write text to window |
516 | mov eax,4 ; function 4 : write text to window |
517 | mov ebx,78*65536+(window_y_size-15) ; [y start] *65536 + [y size] |
517 | mov ebx,78*65536+(window_y_size-15) ; [y start] *65536 + [y size] |
518 | xor ecx,ecx ; colour 0x00RRGGBB = black |
518 | xor ecx,ecx ; colour 0x00RRGGBB = black |
519 | mov edx,icon ; point to text |
519 | mov edx,icon ; point to text |
520 | mov esi,12 ; number of characters to write |
520 | mov esi,12 ; number of characters to write |
521 | cmp byte [editstate],1 ; are we in edit mode |
521 | cmp byte [editstate],1 ; are we in edit mode |
522 | jne no_active_1 ; no then jump over change colour |
522 | jne no_active_1 ; no then jump over change colour |
523 | mov ecx,0x00112299 ; else change colour |
523 | mov ecx,0x00112299 ; else change colour |
524 | no_active_1: |
524 | no_active_1: |
525 | int 0x40 ; do it |
525 | mcall ; do it |
526 | popa ; return all registers to original |
526 | popa ; return all registers to original |
Line 527... | Line 527... | ||
527 | ret ; return |
527 | ret ; return |
528 | 528 | ||
Line 539... | Line 539... | ||
539 | mov ebx,269+31 ; x start position |
539 | mov ebx,269+31 ; x start position |
540 | pixel: |
540 | pixel: |
541 | mov edx,[eax] ; colour 0x00RRGGBB from image data |
541 | mov edx,[eax] ; colour 0x00RRGGBB from image data |
542 | push eax ; save our position |
542 | push eax ; save our position |
543 | mov eax,1 ; function 1 : put pixel |
543 | mov eax,1 ; function 1 : put pixel |
544 | int 0x40 ; do it |
544 | mcall ; do it |
545 | pop eax ; restore our position |
545 | pop eax ; restore our position |
546 | sub eax,3 ; point to next pixel colour |
546 | sub eax,3 ; point to next pixel colour |
547 | dec ebx ; move our x position |
547 | dec ebx ; move our x position |
548 | inc esi ; increment our column count |
548 | inc esi ; increment our column count |
549 | cmp esi,32 ; have we done all columns |
549 | cmp esi,32 ; have we done all columns |
Line 576... | Line 576... | ||
576 | shl ebx,16 ; and move into top eight bytes [x start] |
576 | shl ebx,16 ; and move into top eight bytes [x start] |
577 | add ebx,7 ; add box width [x size] |
577 | add ebx,7 ; add box width [x size] |
578 | mov edx,[eax] ; point to bmp data |
578 | mov edx,[eax] ; point to bmp data |
579 | push eax ; save our position |
579 | push eax ; save our position |
580 | mov eax,13 ; function 13 : draw bar |
580 | mov eax,13 ; function 13 : draw bar |
581 | int 0x40 ; do it |
581 | mcall ; do it |
582 | pop eax ; restore our position |
582 | pop eax ; restore our position |
583 | sub eax,3 ; point to next pixel colour |
583 | sub eax,3 ; point to next pixel colour |
584 | dec esi ; increment column count |
584 | dec esi ; increment column count |
585 | cmp esi,0 ; have we done all columns |
585 | cmp esi,0 ; have we done all columns |
586 | jne next_bo ; no then do the next column |
586 | jne next_bo ; no then do the next column |
Line 672... | Line 672... | ||
672 | ; ********************************************* |
672 | ; ********************************************* |
673 | draw_mouse: |
673 | draw_mouse: |
Line 674... | Line 674... | ||
674 | 674 | ||
675 | mov eax,37 ; function 37 |
675 | mov eax,37 ; function 37 |
676 | mov ebx,2 ; sub function 2 : check for mouse button |
676 | mov ebx,2 ; sub function 2 : check for mouse button |
677 | int 0x40 ; do it |
677 | mcall ; do it |
678 | cmp eax,0 ; was a button pressed |
678 | cmp eax,0 ; was a button pressed |
679 | je exit_mouse ; no then jump to exit |
679 | je exit_mouse ; no then jump to exit |
680 | cmp eax,1 ; left hand button |
680 | cmp eax,1 ; left hand button |
681 | je colour_mouse ; we are using selected colour |
681 | je colour_mouse ; we are using selected colour |
Line 685... | Line 685... | ||
685 | mov eax,[sel_colour] ; get our selected colour |
685 | mov eax,[sel_colour] ; get our selected colour |
686 | mov [draw_colour],eax ; save our selected colour |
686 | mov [draw_colour],eax ; save our selected colour |
687 | blank: |
687 | blank: |
688 | mov eax,37 ; function 37 |
688 | mov eax,37 ; function 37 |
689 | mov ebx,1 ; sub function 1 : get mouse position |
689 | mov ebx,1 ; sub function 1 : get mouse position |
690 | int 0x40 ; do it |
690 | mcall ; do it |
691 | push eax ; save our x/y position for later |
691 | push eax ; save our x/y position for later |
692 | and eax,0x0000ffff ; y is in lower bytes |
692 | and eax,0x0000ffff ; y is in lower bytes |
693 | add eax,1 ; add 1 because we are zero based |
693 | add eax,1 ; add 1 because we are zero based |
694 | mov [my_pos],eax ; save y position |
694 | mov [my_pos],eax ; save y position |
695 | pop eax ; restore our x/y position |
695 | pop eax ; restore our x/y position |
Line 724... | Line 724... | ||
724 | add ebx,7 ; add box size |
724 | add ebx,7 ; add box size |
725 | mov ecx,[gy_pos] ; repeat for y |
725 | mov ecx,[gy_pos] ; repeat for y |
726 | shl ecx,16 ; |
726 | shl ecx,16 ; |
727 | add ecx,7 ; |
727 | add ecx,7 ; |
728 | mov edx,[draw_colour] ; give it a colour |
728 | mov edx,[draw_colour] ; give it a colour |
729 | int 0x40 ; do it |
729 | mcall ; do it |
730 | mov eax,1 ; function 1 : put pixel |
730 | mov eax,1 ; function 1 : put pixel |
731 | mov ebx,[icon_x] ; icon x from above |
731 | mov ebx,[icon_x] ; icon x from above |
732 | add ebx,269 ; add icon x offset |
732 | add ebx,269 ; add icon x offset |
733 | mov ecx,[icon_y] ; icon y from above |
733 | mov ecx,[icon_y] ; icon y from above |
734 | add ecx,27 ; add icon y offset |
734 | add ecx,27 ; add icon y offset |
735 | mov edx,[draw_colour] ; give it a colour |
735 | mov edx,[draw_colour] ; give it a colour |
736 | int 0x40 ; do it |
736 | mcall ; do it |
737 | mov ecx,image+54 ; point to our data |
737 | mov ecx,image+54 ; point to our data |
738 | mov ebx,31 ; 32 lines in image zero based |
738 | mov ebx,31 ; 32 lines in image zero based |
739 | sub ebx,[icon_y] ; get the correct line |
739 | sub ebx,[icon_y] ; get the correct line |
740 | mov eax,96 ; 96 or 3 bytes per colour * 32 columns |
740 | mov eax,96 ; 96 or 3 bytes per colour * 32 columns |
741 | mul ebx ; multiply by 96 result in eax |
741 | mul ebx ; multiply by 96 result in eax |
Line 758... | Line 758... | ||
758 | ; ********************************************* |
758 | ; ********************************************* |
759 | check_colour: |
759 | check_colour: |
Line 760... | Line 760... | ||
760 | 760 | ||
761 | mov eax,37 ; function 37 |
761 | mov eax,37 ; function 37 |
762 | mov ebx,2 ; sub function 2 : check for mouse button |
762 | mov ebx,2 ; sub function 2 : check for mouse button |
763 | int 0x40 ; do it |
763 | mcall ; do it |
764 | cmp eax,0 ; was a button pressed |
764 | cmp eax,0 ; was a button pressed |
765 | je exit_draw ; no then jump to exit |
765 | je exit_draw ; no then jump to exit |
766 | mov eax,37 ; function 37 |
766 | mov eax,37 ; function 37 |
767 | mov ebx,1 ; sub function 1 : get mouse position |
767 | mov ebx,1 ; sub function 1 : get mouse position |
768 | int 0x40 ; do it |
768 | mcall ; do it |
769 | push eax ; save our x/y position for later |
769 | push eax ; save our x/y position for later |
770 | and eax,0x0000ffff ; y is in lower bytes |
770 | and eax,0x0000ffff ; y is in lower bytes |
771 | add eax,1 ; add 1 because we are zero based |
771 | add eax,1 ; add 1 because we are zero based |
772 | mov [my_pos],eax ; save y position |
772 | mov [my_pos],eax ; save y position |
Line 796... | Line 796... | ||
796 | mov ecx,esi |
796 | mov ecx,esi |
797 | shr ecx,3 |
797 | shr ecx,3 |
798 | add ecx,211 |
798 | add ecx,211 |
799 | mov edx,[sel_colour] |
799 | mov edx,[sel_colour] |
800 | add edx,esi |
800 | add edx,esi |
801 | int 0x40 |
801 | mcall |
802 | add esi,5 |
802 | add esi,5 |
803 | cmp esi,255 |
803 | cmp esi,255 |
804 | jne next_sel_rg_inner |
804 | jne next_sel_rg_inner |
805 | add edi,5 |
805 | add edi,5 |
806 | cmp edi,255 |
806 | cmp edi,255 |
Line 833... | Line 833... | ||
833 | mov edx,[sel_colour] |
833 | mov edx,[sel_colour] |
834 | mov eax,esi |
834 | mov eax,esi |
835 | shl eax,8 |
835 | shl eax,8 |
836 | add edx,eax |
836 | add edx,eax |
837 | mov eax,1 |
837 | mov eax,1 |
838 | int 0x40 |
838 | mcall |
839 | add esi,5 |
839 | add esi,5 |
840 | cmp esi,255 |
840 | cmp esi,255 |
841 | jne next_sel_rb_inner |
841 | jne next_sel_rb_inner |
842 | add edi,5 |
842 | add edi,5 |
843 | cmp edi,255 |
843 | cmp edi,255 |
Line 870... | Line 870... | ||
870 | mov edx,[sel_colour] |
870 | mov edx,[sel_colour] |
871 | mov eax,esi |
871 | mov eax,esi |
872 | shl eax,16 |
872 | shl eax,16 |
873 | add edx,eax |
873 | add edx,eax |
874 | mov eax,1 |
874 | mov eax,1 |
875 | int 0x40 |
875 | mcall |
876 | add esi,5 |
876 | add esi,5 |
877 | cmp esi,255 |
877 | cmp esi,255 |
878 | jne next_sel_bg_inner |
878 | jne next_sel_bg_inner |
879 | add edi,5 |
879 | add edi,5 |
880 | cmp edi,255 |
880 | cmp edi,255 |
Line 895... | Line 895... | ||
895 | 895 | ||
896 | mov eax,13 |
896 | mov eax,13 |
897 | mov ebx,269*65536+71 |
897 | mov ebx,269*65536+71 |
898 | mov ecx,172*65536+32 |
898 | mov ecx,172*65536+32 |
899 | mov edx,[sel_colour] |
899 | mov edx,[sel_colour] |
Line 900... | Line 900... | ||
900 | int 0x40 |
900 | mcall |
901 | 901 | ||
Line 902... | Line 902... | ||
902 | mov eax,[sel_colour] |
902 | mov eax,[sel_colour] |
Line 908... | Line 908... | ||
908 | shl ebx,16 |
908 | shl ebx,16 |
909 | mov bh,1 |
909 | mov bh,1 |
910 | mov ecx,[sel_colour] |
910 | mov ecx,[sel_colour] |
911 | mov edx,273*65536+176 |
911 | mov edx,273*65536+176 |
912 | mov esi,0x000000 |
912 | mov esi,0x000000 |
913 | int 0x40 |
913 | mcall |
Line 914... | Line 914... | ||
914 | 914 | ||
Line 915... | Line 915... | ||
915 | exit_draw: |
915 | exit_draw: |
Line 922... | Line 922... | ||
922 | 922 | ||
Line 923... | Line 923... | ||
923 | decode_mouse: |
923 | decode_mouse: |
924 | 924 | ||
925 | mov eax,37 |
925 | mov eax,37 |
926 | xor ebx,ebx |
926 | xor ebx,ebx |
927 | int 0x40 |
927 | mcall |
928 | mov ebx,eax |
928 | mov ebx,eax |
929 | mov ecx,eax |
929 | mov ecx,eax |
930 | and ebx,0xffff0000 |
930 | and ebx,0xffff0000 |
931 | shr ebx,16 |
931 | shr ebx,16 |
932 | and ecx,0x0000ffff |
932 | and ecx,0x0000ffff |
933 | mov eax,[x_size] |
933 | mov eax,[x_size] |
934 | imul ecx,eax |
934 | imul ecx,eax |
935 | add ebx,ecx |
935 | add ebx,ecx |
936 | mov eax,35 |
936 | mov eax,35 |
Line 937... | Line 937... | ||
937 | dec ebx |
937 | dec ebx |
Line 938... | Line 938... | ||
938 | int 0x40 |
938 | mcall |
Line 967... | Line 967... | ||
967 | button_text_7 db 'FLIP VERT ' |
967 | button_text_7 db 'FLIP VERT ' |
968 | button_text_8 db 'FLIP HORIZ' |
968 | button_text_8 db 'FLIP HORIZ' |
969 | button_text_9 db 'FLIP DIAG ' |
969 | button_text_9 db 'FLIP DIAG ' |
970 | button_text_10 db 'SET AS BGR' |
970 | button_text_10 db 'SET AS BGR' |
Line 971... | Line 971... | ||
971 | 971 | ||
Line 972... | Line 972... | ||
972 | labelt: db 'ICON EDITOR' |
972 | title db 'ICON EDITOR',0 |
Line 973... | Line 973... | ||
973 | 973 | ||
974 | icon: db 'WRITE.BMP ' |
974 | icon: db 'WRITE.BMP ' |