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