Rev 102 | Rev 120 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 102 | Rev 119 | ||
---|---|---|---|
Line 33... | Line 33... | ||
33 | ; pop esi |
33 | ; pop esi |
34 | ; ret |
34 | ; ret |
35 | ;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 |
35 | ;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 |
Line 36... | Line 36... | ||
36 | 36 | ||
37 | draw_mouse_under: |
- | |
38 | 37 | draw_mouse_under: |
|
39 | ; return old picture |
- | |
40 | 38 | ; return old picture |
|
41 | pushad |
- | |
42 | 39 | pushad |
|
43 | xor ecx,ecx |
40 | xor ecx,ecx |
44 | xor edx,edx |
- | |
45 | - | ||
46 | ;cli ; !!!**** |
41 | xor edx,edx |
47 | align 4 |
42 | align 4 |
48 | mres: |
- | |
49 | 43 | mres: |
|
50 | movzx eax,word [0xfb4a] |
44 | movzx eax,word [0xfb4a] |
51 | movzx ebx,word [0xfb4c] |
- | |
52 | 45 | movzx ebx,word [0xfb4c] |
|
53 | add eax,ecx |
46 | add eax,ecx |
54 | add ebx,edx |
- | |
55 | 47 | add ebx,edx |
|
56 | push ecx |
48 | push ecx |
57 | push edx |
49 | push edx |
58 | push eax |
50 | push eax |
59 | push ebx |
- | |
60 | 51 | push ebx |
|
61 | mov eax,edx |
52 | mov eax,edx |
62 | shl eax,6 |
53 | shl eax,6 |
63 | shl ecx,2 |
54 | shl ecx,2 |
64 | add eax,ecx |
55 | add eax,ecx |
65 | add eax,mouseunder |
56 | add eax,mouseunder |
66 | mov ecx,[eax] |
- | |
67 | 57 | mov ecx,[eax] |
|
68 | pop ebx |
58 | pop ebx |
69 | pop eax |
- | |
70 | - | ||
71 | ;;;push edi |
59 | pop eax |
72 | mov edi, 1 ;force |
60 | mov edi, 1 ;force |
73 | call [putpixel] |
- | |
74 | ;;;pop edi |
- | |
75 | 61 | call [putpixel] |
|
76 | pop edx |
62 | pop edx |
77 | pop ecx |
- | |
78 | 63 | pop ecx |
|
79 | inc ecx |
64 | inc ecx |
80 | cmp ecx, 16 |
65 | cmp ecx, 16 |
81 | jnz mres |
66 | jnz mres |
82 | xor ecx, ecx |
67 | xor ecx, ecx |
83 | inc edx |
68 | inc edx |
84 | cmp edx, 24 |
69 | cmp edx, 24 |
85 | jnz mres |
- | |
86 | ;sti ; !!!**** |
- | |
87 | 70 | jnz mres |
|
88 | popad |
- | |
89 | 71 | popad |
|
Line 90... | Line 72... | ||
90 | ret |
72 | ret |
91 | 73 | ||
92 | save_draw_mouse: |
74 | save_draw_mouse: |
93 | pushad |
- | |
94 | ; save & draw |
75 | pushad |
95 | 76 | ; save & draw |
|
96 | mov [0xfb4a],ax |
77 | mov [0xfb4a],ax |
97 | mov [0xfb4c],bx |
78 | mov [0xfb4c],bx |
98 | push eax |
79 | push eax |
99 | push ebx |
80 | push ebx |
100 | mov ecx,0 |
- | |
101 | mov edx,0 |
- | |
102 | 81 | mov ecx,0 |
|
103 | ;cli ; !!!**** |
82 | mov edx,0 |
104 | align 4 |
- | |
105 | drm: |
83 | align 4 |
106 | 84 | drm: |
|
107 | push eax |
85 | push eax |
108 | push ebx |
86 | push ebx |
109 | push ecx |
- | |
110 | push edx |
87 | push ecx |
111 | 88 | push edx |
|
112 | ; helloworld |
- | |
113 | push ecx |
89 | ; helloworld |
114 | ; push eax ebx ecx |
90 | push ecx |
115 | add eax,ecx ; save picture under mouse |
91 | add eax,ecx ; save picture under mouse |
116 | add ebx,edx |
92 | add ebx,edx |
117 | push ecx |
93 | push ecx |
Line 123... | Line 99... | ||
123 | shl ecx,2 |
99 | shl ecx,2 |
124 | add eax,ecx |
100 | add eax,ecx |
125 | add eax,mouseunder |
101 | add eax,mouseunder |
126 | mov ebx,[0xfb30] |
102 | mov ebx,[0xfb30] |
127 | mov [eax],ebx |
103 | mov [eax],ebx |
128 | ; pop ecx ebx eax |
- | |
129 | pop ecx |
104 | pop ecx |
130 | - | ||
131 | mov edi,edx ; y cycle |
105 | mov edi,edx ; y cycle |
132 | shl edi,4 ; *16 bytes per row |
106 | shl edi,4 ; *16 bytes per row |
133 | add edi,ecx ; x cycle |
107 | add edi,ecx ; x cycle |
134 | mov esi, edi |
108 | mov esi, edi |
135 | add edi, esi |
109 | add edi, esi |
Line 140... | Line 114... | ||
140 | push ecx |
114 | push ecx |
141 | mov ecx, [0xfb30] |
115 | mov ecx, [0xfb30] |
142 | call combine_colors |
116 | call combine_colors |
143 | mov [0xfb10], ecx |
117 | mov [0xfb10], ecx |
144 | pop ecx |
118 | pop ecx |
145 | - | ||
146 | - | ||
147 | pop edx |
119 | pop edx |
148 | pop ecx |
120 | pop ecx |
149 | pop ebx |
121 | pop ebx |
150 | pop eax |
122 | pop eax |
151 | - | ||
152 | add eax,ecx ; we have x coord+cycle |
123 | add eax,ecx ; we have x coord+cycle |
153 | add ebx,edx ; and y coord+cycle |
124 | add ebx,edx ; and y coord+cycle |
154 | - | ||
155 | ; push ecx edi |
- | |
156 | push ecx |
125 | push ecx |
157 | mov ecx, [0xfb10] |
126 | mov ecx, [0xfb10] |
158 | mov edi, 1 |
127 | mov edi, 1 |
159 | call [putpixel] |
128 | call [putpixel] |
160 | pop ecx |
129 | pop ecx |
161 | ; pop edi ecx |
- | |
162 | - | ||
163 | ; mnext: |
- | |
164 | - | ||
165 | mov ebx,[esp+0] ; pure y coord again |
130 | mov ebx,[esp+0] ; pure y coord again |
166 | mov eax,[esp+4] ; and x |
131 | mov eax,[esp+4] ; and x |
167 | - | ||
168 | inc ecx ; +1 cycle |
132 | inc ecx ; +1 cycle |
169 | cmp ecx,16 ; if more than 16 |
133 | cmp ecx,16 ; if more than 16 |
170 | jnz drm |
134 | jnz drm |
171 | xor ecx, ecx |
135 | xor ecx, ecx |
172 | inc edx |
136 | inc edx |
173 | cmp edx,24 |
137 | cmp edx,24 |
174 | jnz drm |
138 | jnz drm |
175 | - | ||
176 | pop ebx |
- | |
177 | pop eax |
139 | add esp,8 |
178 | - | ||
179 | ;sti ; !!!**** |
- | |
180 | popad |
140 | popad |
181 | ret |
141 | ret |
Line 182... | Line 142... | ||
182 | 142 | ||
183 | - | ||
184 | combine_colors: |
143 | |
185 | 144 | combine_colors: |
|
186 | ; in |
145 | ; in |
187 | ; ecx - color ( 00 RR GG BB ) |
146 | ; ecx - color ( 00 RR GG BB ) |
188 | ; edi - ref to new color byte |
147 | ; edi - ref to new color byte |
189 | ; esi - ref to alpha byte |
148 | ; esi - ref to alpha byte |
190 | ; |
149 | ; |
191 | ; out |
- | |
192 | ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) |
150 | ; out |
193 | 151 | ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) |
|
194 | push eax |
152 | push eax |
195 | push ebx |
153 | push ebx |
196 | push edx |
154 | push edx |
Line 203... | Line 161... | ||
203 | shr ebx, 16 |
161 | shr ebx, 16 |
204 | and ebx, 0xff |
162 | and ebx, 0xff |
205 | mul ebx |
163 | mul ebx |
206 | shr eax, 8 |
164 | shr eax, 8 |
207 | add ecx, eax |
165 | add ecx, eax |
208 | ; xor eax, eax |
166 | xor eax, eax |
209 | ; xor ebx, ebx |
167 | xor ebx, ebx |
210 | ; mov al, [edi+0] |
168 | mov al, [edi+0] |
211 | ; mov bl, [esi+0] |
169 | mov bl, [esi+0] |
212 | movzx eax, byte [edi+0] |
- | |
213 | movzx ebx, byte [esi+0] |
- | |
214 | mul ebx |
170 | mul ebx |
215 | shr eax, 8 |
171 | shr eax, 8 |
216 | add ecx, eax |
172 | add ecx, eax |
217 | shl ecx, 8 |
173 | shl ecx, 8 |
218 | ; byte 1 |
174 | ; byte 1 |
Line 222... | Line 178... | ||
222 | shr ebx, 8 |
178 | shr ebx, 8 |
223 | and ebx, 0xff |
179 | and ebx, 0xff |
224 | mul ebx |
180 | mul ebx |
225 | shr eax, 8 |
181 | shr eax, 8 |
226 | add ecx, eax |
182 | add ecx, eax |
227 | ; xor eax, eax |
183 | xor eax, eax |
228 | ; xor ebx, ebx |
184 | xor ebx, ebx |
229 | ; mov al, [edi+1] |
185 | mov al, [edi+1] |
230 | ; mov bl, [esi+1] |
186 | mov bl, [esi+1] |
231 | movzx eax, byte [edi+1] |
- | |
232 | movzx ebx, byte [esi+1] |
- | |
233 | mul ebx |
187 | mul ebx |
234 | shr eax, 8 |
188 | shr eax, 8 |
235 | add ecx, eax |
189 | add ecx, eax |
236 | shl ecx, 8 |
190 | shl ecx, 8 |
237 | ; byte 2 |
191 | ; byte 2 |
Line 240... | Line 194... | ||
240 | mov ebx, [esp] |
194 | mov ebx, [esp] |
241 | and ebx, 0xff |
195 | and ebx, 0xff |
242 | mul ebx |
196 | mul ebx |
243 | shr eax, 8 |
197 | shr eax, 8 |
244 | add ecx, eax |
198 | add ecx, eax |
245 | ; xor eax, eax |
199 | xor eax, eax |
246 | ; xor ebx, ebx |
200 | xor ebx, ebx |
247 | ; mov al, [edi+2] |
201 | mov al, [edi+2] |
248 | ; mov bl, [esi+2] |
202 | mov bl, [esi+2] |
249 | movzx eax, byte [edi+2] |
- | |
250 | movzx ebx, byte [esi+2] |
- | |
251 | mul ebx |
203 | mul ebx |
252 | shr eax, 8 |
204 | shr eax, 8 |
253 | add ecx, eax |
205 | add ecx, eax |
254 | - | ||
255 | pop eax |
206 | pop eax |
256 | pop edx |
207 | pop edx |
257 | pop ebx |
208 | pop ebx |
258 | pop eax |
209 | pop eax |
259 | ret |
210 | ret |
Line 260... | Line 211... | ||
260 | 211 | ||
261 | - | ||
262 | __sys_disable_mouse: |
- | |
263 | 212 | ||
264 | 213 | __sys_disable_mouse: |
|
265 | cmp dword [0xf204],dword 0 |
214 | cmp dword [0xf204],dword 0 |
266 | je @f |
215 | je @f |
267 | ret |
- | |
268 | @@: |
216 | ret |
269 | ; cli |
- | |
270 | pushad |
217 | @@: |
271 | 218 | pushad |
|
272 | cmp [0x3000],dword 1 |
- | |
273 | je disable_m |
219 | cmp [0x3000],dword 1 |
274 | 220 | je disable_m |
|
275 | mov edx,[0x3000] |
221 | mov edx,[0x3000] |
276 | shl edx,5 |
- | |
277 | add edx,window_data |
222 | shl edx,5 |
278 | 223 | add edx,window_data |
|
279 | movzx eax, word [0xfb0a] |
- | |
280 | movzx ebx, word [0xfb0c] |
224 | movzx eax, word [0xfb0a] |
281 | 225 | movzx ebx, word [0xfb0c] |
|
282 | mov ecx,[0xfe00] |
226 | mov ecx,[0xfe00] |
283 | inc ecx |
227 | inc ecx |
284 | imul ecx,ebx |
228 | imul ecx,ebx |
285 | add ecx,eax |
- | |
286 | add ecx, display_data |
229 | add ecx,eax |
287 | - | ||
288 | mov eax, [0x3000] |
230 | add ecx, display_data |
289 | 231 | mov eax, [0x3000] |
|
290 | movzx ebx, byte [ecx] |
232 | movzx ebx, byte [ecx] |
291 | cmp eax,ebx |
233 | cmp eax,ebx |
292 | je yes_mouse_disable |
234 | je yes_mouse_disable |
293 | movzx ebx, byte [ecx+16] |
235 | movzx ebx, byte [ecx+16] |
294 | cmp eax,ebx |
- | |
295 | je yes_mouse_disable |
- | |
296 | - | ||
297 | ; mov ebx,[0xfe00] |
- | |
298 | ; inc ebx |
- | |
299 | ; imul ebx,10 |
- | |
300 | ; add ecx,ebx |
- | |
301 | ; movzx ebx, byte [ecx] |
- | |
302 | ; cmp eax,ebx |
- | |
303 | ; je yes_mouse_disable |
236 | cmp eax,ebx |
304 | 237 | je yes_mouse_disable |
|
305 | mov ebx,[0xfe00] |
238 | mov ebx,[0xfe00] |
306 | inc ebx |
239 | inc ebx |
307 | imul ebx,10 |
240 | imul ebx,10 |
308 | add ecx,ebx |
241 | add ecx,ebx |
309 | movzx ebx, byte [ecx] |
242 | movzx ebx, byte [ecx] |
310 | cmp eax,ebx |
- | |
311 | je yes_mouse_disable |
243 | cmp eax,ebx |
312 | 244 | je yes_mouse_disable |
|
313 | movzx ebx, byte [ecx+16] |
245 | movzx ebx, byte [ecx+16] |
314 | cmp eax,ebx |
- | |
315 | je yes_mouse_disable |
246 | cmp eax,ebx |
316 | - | ||
317 | jmp no_mouse_disable |
247 | je yes_mouse_disable |
318 | - | ||
319 | yes_mouse_disable: |
248 | jmp no_mouse_disable |
320 | 249 | yes_mouse_disable: |
|
321 | mov edx,[0x3000] |
250 | mov edx,[0x3000] |
322 | shl edx,5 |
- | |
323 | add edx,window_data |
251 | shl edx,5 |
324 | 252 | add edx,window_data |
|
325 | movzx eax, word [0xfb0a] |
- | |
326 | movzx ebx, word [0xfb0c] |
253 | movzx eax, word [0xfb0a] |
327 | 254 | movzx ebx, word [0xfb0c] |
|
328 | mov ecx,[edx+0] ; mouse inside the area ? |
255 | mov ecx,[edx+0] ; mouse inside the area ? |
329 | add eax,14 |
256 | add eax,14 |
330 | cmp eax,ecx |
257 | cmp eax,ecx |
331 | jb no_mouse_disable |
- | |
332 | sub eax,14 |
258 | jb no_mouse_disable |
333 | 259 | sub eax,14 |
|
334 | add ecx,[edx+8] |
260 | add ecx,[edx+8] |
335 | cmp eax,ecx |
- | |
336 | jg no_mouse_disable |
261 | cmp eax,ecx |
337 | 262 | jg no_mouse_disable |
|
338 | mov ecx,[edx+4] |
263 | mov ecx,[edx+4] |
339 | add ebx,20 |
264 | add ebx,20 |
340 | cmp ebx,ecx |
265 | cmp ebx,ecx |
341 | jb no_mouse_disable |
- | |
342 | sub ebx,20 |
266 | jb no_mouse_disable |
343 | 267 | sub ebx,20 |
|
344 | add ecx,[edx+12] |
268 | add ecx,[edx+12] |
345 | cmp ebx,ecx |
- | |
346 | jg no_mouse_disable |
269 | cmp ebx,ecx |
347 | 270 | jg no_mouse_disable |
|
348 | disable_m: |
271 | disable_m: |
349 | cmp dword [0xf204],dword 0 |
272 | cmp dword [0xf204],dword 0 |
350 | jne @f |
273 | jne no_mouse_disable |
351 | cli |
274 | cli |
352 | call draw_mouse_under |
- | |
353 | sti |
275 | call draw_mouse_under |
354 | ; @@: |
- | |
355 | mov [0xf204],dword 1 |
- | |
356 | ; inc dword [0xf204] |
- | |
357 | @@: |
276 | sti |
358 | - | ||
359 | no_mouse_disable: |
277 | mov [0xf204],dword 1 |
360 | - | ||
361 | popad |
278 | no_mouse_disable: |
Line 362... | Line 279... | ||
362 | ; sti |
279 | popad |
363 | ret |
- | |
364 | 280 | ret |
|
365 | __sys_draw_pointer: |
281 | |
366 | 282 | __sys_draw_pointer: |
|
367 | cmp [mouse_pause],0 |
283 | cmp [mouse_pause],0 |
368 | je @f |
284 | je @f |
Line 377... | Line 293... | ||
377 | ret |
293 | ret |
378 | @@: |
294 | @@: |
379 | mov eax,[timer_ticks] |
295 | mov eax,[timer_ticks] |
380 | mov [MouseTickCounter],eax |
296 | mov [MouseTickCounter],eax |
381 | pop eax |
297 | pop eax |
382 | ; cli |
- | |
383 | - | ||
384 | pushad |
298 | pushad |
385 | cmp dword [0xf204],dword 0 ; mouse visible ? |
299 | cmp dword [0xf204],dword 0 ; mouse visible ? |
386 | je chms00 |
300 | je chms00 |
387 | - | ||
388 | mov [0xf204], dword 0 |
301 | mov [0xf204], dword 0 |
389 | movzx ebx,word [0xfb0c] |
302 | movzx ebx,word [0xfb0c] |
390 | movzx eax,word [0xfb0a] |
303 | movzx eax,word [0xfb0a] |
391 | cli |
304 | cli |
392 | call save_draw_mouse |
305 | call save_draw_mouse |
393 | sti |
306 | sti |
394 | nodmu2: |
307 | nodmu2: |
395 | popad |
308 | popad |
396 | - | ||
397 | ret |
309 | ret |
398 | - | ||
399 | chms00: |
310 | chms00: |
400 | - | ||
401 | movzx ecx,word [0xfb4a] |
311 | movzx ecx,word [0xfb4a] |
402 | movzx edx,word [0xfb4c] |
312 | movzx edx,word [0xfb4c] |
403 | - | ||
404 | movzx ebx,word [0xfb0c] |
313 | movzx ebx,word [0xfb0c] |
405 | movzx eax,word [0xfb0a] |
314 | movzx eax,word [0xfb0a] |
406 | - | ||
407 | cmp eax,ecx |
315 | cmp eax,ecx |
408 | jne redrawmouse |
316 | jne redrawmouse |
409 | - | ||
410 | cmp ebx,edx |
317 | cmp ebx,edx |
411 | jne redrawmouse |
318 | jne redrawmouse |
412 | - | ||
413 | jmp nodmp |
319 | jmp nodmp |
414 | - | ||
415 | redrawmouse: |
320 | redrawmouse: |
416 | cli |
321 | cli |
417 | call draw_mouse_under |
322 | call draw_mouse_under |
418 | call save_draw_mouse |
323 | call save_draw_mouse |
419 | sti |
324 | sti |
420 | nodmp: |
325 | nodmp: |
421 | popad |
326 | popad |
422 | ; sti |
- | |
423 | ret |
327 | ret |
- | 328 |