Rev 485 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 485 | Rev 551 | ||
---|---|---|---|
1 | ; |
1 | ; |
2 | ; Modified from original icon editor |
2 | ; Modified from original icon editor |
3 | ; |
3 | ; |
4 | ; Compile with FASM for Menuet |
4 | ; Compile with FASM for Menuet |
5 | ; |
5 | ; |
6 | use32 |
6 | use32 |
7 | org 0x0 |
7 | org 0x0 |
8 | db 'MENUET01' ; 8 byte id |
8 | db 'MENUET01' ; 8 byte id |
9 | dd 0x01 ; header version |
9 | dd 0x01 ; header version |
10 | dd START ; start of code |
10 | dd START ; start of code |
11 | dd I_END ; size of image |
11 | dd I_END ; size of image |
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 |
15 | 15 | ||
16 | include 'lang.inc' |
16 | include 'lang.inc' |
17 | include '..\..\..\macros.inc' |
17 | include '..\..\..\macros.inc' |
18 | 18 | ||
19 | window_x_size equ 346 |
19 | window_x_size equ 346 |
20 | window_y_size equ 312 |
20 | window_y_size equ 312 |
21 | 21 | ||
22 | START: ; start of execution |
22 | START: ; start of execution |
23 | 23 | ||
24 | call draw_window ; at first, draw the window |
24 | call draw_window ; at first, draw the window |
25 | call get_screen_size ; get screen x and y size |
25 | call get_screen_size ; get screen x and y size |
26 | 26 | ||
27 | check_mouse: |
27 | check_mouse: |
28 | 28 | ||
29 | call draw_mouse ; are we editing the icon |
29 | call draw_mouse ; are we editing the icon |
30 | call check_colour ; are we selecting a colour |
30 | call check_colour ; are we selecting a colour |
31 | 31 | ||
32 | still: |
32 | still: |
33 | 33 | ||
34 | mov eax,23 ; wait here for event |
34 | mov eax,23 ; wait here for event |
35 | mov ebx,1 ; for 1ms |
35 | mov ebx,1 ; for 1ms |
36 | mcall |
36 | mcall |
37 | 37 | ||
38 | cmp eax,1 ; redraw request ? |
38 | cmp eax,1 ; redraw request ? |
39 | je red |
39 | je red |
40 | cmp eax,2 ; key in buffer ? |
40 | cmp eax,2 ; key in buffer ? |
41 | je key |
41 | je key |
42 | cmp eax,3 ; button in buffer ? |
42 | cmp eax,3 ; button in buffer ? |
43 | je button |
43 | je button |
44 | 44 | ||
45 | jmp check_mouse ; start loop again |
45 | jmp check_mouse ; start loop again |
46 | 46 | ||
47 | red: ; redraw |
47 | red: ; redraw |
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: |
51 | 51 | ||
52 | mov eax,2 ; get a key |
52 | mov eax,2 ; get a key |
53 | mcall ; 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 |
58 | jne no_bksp ; if no jump over backspace code |
58 | jne no_bksp ; if no jump over backspace code |
59 | cmp byte [editpos],0 ; is it the first character |
59 | cmp byte [editpos],0 ; is it the first character |
60 | je no_del_last ; if yes jump over backspace code |
60 | je no_del_last ; if yes jump over backspace code |
61 | dec byte [editpos] ; decrement our position |
61 | dec byte [editpos] ; decrement our position |
62 | xor ebx,ebx ; clear pointer |
62 | xor ebx,ebx ; clear pointer |
63 | mov bl,byte [editpos] ; get our position |
63 | mov bl,byte [editpos] ; get our position |
64 | add ebx,icon ; add our offset |
64 | add ebx,icon ; add our offset |
65 | mov byte [ebx],0 ; delete character |
65 | mov byte [ebx],0 ; delete character |
66 | no_del_last: |
66 | no_del_last: |
67 | call draw_filename ; update filename |
67 | call draw_filename ; update filename |
68 | jmp check_mouse ; start loop again |
68 | jmp check_mouse ; start loop again |
69 | no_bksp: |
69 | no_bksp: |
70 | cmp al,13 ; is it the enter key |
70 | cmp al,13 ; is it the enter key |
71 | jne no_enter ; no then jump over enter code |
71 | jne no_enter ; no then jump over enter code |
72 | mov byte [editstate],0 ; get out of edit mode |
72 | mov byte [editstate],0 ; get out of edit mode |
73 | call draw_filename ; update filename |
73 | call draw_filename ; update filename |
74 | jmp check_mouse ; start loop again |
74 | jmp check_mouse ; start loop again |
75 | no_enter: |
75 | no_enter: |
76 | cmp al,31 ; are we below character 31 |
76 | cmp al,31 ; are we below character 31 |
77 | jbe no_lit ; then must be illegal |
77 | jbe no_lit ; then must be illegal |
78 | cmp al,97 ; are we below character 97 |
78 | cmp al,97 ; are we below character 97 |
79 | jb capital ; then must be ok |
79 | jb capital ; then must be ok |
80 | sub eax,32 ; else subtract 32 from it to make it legal |
80 | sub eax,32 ; else subtract 32 from it to make it legal |
81 | capital: |
81 | capital: |
82 | xor ebx,ebx ; clear our pointer |
82 | xor ebx,ebx ; clear our pointer |
83 | mov bl,byte [editpos] ; get our position |
83 | mov bl,byte [editpos] ; get our position |
84 | add ebx,icon ; add our offset |
84 | add ebx,icon ; add our offset |
85 | mov byte [ebx],al ; move our character into buffer |
85 | mov byte [ebx],al ; move our character into buffer |
86 | inc byte [editpos] ; increment our edit position |
86 | inc byte [editpos] ; increment our edit position |
87 | cmp byte [editpos],12 ; are we at our last position |
87 | cmp byte [editpos],12 ; are we at our last position |
88 | jne no_null_state ; no then jump over last position code |
88 | jne no_null_state ; no then jump over last position code |
89 | mov byte [editstate],0 ; get out of edit mode |
89 | mov byte [editstate],0 ; get out of edit mode |
90 | no_null_state: |
90 | no_null_state: |
91 | call draw_filename ; update filename |
91 | call draw_filename ; update filename |
92 | no_lit: |
92 | no_lit: |
93 | jmp check_mouse ; start loop again |
93 | jmp check_mouse ; start loop again |
94 | 94 | ||
95 | button: ; button |
95 | button: ; button |
96 | mov eax,17 ; get id |
96 | mov eax,17 ; get id |
97 | mcall |
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 | mcall |
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 |
106 | cld ; |
106 | cld ; |
107 | mov byte [editstate],1 ; enter edit mode |
107 | mov byte [editstate],1 ; enter edit mode |
108 | mov edi,icon ; point to our buffer |
108 | mov edi,icon ; point to our buffer |
109 | mov eax,0x20202020 ; file reg with 4 spaces |
109 | mov eax,0x20202020 ; file reg with 4 spaces |
110 | mov ecx,3 ; going to write it 3 times |
110 | mov ecx,3 ; going to write it 3 times |
111 | rep stosd ; repeat giving 12 spaces |
111 | rep stosd ; repeat giving 12 spaces |
112 | mov byte [editpos],0 ; zero our edit position |
112 | mov byte [editpos],0 ; zero our edit position |
113 | call draw_filename ; update filename |
113 | call draw_filename ; update filename |
114 | jmp check_mouse ; start loop again |
114 | jmp check_mouse ; start loop again |
115 | button_4: |
115 | button_4: |
116 | cmp ah,4 ; was it button 4 - LOAD |
116 | cmp ah,4 ; was it button 4 - LOAD |
117 | jne button_5 ; no then try button 5 |
117 | jne button_5 ; no then try button 5 |
118 | mov byte [editstate],0 ; dont want to be in edit mode |
118 | mov byte [editstate],0 ; dont want to be in edit mode |
119 | call draw_filename ; update filename |
119 | call draw_filename ; update filename |
120 | call load_file ; load the file |
120 | call load_file ; load the file |
121 | call draw_icon ; update icon screen |
121 | call draw_icon ; update icon screen |
122 | call draw_graph ; update edit screen |
122 | call draw_graph ; update edit screen |
123 | jmp check_mouse ; start loop again |
123 | jmp check_mouse ; start loop again |
124 | button_5: |
124 | button_5: |
125 | cmp ah,5 ; was it button 5 - SAVE |
125 | cmp ah,5 ; was it button 5 - SAVE |
126 | jne button_6 ; no then try button 6 |
126 | jne button_6 ; no then try button 6 |
127 | mov byte [editstate],0 ; dont want to be in edit mode |
127 | mov byte [editstate],0 ; dont want to be in edit mode |
128 | call draw_filename ; update filename |
128 | call draw_filename ; update filename |
129 | call save_file ; save the file |
129 | call save_file ; save the file |
130 | jmp check_mouse ; start loop again |
130 | jmp check_mouse ; start loop again |
131 | button_6: |
131 | button_6: |
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 |
137 | jmp check_mouse |
138 | 138 | ||
139 | button_7: |
139 | button_7: |
140 | cmp ah,7 ; was it button 7 - FLIP ICON |
140 | cmp ah,7 ; was it button 7 - FLIP ICON |
141 | jne button_8 ; no then try button 8 |
141 | jne button_8 ; no then try button 8 |
142 | call flip_icon ; flip |
142 | call flip_icon ; flip |
143 | jmp check_mouse |
143 | jmp check_mouse |
144 | 144 | ||
145 | button_8: |
145 | button_8: |
146 | cmp ah,8 ; was it button 8 - MIRROR ICON |
146 | cmp ah,8 ; was it button 8 - MIRROR ICON |
147 | jne button_9 ; no then try button 9 |
147 | jne button_9 ; no then try button 9 |
148 | call flip_diag ; flip L/R and U/D |
148 | call flip_diag ; flip L/R and U/D |
149 | call flip_icon ; cheated now have to flip it |
149 | call flip_icon ; cheated now have to flip it |
150 | jmp check_mouse |
150 | jmp check_mouse |
151 | 151 | ||
152 | button_9: |
152 | button_9: |
153 | 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 |
154 | jne button_10 ; no then try button 10 |
154 | jne button_10 ; no then try button 10 |
155 | call flip_diag ; flip L/R and U/D |
155 | call flip_diag ; flip L/R and U/D |
156 | call draw_icon ; update icon |
156 | call draw_icon ; update icon |
157 | call draw_graph ; update graph |
157 | call draw_graph ; update graph |
158 | jmp check_mouse |
158 | jmp check_mouse |
159 | 159 | ||
160 | button_10: |
160 | button_10: |
161 | cmp ah,10 ; was it button 9 - SET AS BGR |
161 | cmp ah,10 ; was it button 9 - SET AS BGR |
162 | jne check_mouse ; no then exit |
162 | jne check_mouse ; no then exit |
163 | call set_background ; set as background |
163 | call set_background ; set as background |
164 | 164 | ||
165 | jmp check_mouse ; start loop again |
165 | jmp check_mouse ; start loop again |
166 | 166 | ||
167 | ; ********************************************* |
167 | ; ********************************************* |
168 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
168 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
169 | ; ********************************************* |
169 | ; ********************************************* |
170 | draw_window: |
170 | draw_window: |
171 | 171 | ||
172 | mov eax,12 ; function 12:tell os about windowdraw |
172 | mov eax,12 ; function 12:tell os about windowdraw |
173 | mov ebx,1 ; 1, start of draw |
173 | mov ebx,1 ; 1, start of draw |
174 | mcall |
174 | mcall |
175 | ; DRAW WINDOW |
175 | ; DRAW WINDOW |
176 | mov eax,0 ; function 0 : define and draw window |
176 | mov eax,0 ; function 0 : define and draw window |
177 | 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] |
178 | 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] |
179 | mov edx,0x13ffffff ; color of work area 0x00RRGGBB |
179 | mov edx,0x14ffffff ; color of work area 0x00RRGGBB |
180 | mov edi,title ; WINDOW LABEL |
180 | mov edi,title ; WINDOW LABEL |
181 | mcall |
181 | mcall |
182 | 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 | mcall |
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 | mcall |
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 |
201 | mcall |
201 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 | mcall |
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 |
306 | next_r_g_outer: |
306 | next_r_g_outer: |
307 | xor esi,esi ; clear line loop count |
307 | xor esi,esi ; clear line loop count |
308 | next_r_g_inner: |
308 | next_r_g_inner: |
309 | mov eax,1 ; function 1 : putpixel |
309 | mov eax,1 ; function 1 : putpixel |
310 | mov ebx,edi ; get column count |
310 | mov ebx,edi ; get column count |
311 | shr ebx,3 ; divide by 8 |
311 | shr ebx,3 ; divide by 8 |
312 | add ebx,269 ; add our x offset |
312 | add ebx,269 ; add our x offset |
313 | mov ecx,esi ; get our line count |
313 | mov ecx,esi ; get our line count |
314 | shr ecx,3 ; divide by 8 |
314 | shr ecx,3 ; divide by 8 |
315 | add ecx,218 ; add our y offset |
315 | add ecx,218 ; add our y offset |
316 | mov edx,255 ; maximum red |
316 | mov edx,255 ; maximum red |
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 | mcall |
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 |
328 | jne next_r_g_outer ; no then start the next one |
328 | jne next_r_g_outer ; no then start the next one |
329 | 329 | ||
330 | ; DRAW PALETTE GREEN + BLUE SECTION |
330 | ; DRAW PALETTE GREEN + BLUE SECTION |
331 | mov edi,0 ; as above |
331 | mov edi,0 ; as above |
332 | next_g_b_outer: |
332 | next_g_b_outer: |
333 | mov esi,0 |
333 | mov esi,0 |
334 | next_g_b_inner: |
334 | next_g_b_inner: |
335 | mov eax,1 |
335 | mov eax,1 |
336 | mov ebx,edi |
336 | mov ebx,edi |
337 | shr ebx,3 |
337 | shr ebx,3 |
338 | add ebx,269 |
338 | add ebx,269 |
339 | mov ecx,esi |
339 | mov ecx,esi |
340 | shr ecx,3 |
340 | shr ecx,3 |
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 | mcall |
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 |
352 | jne next_g_b_outer |
352 | jne next_g_b_outer |
353 | 353 | ||
354 | ; DRAW PALETTE BLUE + RED SECTION |
354 | ; DRAW PALETTE BLUE + RED SECTION |
355 | mov edi,0 ; as above |
355 | mov edi,0 ; as above |
356 | next_b_r_outer: |
356 | next_b_r_outer: |
357 | mov esi,0 |
357 | mov esi,0 |
358 | next_b_r_inner: |
358 | next_b_r_inner: |
359 | mov eax,1 |
359 | mov eax,1 |
360 | mov ebx,edi |
360 | mov ebx,edi |
361 | shr ebx,3 |
361 | shr ebx,3 |
362 | add ebx,301 |
362 | add ebx,301 |
363 | mov ecx,esi |
363 | mov ecx,esi |
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 | mcall |
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 |
375 | jne next_b_r_outer |
375 | jne next_b_r_outer |
376 | 376 | ||
377 | ; DRAW GREYSCALE |
377 | ; DRAW GREYSCALE |
378 | mov edi,0 |
378 | mov edi,0 |
379 | next_b_w_outer: |
379 | next_b_w_outer: |
380 | mov esi,0 |
380 | mov esi,0 |
381 | next_b_w_inner: |
381 | next_b_w_inner: |
382 | mov eax,1 |
382 | mov eax,1 |
383 | mov ebx,edi |
383 | mov ebx,edi |
384 | shr ebx,3 |
384 | shr ebx,3 |
385 | add ebx,308 |
385 | add ebx,308 |
386 | mov ecx,esi |
386 | mov ecx,esi |
387 | shr ecx,3 |
387 | shr ecx,3 |
388 | add ecx,211 |
388 | add ecx,211 |
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 | mcall |
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 |
400 | jne next_b_w_outer |
400 | jne next_b_w_outer |
401 | 401 | ||
402 | cmp [first_run],0 ; is it the first window draw |
402 | cmp [first_run],0 ; is it the first window draw |
403 | jne dont_load ; no then dont reload the file |
403 | jne dont_load ; no then dont reload the file |
404 | call load_file ; load initial file |
404 | call load_file ; load initial file |
405 | mov [first_run],1 ; first window draw done |
405 | mov [first_run],1 ; first window draw done |
406 | dont_load: |
406 | dont_load: |
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 |
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 |
412 | mcall |
412 | mcall |
413 | 413 | ||
414 | ret ; return |
414 | ret ; return |
415 | 415 | ||
416 | ; ********************************************* |
416 | ; ********************************************* |
417 | ; ******* SET BACKGROUND ******** |
417 | ; ******* SET BACKGROUND ******** |
418 | ; ********************************************* |
418 | ; ********************************************* |
419 | set_background: |
419 | set_background: |
420 | 420 | ||
421 | mov ecx,image+3600 ; point to our decode buffer |
421 | mov ecx,image+3600 ; point to our decode buffer |
422 | mov edx,image+54+32*32*3-96 ; point to last line of bmp |
422 | mov edx,image+54+32*32*3-96 ; point to last line of bmp |
423 | 423 | ||
424 | mov edi,0 ; zero line count |
424 | mov edi,0 ; zero line count |
425 | decode_line: |
425 | decode_line: |
426 | mov esi,0 ; zero column count |
426 | mov esi,0 ; zero column count |
427 | decode_column: |
427 | decode_column: |
428 | mov ebx,[edx] ; get our data |
428 | mov ebx,[edx] ; get our data |
429 | mov [ecx],ebx ; store our data |
429 | mov [ecx],ebx ; store our data |
430 | add ecx,4 ; add 4 bytes to pointer as using double word |
430 | add ecx,4 ; add 4 bytes to pointer as using double word |
431 | add edx,4 ; add 4 bytes to pointer |
431 | add edx,4 ; add 4 bytes to pointer |
432 | inc esi ; increment column count |
432 | inc esi ; increment column count |
433 | cmp esi,24 ; have we done all columns |
433 | cmp esi,24 ; have we done all columns |
434 | jne decode_column ; no then do some more |
434 | jne decode_column ; no then do some more |
435 | sub edx,192 ; move back 2 lines of bmp data |
435 | sub edx,192 ; move back 2 lines of bmp data |
436 | inc edi ; increment line count |
436 | inc edi ; increment line count |
437 | cmp edi,33 ; have we done all lines |
437 | cmp edi,33 ; have we done all lines |
438 | jne decode_line ; no then do another one |
438 | jne decode_line ; no then do another one |
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 |
444 | mcall ; do it |
445 | mov ebx,4 ; type of background draw |
445 | mov ebx,4 ; type of background draw |
446 | mov ecx,1 ; tile |
446 | mov ecx,1 ; tile |
447 | mcall ; do it |
447 | mcall ; do it |
448 | mov ebx,5 ; blockmove image to os bgr memory |
448 | mov ebx,5 ; blockmove image to os bgr memory |
449 | mov ecx,image+3600 ; point to image |
449 | mov ecx,image+3600 ; point to image |
450 | mov edx,0 ; start of bgr memory |
450 | mov edx,0 ; start of bgr memory |
451 | mov esi,32*32*3 ; byte count |
451 | mov esi,32*32*3 ; byte count |
452 | mcall ; do it |
452 | mcall ; do it |
453 | mov ebx,3 ; draw background |
453 | mov ebx,3 ; draw background |
454 | mcall ; do it |
454 | mcall ; do it |
455 | 455 | ||
456 | ret ; return |
456 | ret ; return |
457 | 457 | ||
458 | ; ********************************************* |
458 | ; ********************************************* |
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 | mcall ; returns eax : 0xXXXXYYYY |
464 | mcall ; returns eax : 0xXXXXYYYY |
465 | push eax ; save reg |
465 | push eax ; save reg |
466 | and eax,0x0000ffff ; split out y size |
466 | and eax,0x0000ffff ; split out y size |
467 | add eax,1 ; add 1 to remove zero base |
467 | add eax,1 ; add 1 to remove zero base |
468 | mov [y_size],eax ; store for later |
468 | mov [y_size],eax ; store for later |
469 | pop eax ; restore reg |
469 | pop eax ; restore reg |
470 | shr eax,16 ; move x size down the reg |
470 | shr eax,16 ; move x size down the reg |
471 | add eax,1 ; add 1 to remove zero base |
471 | add eax,1 ; add 1 to remove zero base |
472 | mov [x_size],eax ; store for later |
472 | mov [x_size],eax ; store for later |
473 | 473 | ||
474 | ret |
474 | ret |
475 | 475 | ||
476 | ; ********************************************* |
476 | ; ********************************************* |
477 | ; ******* LOAD FILE ******** |
477 | ; ******* LOAD FILE ******** |
478 | ; ********************************************* |
478 | ; ********************************************* |
479 | load_file: |
479 | load_file: |
480 | 480 | ||
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 | mcall ; do it |
486 | mcall ; do it |
487 | 487 | ||
488 | ret ; return |
488 | ret ; return |
489 | 489 | ||
490 | ; ********************************************* |
490 | ; ********************************************* |
491 | ; ******* SAVE FILE ******** |
491 | ; ******* SAVE FILE ******** |
492 | ; ********************************************* |
492 | ; ********************************************* |
493 | save_file: |
493 | save_file: |
494 | 494 | ||
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 | mcall ; do it |
500 | mcall ; do it |
501 | 501 | ||
502 | ret ; return |
502 | ret ; return |
503 | 503 | ||
504 | ; ********************************************* |
504 | ; ********************************************* |
505 | ; ******* DRAW FILENAME TO SCREEN ******** |
505 | ; ******* DRAW FILENAME TO SCREEN ******** |
506 | ; ********************************************* |
506 | ; ********************************************* |
507 | draw_filename: |
507 | draw_filename: |
508 | ; DRAW COLOUR BACKGROUND |
508 | ; DRAW COLOUR BACKGROUND |
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 | mcall |
514 | mcall |
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 | mcall ; do it |
525 | mcall ; do it |
526 | popa ; return all registers to original |
526 | popa ; return all registers to original |
527 | ret ; return |
527 | ret ; return |
528 | 528 | ||
529 | ; ********************************************* |
529 | ; ********************************************* |
530 | ; ******* DRAW ICON FROM LOADED FILE ******** |
530 | ; ******* DRAW ICON FROM LOADED FILE ******** |
531 | ; ********************************************* |
531 | ; ********************************************* |
532 | draw_icon: |
532 | draw_icon: |
533 | 533 | ||
534 | mov ecx,27 ; y start position |
534 | mov ecx,27 ; y start position |
535 | mov eax,image+51+32*32*3 ; point to our bmp data |
535 | mov eax,image+51+32*32*3 ; point to our bmp data |
536 | mov edi,0 ; line count |
536 | mov edi,0 ; line count |
537 | line: |
537 | line: |
538 | mov esi,0 ; column count |
538 | mov esi,0 ; column count |
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 | mcall ; 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 |
550 | jne pixel ; no then do next pixel |
550 | jne pixel ; no then do next pixel |
551 | inc ecx ; move our y position |
551 | inc ecx ; move our y position |
552 | inc edi ; increment line count |
552 | inc edi ; increment line count |
553 | cmp edi,32 ; have we done all lines |
553 | cmp edi,32 ; have we done all lines |
554 | jne line ; no then do next line |
554 | jne line ; no then do next line |
555 | 555 | ||
556 | ret ; return |
556 | ret ; return |
557 | 557 | ||
558 | ; ********************************************* |
558 | ; ********************************************* |
559 | ; ******* DRAW GRAPH FROM LOADED FILE ******* |
559 | ; ******* DRAW GRAPH FROM LOADED FILE ******* |
560 | ; ********************************************* |
560 | ; ********************************************* |
561 | draw_graph: |
561 | draw_graph: |
562 | 562 | ||
563 | mov edi,0 ; line count |
563 | mov edi,0 ; line count |
564 | mov eax,image+51+32*32*3 ; point to our bmp data |
564 | mov eax,image+51+32*32*3 ; point to our bmp data |
565 | next_lin: |
565 | next_lin: |
566 | mov ecx,edi ; use our line count for position |
566 | mov ecx,edi ; use our line count for position |
567 | shl ecx,3 ; multiply by eight |
567 | shl ecx,3 ; multiply by eight |
568 | add ecx,27 ; add y start position |
568 | add ecx,27 ; add y start position |
569 | shl ecx,16 ; move into top eight bytes [y start] |
569 | shl ecx,16 ; move into top eight bytes [y start] |
570 | add ecx,7 ; add box height [y size] |
570 | add ecx,7 ; add box height [y size] |
571 | mov esi,32 ; column count |
571 | mov esi,32 ; column count |
572 | next_bo: |
572 | next_bo: |
573 | mov ebx,esi ; use our column count for position |
573 | mov ebx,esi ; use our column count for position |
574 | shl ebx,3 ; multiply by eight |
574 | shl ebx,3 ; multiply by eight |
575 | add ebx,-1 ; add a correction |
575 | add ebx,-1 ; add a correction |
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 | mcall ; 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 |
587 | inc edi ; increment line count |
587 | inc edi ; increment line count |
588 | cmp edi,32 ; have we done all lines |
588 | cmp edi,32 ; have we done all lines |
589 | jne next_lin ; no then do the next line |
589 | jne next_lin ; no then do the next line |
590 | 590 | ||
591 | ret ; return |
591 | ret ; return |
592 | 592 | ||
593 | ; ********************************************* |
593 | ; ********************************************* |
594 | ; ******* CLEAR GRAPH and ICON AREA ******** |
594 | ; ******* CLEAR GRAPH and ICON AREA ******** |
595 | ; ********************************************* |
595 | ; ********************************************* |
596 | clear_graph_icon: |
596 | clear_graph_icon: |
597 | 597 | ||
598 | ; CLEAR IMAGE DATA |
598 | ; CLEAR IMAGE DATA |
599 | mov edi,image+54 ; point to our data |
599 | mov edi,image+54 ; point to our data |
600 | mov eax,0x00000000 ; data to write |
600 | mov eax,0x00000000 ; data to write |
601 | mov ecx,(32*32*3)/4 ; how much data |
601 | mov ecx,(32*32*3)/4 ; how much data |
602 | rep stosd ; repeat until all data transfered |
602 | rep stosd ; repeat until all data transfered |
603 | call draw_icon ; draw a blank icon |
603 | call draw_icon ; draw a blank icon |
604 | call draw_graph ; draw a blank graph |
604 | call draw_graph ; draw a blank graph |
605 | 605 | ||
606 | ret ; return |
606 | ret ; return |
607 | 607 | ||
608 | ; ********************************************* |
608 | ; ********************************************* |
609 | ; ******* FLIP ICON TOP to BOTTOM ******** |
609 | ; ******* FLIP ICON TOP to BOTTOM ******** |
610 | ; ********************************************* |
610 | ; ********************************************* |
611 | flip_icon: |
611 | flip_icon: |
612 | 612 | ||
613 | mov ecx,image+54 ; point at first line |
613 | mov ecx,image+54 ; point at first line |
614 | mov edx,image+54+32*32*3+96 ; point 1 line past end |
614 | mov edx,image+54+32*32*3+96 ; point 1 line past end |
615 | 615 | ||
616 | mov edi,0 ; zero line count |
616 | mov edi,0 ; zero line count |
617 | lines: |
617 | lines: |
618 | mov esi,0 ; zero column count |
618 | mov esi,0 ; zero column count |
619 | sub edx,192 ; move back 2 lines |
619 | sub edx,192 ; move back 2 lines |
620 | columns: |
620 | columns: |
621 | mov eax,[ecx] ; get bytes |
621 | mov eax,[ecx] ; get bytes |
622 | mov ebx,[edx] ; get bytes |
622 | mov ebx,[edx] ; get bytes |
623 | mov [ecx],ebx ; swap bytes |
623 | mov [ecx],ebx ; swap bytes |
624 | mov [edx],eax ; swap bytes |
624 | mov [edx],eax ; swap bytes |
625 | add ecx,4 ; move pointer |
625 | add ecx,4 ; move pointer |
626 | add edx,4 ; move pointer |
626 | add edx,4 ; move pointer |
627 | inc esi ; increment column count |
627 | inc esi ; increment column count |
628 | cmp esi,24 ; have we done all columns |
628 | cmp esi,24 ; have we done all columns |
629 | jne columns ; no then do next column |
629 | jne columns ; no then do next column |
630 | inc edi ; increment line count |
630 | inc edi ; increment line count |
631 | cmp edi,16 ; have we done all lines |
631 | cmp edi,16 ; have we done all lines |
632 | jne lines ; no then do next line |
632 | jne lines ; no then do next line |
633 | call draw_icon ; update icon |
633 | call draw_icon ; update icon |
634 | call draw_graph ; update graph |
634 | call draw_graph ; update graph |
635 | 635 | ||
636 | ret ; return |
636 | ret ; return |
637 | 637 | ||
638 | ; ********************************************* |
638 | ; ********************************************* |
639 | ; ******* FLIP ICON DIAGONAL ******** |
639 | ; ******* FLIP ICON DIAGONAL ******** |
640 | ; ********************************************* |
640 | ; ********************************************* |
641 | flip_diag: |
641 | flip_diag: |
642 | 642 | ||
643 | mov ecx,image+54 ; point line 1 first bytes |
643 | mov ecx,image+54 ; point line 1 first bytes |
644 | mov edx,image+3600 ; point to buffer |
644 | mov edx,image+3600 ; point to buffer |
645 | xor esi,esi ; zero byte count |
645 | xor esi,esi ; zero byte count |
646 | 646 | ||
647 | pusha ; save all registers |
647 | pusha ; save all registers |
648 | copy_out: |
648 | copy_out: |
649 | mov eax,[ecx] ; get bytes |
649 | mov eax,[ecx] ; get bytes |
650 | mov [edx],eax ; copy bytes |
650 | mov [edx],eax ; copy bytes |
651 | add ecx,4 ; move pointer |
651 | add ecx,4 ; move pointer |
652 | add edx,4 ; move pointer |
652 | add edx,4 ; move pointer |
653 | inc esi ; increment byte count |
653 | inc esi ; increment byte count |
654 | cmp esi,24*32 ; have we done all bytes |
654 | cmp esi,24*32 ; have we done all bytes |
655 | jne copy_out ; no then do the next |
655 | jne copy_out ; no then do the next |
656 | popa ; restore all registers |
656 | popa ; restore all registers |
657 | 657 | ||
658 | mov edx,image+3600+32*32*3-3 ; point to last bytes |
658 | mov edx,image+3600+32*32*3-3 ; point to last bytes |
659 | copy_in: |
659 | copy_in: |
660 | mov eax,[edx] ; get bytes |
660 | mov eax,[edx] ; get bytes |
661 | mov [ecx],eax ; copy to image first bytes |
661 | mov [ecx],eax ; copy to image first bytes |
662 | add ecx,3 ; move pointer 3 bytes |
662 | add ecx,3 ; move pointer 3 bytes |
663 | sub edx,3 ; move pointer 3 bytes |
663 | sub edx,3 ; move pointer 3 bytes |
664 | inc esi ; increment byte count |
664 | inc esi ; increment byte count |
665 | cmp esi,32*32 ; have we done all bytes |
665 | cmp esi,32*32 ; have we done all bytes |
666 | jne copy_in ; no then do next |
666 | jne copy_in ; no then do next |
667 | 667 | ||
668 | ret ; return |
668 | ret ; return |
669 | 669 | ||
670 | ; ********************************************* |
670 | ; ********************************************* |
671 | ; ******* DRAW MOUSE ON GRAPH / ICON ******** |
671 | ; ******* DRAW MOUSE ON GRAPH / ICON ******** |
672 | ; ********************************************* |
672 | ; ********************************************* |
673 | draw_mouse: |
673 | draw_mouse: |
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 | mcall ; 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 |
682 | mov [draw_colour],0x000000 ; else draw with black |
682 | mov [draw_colour],0x000000 ; else draw with black |
683 | jmp blank ; jmp over colour select |
683 | jmp blank ; jmp over colour select |
684 | colour_mouse: |
684 | colour_mouse: |
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 | mcall ; 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 |
696 | shr eax,16 ; shift x into lower bytes |
696 | shr eax,16 ; shift x into lower bytes |
697 | add eax,1 ; add 1 because we are zero based |
697 | add eax,1 ; add 1 because we are zero based |
698 | mov [mx_pos],eax ; save x position |
698 | mov [mx_pos],eax ; save x position |
699 | cmp [mx_pos],7 ; check we are within x/y limits |
699 | cmp [mx_pos],7 ; check we are within x/y limits |
700 | jle exit_mouse |
700 | jle exit_mouse |
701 | cmp [mx_pos],263 |
701 | cmp [mx_pos],263 |
702 | jge exit_mouse |
702 | jge exit_mouse |
703 | cmp [my_pos],27 |
703 | cmp [my_pos],27 |
704 | jle exit_mouse |
704 | jle exit_mouse |
705 | cmp [my_pos],283 |
705 | cmp [my_pos],283 |
706 | jge exit_mouse |
706 | jge exit_mouse |
707 | mov eax,[mx_pos] ; calculate nearest square and save |
707 | mov eax,[mx_pos] ; calculate nearest square and save |
708 | sub eax,7 ; subtract 7 graph zero offset |
708 | sub eax,7 ; subtract 7 graph zero offset |
709 | shr eax,3 ; divide by 8 (box size) loose remainder |
709 | shr eax,3 ; divide by 8 (box size) loose remainder |
710 | mov [icon_x],eax ; save for use later in icon |
710 | mov [icon_x],eax ; save for use later in icon |
711 | shl eax,3 ; multiply by 8 to get box position |
711 | shl eax,3 ; multiply by 8 to get box position |
712 | add eax,7 ; add 7 graph zero offset |
712 | add eax,7 ; add 7 graph zero offset |
713 | mov [gx_pos],eax ; save graph x position |
713 | mov [gx_pos],eax ; save graph x position |
714 | mov eax,[my_pos] ; repeat for y |
714 | mov eax,[my_pos] ; repeat for y |
715 | sub eax,27 ; |
715 | sub eax,27 ; |
716 | shr eax,3 ; |
716 | shr eax,3 ; |
717 | mov [icon_y],eax ; |
717 | mov [icon_y],eax ; |
718 | shl eax,3 ; |
718 | shl eax,3 ; |
719 | add eax,27 ; |
719 | add eax,27 ; |
720 | mov [gy_pos],eax ; |
720 | mov [gy_pos],eax ; |
721 | mov eax,13 ; function 13 : draw bar |
721 | mov eax,13 ; function 13 : draw bar |
722 | mov ebx,[gx_pos] ; load graph x position |
722 | mov ebx,[gx_pos] ; load graph x position |
723 | shl ebx,16 ; shift into high bytes |
723 | shl ebx,16 ; shift into high bytes |
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 | mcall ; 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 | mcall ; 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 |
742 | add ecx,eax ; add to our position |
742 | add ecx,eax ; add to our position |
743 | mov ebx,[icon_x] ; get the correct column |
743 | mov ebx,[icon_x] ; get the correct column |
744 | mov eax,3 ; 3 bytes per colour |
744 | mov eax,3 ; 3 bytes per colour |
745 | mul ebx ; multiply by 3 result in eax |
745 | mul ebx ; multiply by 3 result in eax |
746 | add ecx,eax ; add to our position |
746 | add ecx,eax ; add to our position |
747 | mov ebx,[draw_colour] ; get our colour |
747 | mov ebx,[draw_colour] ; get our colour |
748 | mov [ecx],bl ; move blue into image data |
748 | mov [ecx],bl ; move blue into image data |
749 | mov [ecx+1],bh ; move green into image data |
749 | mov [ecx+1],bh ; move green into image data |
750 | shr ebx,16 ; shift red down |
750 | shr ebx,16 ; shift red down |
751 | mov [ecx+2],bl ; move red into image data |
751 | mov [ecx+2],bl ; move red into image data |
752 | exit_mouse: |
752 | exit_mouse: |
753 | 753 | ||
754 | ret ; return |
754 | ret ; return |
755 | 755 | ||
756 | ; ********************************************* |
756 | ; ********************************************* |
757 | ; ******* GET COLOUR TO DRAW WITH ******** |
757 | ; ******* GET COLOUR TO DRAW WITH ******** |
758 | ; ********************************************* |
758 | ; ********************************************* |
759 | check_colour: |
759 | check_colour: |
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 | mcall ; 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 | mcall ; 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 |
773 | pop eax ; restore our x/y position |
773 | pop eax ; restore our x/y position |
774 | shr eax,16 ; shift x into lower bytes |
774 | shr eax,16 ; shift x into lower bytes |
775 | add eax,1 ; add 1 because we are zero based |
775 | add eax,1 ; add 1 because we are zero based |
776 | mov [mx_pos],eax ; save x position |
776 | mov [mx_pos],eax ; save x position |
777 | cmp [mx_pos],270 ; check we are within x/y limits |
777 | cmp [mx_pos],270 ; check we are within x/y limits |
778 | jl check_rb |
778 | jl check_rb |
779 | cmp [mx_pos],301 |
779 | cmp [mx_pos],301 |
780 | jg check_rb |
780 | jg check_rb |
781 | cmp [my_pos],219 |
781 | cmp [my_pos],219 |
782 | jl check_rb |
782 | jl check_rb |
783 | cmp [my_pos],250 |
783 | cmp [my_pos],250 |
784 | jg check_rb |
784 | jg check_rb |
785 | 785 | ||
786 | call decode_mouse |
786 | call decode_mouse |
787 | 787 | ||
788 | mov edi,0 |
788 | mov edi,0 |
789 | next_sel_rg_outer: |
789 | next_sel_rg_outer: |
790 | mov esi,0 |
790 | mov esi,0 |
791 | next_sel_rg_inner: |
791 | next_sel_rg_inner: |
792 | mov eax,1 |
792 | mov eax,1 |
793 | mov ebx,edi |
793 | mov ebx,edi |
794 | shr ebx,3 |
794 | shr ebx,3 |
795 | add ebx,308 |
795 | add ebx,308 |
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 | mcall |
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 |
807 | jne next_sel_rg_outer |
807 | jne next_sel_rg_outer |
808 | 808 | ||
809 | 809 | ||
810 | check_rb: |
810 | check_rb: |
811 | 811 | ||
812 | cmp [mx_pos],270 ; check we are within x/y limits |
812 | cmp [mx_pos],270 ; check we are within x/y limits |
813 | jl check_bg |
813 | jl check_bg |
814 | cmp [mx_pos],301 |
814 | cmp [mx_pos],301 |
815 | jg check_bg |
815 | jg check_bg |
816 | cmp [my_pos],251 |
816 | cmp [my_pos],251 |
817 | jle check_bg |
817 | jle check_bg |
818 | cmp [my_pos],282 |
818 | cmp [my_pos],282 |
819 | jg check_bg |
819 | jg check_bg |
820 | 820 | ||
821 | call decode_mouse |
821 | call decode_mouse |
822 | 822 | ||
823 | mov edi,0 |
823 | mov edi,0 |
824 | next_sel_rb_outer: |
824 | next_sel_rb_outer: |
825 | mov esi,0 |
825 | mov esi,0 |
826 | next_sel_rb_inner: |
826 | next_sel_rb_inner: |
827 | mov ebx,edi |
827 | mov ebx,edi |
828 | shr ebx,3 |
828 | shr ebx,3 |
829 | add ebx,308 |
829 | add ebx,308 |
830 | mov ecx,esi |
830 | mov ecx,esi |
831 | shr ecx,3 |
831 | shr ecx,3 |
832 | add ecx,211 |
832 | add ecx,211 |
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 | mcall |
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 |
844 | jne next_sel_rb_outer |
844 | jne next_sel_rb_outer |
845 | 845 | ||
846 | 846 | ||
847 | check_bg: |
847 | check_bg: |
848 | 848 | ||
849 | cmp [mx_pos],301 ; check we are within x/y limits |
849 | cmp [mx_pos],301 ; check we are within x/y limits |
850 | jl get_colour |
850 | jl get_colour |
851 | cmp [mx_pos],333 |
851 | cmp [mx_pos],333 |
852 | jg get_colour |
852 | jg get_colour |
853 | cmp [my_pos],251 |
853 | cmp [my_pos],251 |
854 | jl get_colour |
854 | jl get_colour |
855 | cmp [my_pos],282 |
855 | cmp [my_pos],282 |
856 | jg get_colour |
856 | jg get_colour |
857 | 857 | ||
858 | call decode_mouse |
858 | call decode_mouse |
859 | 859 | ||
860 | mov edi,0 |
860 | mov edi,0 |
861 | next_sel_bg_outer: |
861 | next_sel_bg_outer: |
862 | mov esi,0 |
862 | mov esi,0 |
863 | next_sel_bg_inner: |
863 | next_sel_bg_inner: |
864 | mov ebx,edi |
864 | mov ebx,edi |
865 | shr ebx,3 |
865 | shr ebx,3 |
866 | add ebx,308 |
866 | add ebx,308 |
867 | mov ecx,esi |
867 | mov ecx,esi |
868 | shr ecx,3 |
868 | shr ecx,3 |
869 | add ecx,211 |
869 | add ecx,211 |
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 | mcall |
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 |
881 | jne next_sel_bg_outer |
881 | jne next_sel_bg_outer |
882 | 882 | ||
883 | get_colour: |
883 | get_colour: |
884 | 884 | ||
885 | cmp [mx_pos],309 ; check we are within x/y limits |
885 | cmp [mx_pos],309 ; check we are within x/y limits |
886 | jl exit_draw |
886 | jl exit_draw |
887 | cmp [mx_pos],340 |
887 | cmp [mx_pos],340 |
888 | jg exit_draw |
888 | jg exit_draw |
889 | cmp [my_pos],212 |
889 | cmp [my_pos],212 |
890 | jl exit_draw |
890 | jl exit_draw |
891 | cmp [my_pos],243 |
891 | cmp [my_pos],243 |
892 | jg exit_draw |
892 | jg exit_draw |
893 | 893 | ||
894 | call decode_mouse |
894 | call decode_mouse |
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] |
900 | mcall |
900 | mcall |
901 | 901 | ||
902 | mov eax,[sel_colour] |
902 | mov eax,[sel_colour] |
903 | mov [draw_colour],eax |
903 | mov [draw_colour],eax |
904 | 904 | ||
905 | mov eax,47 |
905 | mov eax,47 |
906 | xor ebx,ebx |
906 | xor ebx,ebx |
907 | mov ebx,6 |
907 | mov ebx,6 |
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 | mcall |
913 | mcall |
914 | 914 | ||
915 | exit_draw: |
915 | exit_draw: |
916 | 916 | ||
917 | ret |
917 | ret |
918 | 918 | ||
919 | ; ********************************************* |
919 | ; ********************************************* |
920 | ; ******* DECODE MOUSE POSITION GET PIX ***** |
920 | ; ******* DECODE MOUSE POSITION GET PIX ***** |
921 | ; ********************************************* |
921 | ; ********************************************* |
922 | 922 | ||
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 | mcall |
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 |
937 | dec ebx |
937 | dec ebx |
938 | mcall |
938 | mcall |
939 | 939 | ||
940 | mov [sel_colour],eax |
940 | mov [sel_colour],eax |
941 | 941 | ||
942 | ret |
942 | ret |
943 | 943 | ||
944 | ; ********************************************* |
944 | ; ********************************************* |
945 | ; ******* DATA AREA ***** |
945 | ; ******* DATA AREA ***** |
946 | ; ********************************************* |
946 | ; ********************************************* |
947 | 947 | ||
948 | mx_pos dd 0x0 |
948 | mx_pos dd 0x0 |
949 | my_pos dd 0x0 |
949 | my_pos dd 0x0 |
950 | 950 | ||
951 | gx_pos dd 0x0 |
951 | gx_pos dd 0x0 |
952 | gy_pos dd 0x0 |
952 | gy_pos dd 0x0 |
953 | 953 | ||
954 | icon_x dd 0x0 |
954 | icon_x dd 0x0 |
955 | icon_y dd 0x0 |
955 | icon_y dd 0x0 |
956 | 956 | ||
957 | x_size dd 0x0 |
957 | x_size dd 0x0 |
958 | y_size dd 0x0 |
958 | y_size dd 0x0 |
959 | 959 | ||
960 | sel_colour dd 0x00ffffff |
960 | sel_colour dd 0x00ffffff |
961 | draw_colour dd 0x00ffffff |
961 | draw_colour dd 0x00ffffff |
962 | 962 | ||
963 | button_text_3 db 'FILENAME' |
963 | button_text_3 db 'FILENAME' |
964 | button_text_4 db 'LOAD' |
964 | button_text_4 db 'LOAD' |
965 | button_text_5 db 'SAVE' |
965 | button_text_5 db 'SAVE' |
966 | button_text_6 db 'CLEAR ICON' |
966 | button_text_6 db 'CLEAR ICON' |
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' |
971 | 971 | ||
972 | title db 'ICON EDITOR',0 |
972 | title db 'ICON EDITOR',0 |
973 | 973 | ||
974 | icon: db 'WRITE.BMP ' |
974 | icon: db 'WRITE.BMP ' |
975 | 975 | ||
976 | editpos db 0 |
976 | editpos db 0 |
977 | editstate db 0 |
977 | editstate db 0 |
978 | 978 | ||
979 | first_run db 0 |
979 | first_run db 0 |
980 | 980 | ||
981 | image: |
981 | image: |
982 | 982 | ||
983 | I_END: |
983 | I_END: |