Rev 129 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 129 | Rev 384 | ||
---|---|---|---|
1 | ;----------------------------------------------------------------------------- |
1 | ;----------------------------------------------------------------------------- |
2 | func vm_mike_draw_rect.32 ;/////////////////////////////////////////////////// |
2 | func vm_mike_draw_rect.32 ;/////////////////////////////////////////////////// |
3 | ;----------------------------------------------------------------------------- |
3 | ;----------------------------------------------------------------------------- |
4 | ; eax - x start |
4 | ; eax - x start |
5 | ; ebx - y start |
5 | ; ebx - y start |
6 | ; ecx - x end |
6 | ; ecx - x end |
7 | ; edx - y end |
7 | ; edx - y end |
8 | ; edi - color |
8 | ; edi - color |
9 | ;----------------------------------------------------------------------------- |
9 | ;----------------------------------------------------------------------------- |
10 | ;- eax(ebx) [x start]*65536 + [x size] |
10 | ;- eax(ebx) [x start]*65536 + [x size] |
11 | ;- ebx(ecx) [y start]*65536 + [y size] |
11 | ;- ebx(ecx) [y start]*65536 + [y size] |
12 | ;- ecx(edx) color 0x00RRGGBB |
12 | ;- ecx(edx) color 0x00RRGGBB |
13 | ;----------------------------------------------------------------------------- |
13 | ;----------------------------------------------------------------------------- |
14 | begin |
14 | begin |
15 | pushad |
15 | pushad |
16 | cli |
16 | cli |
17 | jif eax,e,ecx,.exit |
17 | jif eax,e,ecx,.exit |
18 | jif ebx,e,edx,.exit |
18 | jif ebx,e,edx,.exit |
19 | 19 | ||
20 | call get_cursor_rect |
20 | call get_cursor_rect |
21 | 21 | ||
22 | mov ebp,[0x3010] |
22 | mov ebp,[TASK_BASE] |
23 | movsx esi,word[ebp-0x3000+0] |
23 | movsx esi,word[ebp-CURRENT_TASK+0] |
24 | add eax,esi |
24 | add eax,esi |
25 | add ecx,esi |
25 | add ecx,esi |
26 | movsx esi,word[ebp-0x3000+4] |
26 | movsx esi,word[ebp-CURRENT_TASK+4] |
27 | add ebx,esi |
27 | add ebx,esi |
28 | add edx,esi |
28 | add edx,esi |
29 | ; add eax,[ebp-0x3000+0] |
29 | ; add eax,[ebp-CURRENT_TASK+0] |
30 | ; add ebx,[ebp-0x3000+4] |
30 | ; add ebx,[ebp-CURRENT_TASK+4] |
31 | ; add ecx,[ebp-0x3000+0] |
31 | ; add ecx,[ebp-CURRENT_TASK+0] |
32 | ; add edx,[ebp-0x3000+4] |
32 | ; add edx,[ebp-CURRENT_TASK+4] |
33 | 33 | ||
34 | mov esi,[0x00003000] |
34 | mov esi,[CURRENT_TASK] |
35 | mov esi,[CLIP_RECTS+esi*4] |
35 | mov esi,[CLIP_RECTS+esi*4] |
36 | mov ebp,[esi] |
36 | mov ebp,[esi] |
37 | or ebp,ebp |
37 | or ebp,ebp |
38 | jz .exit |
38 | jz .exit |
39 | add esi,4 |
39 | add esi,4 |
40 | .nx: jif ecx,l,[rr.left],.skip |
40 | .nx: jif ecx,l,[rr.left],.skip |
41 | jif eax,ge,[rr.right],.skip |
41 | jif eax,ge,[rr.right],.skip |
42 | jif edx,l,[rr.top],.skip |
42 | jif edx,l,[rr.top],.skip |
43 | jif ebx,ge,[rr.bottom],.skip |
43 | jif ebx,ge,[rr.bottom],.skip |
44 | pushad |
44 | pushad |
45 | jif eax,ge,[rr.left],@f |
45 | jif eax,ge,[rr.left],@f |
46 | mov eax,[rr.left] |
46 | mov eax,[rr.left] |
47 | @@: jif ebx,ge,[rr.top],@f |
47 | @@: jif ebx,ge,[rr.top],@f |
48 | mov ebx,[rr.top] |
48 | mov ebx,[rr.top] |
49 | @@: jif ecx,l,[rr.right],@f |
49 | @@: jif ecx,l,[rr.right],@f |
50 | mov ecx,[rr.right] |
50 | mov ecx,[rr.right] |
51 | @@: jif edx,l,[rr.bottom],@f |
51 | @@: jif edx,l,[rr.bottom],@f |
52 | mov edx,[rr.bottom] |
52 | mov edx,[rr.bottom] |
53 | @@: call is_intersect_rc |
53 | @@: call is_intersect_rc |
54 | jc .put |
54 | jc .put |
55 | cmp [mouse_invisible],0 |
55 | cmp byte[MOUSE_VISIBLE],0 |
56 | jne .put |
56 | je .put |
57 | call [SF.draw_mouse_under] |
57 | call [SF.draw_mouse_under] |
58 | mov [mouse_invisible],1 |
58 | mov byte[MOUSE_VISIBLE],0 |
59 | .put: mov ebp,[bytes_per_scanline] |
59 | .put: mov ebp,[BytesPerScanLine] |
60 | imul ebp,ebx |
60 | imul ebp,ebx |
61 | lea ebp,[ebp+eax*4] |
61 | lea ebp,[ebp+eax*4] |
62 | add ebp,[lfb_address] |
62 | add ebp,[LFBAddress] |
63 | .xxx: push eax ebp |
63 | .xxx: push eax ebp |
64 | @@: push ebp |
64 | @@: push ebp |
65 | call [set_bank] |
65 | call [set_bank] |
66 | mov [ebp],edi |
66 | mov [ebp],edi |
67 | pop ebp |
67 | pop ebp |
68 | ; mov [ebp],edi |
68 | ; mov [ebp],edi |
69 | add ebp,4 |
69 | add ebp,4 |
70 | inc eax |
70 | inc eax |
71 | cmp eax,ecx |
71 | cmp eax,ecx |
72 | jl @b |
72 | jl @b |
73 | pop ebp eax |
73 | pop ebp eax |
74 | add ebp,[bytes_per_scanline] |
74 | add ebp,[BytesPerScanLine] |
75 | inc ebx |
75 | inc ebx |
76 | cmp ebx,edx |
76 | cmp ebx,edx |
77 | jl .xxx |
77 | jl .xxx |
78 | popad |
78 | popad |
79 | .skip: |
79 | .skip: |
80 | add esi,SR |
80 | add esi,SR |
81 | dec ebp |
81 | dec ebp |
82 | jnz .nx |
82 | jnz .nx |
83 | 83 | ||
84 | .exit: |
84 | .exit: |
85 | sti |
85 | sti |
86 | popad |
86 | popad |
87 | retn |
87 | retn |
88 | endf |
88 | endf |
89 | 89 | ||
90 | ;----------------------------------------------------------------------------- |
90 | ;----------------------------------------------------------------------------- |
91 | func vm_mike_draw_line.32 ;/////////////////////////////////////////////////// |
91 | func vm_mike_draw_line.32 ;/////////////////////////////////////////////////// |
92 | ;----------------------------------------------------------------------------- |
92 | ;----------------------------------------------------------------------------- |
93 | ; eax(ebx) [x start] shl 16 + [x end] |
93 | ; eax(ebx) [x start] shl 16 + [x end] |
94 | ; ebx(ecx) [y start] shl 16 + [y end] |
94 | ; ebx(ecx) [y start] shl 16 + [y end] |
95 | ; ecx(edx) colour 0x00RRGGBB |
95 | ; ecx(edx) colour 0x00RRGGBB |
96 | ; edi = 0x00000001 force |
96 | ; edi = 0x00000001 force |
97 | ;----------------------------------------------------------------------------- |
97 | ;----------------------------------------------------------------------------- |
98 | begin |
98 | begin |
99 | pushad |
99 | pushad |
100 | cli |
100 | cli |
101 | 101 | ||
102 | call get_cursor_rect |
102 | call get_cursor_rect |
103 | 103 | ||
104 | movsx eax,word[esp+4*7] ; x end |
104 | movsx eax,word[esp+4*7] ; x end |
105 | cmp ax,[esp+4*7+2] ; x start |
105 | cmp ax,[esp+4*7+2] ; x start |
106 | je dl.32.vert_line |
106 | je dl.32.vert_line |
107 | movsx eax,word[esp+4*4] ; y end |
107 | movsx eax,word[esp+4*4] ; y end |
108 | cmp ax,[esp+4*4+2] ; y start |
108 | cmp ax,[esp+4*4+2] ; y start |
109 | je dl.32.horz_line |
109 | je dl.32.horz_line |
110 | 110 | ||
111 | sti |
111 | sti |
112 | popad |
112 | popad |
113 | retn |
113 | retn |
114 | 114 | ||
115 | dl.32.vert_line: |
115 | dl.32.vert_line: |
116 | test edi,1 |
116 | test edi,1 |
117 | jnz .forced |
117 | jnz .forced |
118 | mov esi,[0x00003000] |
118 | mov esi,[CURRENT_TASK] |
119 | mov esi,[CLIP_RECTS+esi*4] |
119 | mov esi,[CLIP_RECTS+esi*4] |
120 | mov edi,[esi] |
120 | mov edi,[esi] |
121 | or edi,edi |
121 | or edi,edi |
122 | jz .exit |
122 | jz .exit |
123 | add esi,4 |
123 | add esi,4 |
124 | .nx: movsx ebx,word[esp+4*4+2] ; y start |
124 | .nx: movsx ebx,word[esp+4*4+2] ; y start |
125 | movsx edx,word[esp+4*4] ; y end |
125 | movsx edx,word[esp+4*4] ; y end |
126 | cmp ebx,edx |
126 | cmp ebx,edx |
127 | je .exit |
127 | je .exit |
128 | jl @f |
128 | jl @f |
129 | xchg ebx,edx |
129 | xchg ebx,edx |
130 | @@: jif eax,l,[rr.left],.skip |
130 | @@: jif eax,l,[rr.left],.skip |
131 | jif eax,ge,[rr.right],.skip |
131 | jif eax,ge,[rr.right],.skip |
132 | jif edx,l,[rr.top],.skip |
132 | jif edx,l,[rr.top],.skip |
133 | jif ebx,ge,[rr.bottom],.skip |
133 | jif ebx,ge,[rr.bottom],.skip |
134 | jif ebx,ge,[rr.top],@f |
134 | jif ebx,ge,[rr.top],@f |
135 | mov ebx,[rr.top] |
135 | mov ebx,[rr.top] |
136 | @@: jif edx,l,[rr.bottom],@f |
136 | @@: jif edx,l,[rr.bottom],@f |
137 | mov edx,[rr.bottom] |
137 | mov edx,[rr.bottom] |
138 | dec edx |
138 | dec edx |
139 | .draw: |
139 | .draw: |
140 | @@: call is_intersect_vln |
140 | @@: call is_intersect_vln |
141 | jc .put |
141 | jc .put |
142 | cmp [mouse_invisible],0 |
142 | cmp byte[MOUSE_VISIBLE],0 |
143 | jne .put |
143 | je .put |
144 | call [SF.draw_mouse_under] |
144 | call [SF.draw_mouse_under] |
145 | mov [mouse_invisible],1 |
145 | mov byte[MOUSE_VISIBLE],0 |
146 | .put: mov ebp,[bytes_per_scanline] |
146 | .put: mov ebp,[BytesPerScanLine] |
147 | imul ebp,ebx |
147 | imul ebp,ebx |
148 | lea ebp,[ebp+eax*4] |
148 | lea ebp,[ebp+eax*4] |
149 | add ebp,[lfb_address] |
149 | add ebp,[LFBAddress] |
150 | @@: push ebp |
150 | @@: push ebp |
151 | call [set_bank] |
151 | call [set_bank] |
152 | test ecx,0x01000000 |
152 | test ecx,0x01000000 |
153 | jz .dr |
153 | jz .dr |
154 | mov ecx,[ebp] |
154 | mov ecx,[ebp] |
155 | not ecx |
155 | not ecx |
156 | or ecx,0x01000000 |
156 | or ecx,0x01000000 |
157 | .dr: mov [ebp],ecx |
157 | .dr: mov [ebp],ecx |
158 | pop ebp |
158 | pop ebp |
159 | ; test ecx,0x01000000 |
159 | ; test ecx,0x01000000 |
160 | ; jz .dr |
160 | ; jz .dr |
161 | ; mov ecx,[ebp] |
161 | ; mov ecx,[ebp] |
162 | ; not ecx |
162 | ; not ecx |
163 | ; or ecx,0x01000000 |
163 | ; or ecx,0x01000000 |
164 | ; .dr: mov [ebp],ecx |
164 | ; .dr: mov [ebp],ecx |
165 | add ebp,[bytes_per_scanline] |
165 | add ebp,[BytesPerScanLine] |
166 | inc ebx |
166 | inc ebx |
167 | cmp ebx,edx |
167 | cmp ebx,edx |
168 | jle @b |
168 | jle @b |
169 | .skip: |
169 | .skip: |
170 | add esi,SR |
170 | add esi,SR |
171 | dec edi |
171 | dec edi |
172 | jnz .nx |
172 | jnz .nx |
173 | .exit: |
173 | .exit: |
174 | sti |
174 | sti |
175 | popad |
175 | popad |
176 | retn |
176 | retn |
177 | .forced: |
177 | .forced: |
178 | jif eax,l,[viewport.left],.exit |
178 | jif eax,l,[viewport.left],.exit |
179 | jif eax,ge,[viewport.right],.exit |
179 | jif eax,ge,[viewport.right],.exit |
180 | movsx ebx,word[esp+4*4+2] ; y start |
180 | movsx ebx,word[esp+4*4+2] ; y start |
181 | movsx edx,word[esp+4*4] ; y end |
181 | movsx edx,word[esp+4*4] ; y end |
182 | jif ebx,e,edx,.exit |
182 | jif ebx,e,edx,.exit |
183 | jl @f |
183 | jl @f |
184 | xchg ebx,edx |
184 | xchg ebx,edx |
185 | @@: jif edx,l,[viewport.top],.exit |
185 | @@: jif edx,l,[viewport.top],.exit |
186 | jif ebx,ge,[viewport.bottom],.exit |
186 | jif ebx,ge,[viewport.bottom],.exit |
187 | jif ebx,ge,[viewport.top],@f |
187 | jif ebx,ge,[viewport.top],@f |
188 | mov ebx,[viewport.top] |
188 | mov ebx,[viewport.top] |
189 | @@: jif edx,l,[viewport.bottom],@f |
189 | @@: jif edx,l,[viewport.bottom],@f |
190 | mov edx,[viewport.bottom] |
190 | mov edx,[viewport.bottom] |
191 | dec edx |
191 | dec edx |
192 | @@: mov edi,1 |
192 | @@: mov edi,1 |
193 | jmp .draw |
193 | jmp .draw |
194 | 194 | ||
195 | dl.32.horz_line: |
195 | dl.32.horz_line: |
196 | test edi,1 |
196 | test edi,1 |
197 | jnz .forced |
197 | jnz .forced |
198 | mov esi,[0x00003000] |
198 | mov esi,[CURRENT_TASK] |
199 | mov esi,[CLIP_RECTS+esi*4] |
199 | mov esi,[CLIP_RECTS+esi*4] |
200 | mov edi,[esi] |
200 | mov edi,[esi] |
201 | or edi,edi |
201 | or edi,edi |
202 | jz .exit |
202 | jz .exit |
203 | add esi,4 |
203 | add esi,4 |
204 | .nx: movsx ebx,word[esp+4*7+2] ; x start |
204 | .nx: movsx ebx,word[esp+4*7+2] ; x start |
205 | movsx edx,word[esp+4*7] ; x end |
205 | movsx edx,word[esp+4*7] ; x end |
206 | cmp ebx,edx |
206 | cmp ebx,edx |
207 | je .exit |
207 | je .exit |
208 | jl @f |
208 | jl @f |
209 | xchg ebx,edx |
209 | xchg ebx,edx |
210 | @@: jif eax,l,[rr.top],.skip |
210 | @@: jif eax,l,[rr.top],.skip |
211 | jif eax,ge,[rr.bottom],.skip |
211 | jif eax,ge,[rr.bottom],.skip |
212 | jif edx,l,[rr.left],.skip |
212 | jif edx,l,[rr.left],.skip |
213 | jif ebx,ge,[rr.right],.skip |
213 | jif ebx,ge,[rr.right],.skip |
214 | jif ebx,ge,[rr.left],@f |
214 | jif ebx,ge,[rr.left],@f |
215 | mov ebx,[rr.left] |
215 | mov ebx,[rr.left] |
216 | @@: jif edx,l,[rr.right],@f |
216 | @@: jif edx,l,[rr.right],@f |
217 | mov edx,[rr.right] |
217 | mov edx,[rr.right] |
218 | dec edx |
218 | dec edx |
219 | .draw: |
219 | .draw: |
220 | @@: call is_intersect_hln |
220 | @@: call is_intersect_hln |
221 | jc .put |
221 | jc .put |
222 | cmp [mouse_invisible],0 |
222 | cmp byte[MOUSE_VISIBLE],0 |
223 | jne .put |
223 | je .put |
224 | call [SF.draw_mouse_under] |
224 | call [SF.draw_mouse_under] |
225 | mov [mouse_invisible],1 |
225 | mov byte[MOUSE_VISIBLE],0 |
226 | .put: mov ebp,[bytes_per_scanline] |
226 | .put: mov ebp,[BytesPerScanLine] |
227 | imul ebp,eax |
227 | imul ebp,eax |
228 | lea ebp,[ebp+ebx*4] |
228 | lea ebp,[ebp+ebx*4] |
229 | add ebp,[lfb_address] |
229 | add ebp,[LFBAddress] |
230 | @@: push ebp |
230 | @@: push ebp |
231 | call [set_bank] |
231 | call [set_bank] |
232 | test ecx,0x01000000 |
232 | test ecx,0x01000000 |
233 | jz .dr |
233 | jz .dr |
234 | mov ecx,[ebp] |
234 | mov ecx,[ebp] |
235 | not ecx |
235 | not ecx |
236 | or ecx,0x01000000 |
236 | or ecx,0x01000000 |
237 | .dr: mov [ebp],ecx |
237 | .dr: mov [ebp],ecx |
238 | pop ebp |
238 | pop ebp |
239 | ; test ecx,0x01000000 |
239 | ; test ecx,0x01000000 |
240 | ; jz .dr |
240 | ; jz .dr |
241 | ; mov ecx,[ebp] |
241 | ; mov ecx,[ebp] |
242 | ; not ecx |
242 | ; not ecx |
243 | ; or ecx,0x01000000 |
243 | ; or ecx,0x01000000 |
244 | ; .dr: mov [ebp],ecx |
244 | ; .dr: mov [ebp],ecx |
245 | add ebp,4 |
245 | add ebp,4 |
246 | inc ebx |
246 | inc ebx |
247 | cmp ebx,edx |
247 | cmp ebx,edx |
248 | jle @b |
248 | jle @b |
249 | .skip: |
249 | .skip: |
250 | add esi,SR |
250 | add esi,SR |
251 | dec edi |
251 | dec edi |
252 | jnz .nx |
252 | jnz .nx |
253 | .exit: |
253 | .exit: |
254 | sti |
254 | sti |
255 | popad |
255 | popad |
256 | retn |
256 | retn |
257 | .forced: |
257 | .forced: |
258 | jif eax,l,[viewport.top],.exit |
258 | jif eax,l,[viewport.top],.exit |
259 | jif eax,ge,[viewport.bottom],.exit |
259 | jif eax,ge,[viewport.bottom],.exit |
260 | movsx ebx,word[esp+4*7+2] ; x start |
260 | movsx ebx,word[esp+4*7+2] ; x start |
261 | movsx edx,word[esp+4*7] ; x end |
261 | movsx edx,word[esp+4*7] ; x end |
262 | cmp ebx,edx |
262 | cmp ebx,edx |
263 | je .exit |
263 | je .exit |
264 | jl @f |
264 | jl @f |
265 | xchg ebx,edx |
265 | xchg ebx,edx |
266 | @@: jif edx,l,[viewport.left],.exit |
266 | @@: jif edx,l,[viewport.left],.exit |
267 | jif ebx,ge,[viewport.right],.exit |
267 | jif ebx,ge,[viewport.right],.exit |
268 | jif ebx,ge,[viewport.left],@f |
268 | jif ebx,ge,[viewport.left],@f |
269 | mov ebx,[viewport.left] |
269 | mov ebx,[viewport.left] |
270 | @@: jif edx,l,[viewport.right],@f |
270 | @@: jif edx,l,[viewport.right],@f |
271 | mov edx,[viewport.right] |
271 | mov edx,[viewport.right] |
272 | dec edx |
272 | dec edx |
273 | @@: mov edi,1 |
273 | @@: mov edi,1 |
274 | jmp .draw |
274 | jmp .draw |
275 | endf |
275 | endf |
276 | 276 | ||
277 | ;----------------------------------------------------------------------------- |
277 | ;----------------------------------------------------------------------------- |
278 | func vm_mike_put_pixel.32 ;/////////////////////////////////////////////////// |
278 | func vm_mike_put_pixel.32 ;/////////////////////////////////////////////////// |
279 | ;----------------------------------------------------------------------------- |
279 | ;----------------------------------------------------------------------------- |
280 | ; eax = x coordinate |
280 | ; eax = x coordinate |
281 | ; ebx = y coordinate |
281 | ; ebx = y coordinate |
282 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
282 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
283 | ; edi = 0x00000001 force |
283 | ; edi = 0x00000001 force |
284 | ;----------------------------------------------------------------------------- |
284 | ;----------------------------------------------------------------------------- |
285 | begin |
285 | begin |
286 | pushad |
286 | pushad |
287 | cli |
287 | cli |
288 | mov edx,[bytes_per_scanline] |
288 | mov edx,[BytesPerScanLine] |
289 | imul edx,ebx |
289 | imul edx,ebx |
290 | lea edx,[edx+eax*4] |
290 | lea edx,[edx+eax*4] |
291 | add edx,[lfb_address] |
291 | add edx,[LFBAddress] |
292 | ; test ecx,0x01000000 |
292 | ; test ecx,0x01000000 |
293 | ; jz @f |
293 | ; jz @f |
294 | ; mov ecx,[edx] |
294 | ; mov ecx,[edx] |
295 | ; not ecx |
295 | ; not ecx |
296 | @@: test edi,1 |
296 | @@: test edi,1 |
297 | jnz .forced |
297 | jnz .forced |
298 | mov esi,[0x00003000] |
298 | mov esi,[CURRENT_TASK] |
299 | mov esi,[CLIP_RECTS+esi*4] |
299 | mov esi,[CLIP_RECTS+esi*4] |
300 | mov edi,[esi] |
300 | mov edi,[esi] |
301 | or edi,edi |
301 | or edi,edi |
302 | jz .exit |
302 | jz .exit |
303 | add esi,4 |
303 | add esi,4 |
304 | @@: jif eax,l,[rr.left],.skip |
304 | @@: jif eax,l,[rr.left],.skip |
305 | jif eax,ge,[rr.right],.skip |
305 | jif eax,ge,[rr.right],.skip |
306 | jif ebx,l,[rr.top],.skip |
306 | jif ebx,l,[rr.top],.skip |
307 | jif ebx,ge,[rr.bottom],.skip |
307 | jif ebx,ge,[rr.bottom],.skip |
308 | call get_cursor_rect |
308 | call get_cursor_rect |
309 | call is_intersect_pt |
309 | call is_intersect_pt |
310 | jc .put |
310 | jc .put |
311 | cmp [mouse_invisible],0 |
311 | cmp byte[MOUSE_VISIBLE],0 |
312 | jne .put |
312 | je .put |
313 | call [SF.draw_mouse_under] |
313 | call [SF.draw_mouse_under] |
314 | mov [mouse_invisible],1 |
314 | mov byte[MOUSE_VISIBLE],0 |
315 | .put: push edx |
315 | .put: push edx |
316 | call [set_bank] |
316 | call [set_bank] |
317 | pop edx |
317 | pop edx |
318 | test ecx,0x01000000 |
318 | test ecx,0x01000000 |
319 | jz .lp1 |
319 | jz .lp1 |
320 | not dword[ebp] |
320 | not dword[ebp] |
321 | jmp .exit |
321 | jmp .exit |
322 | .lp1: mov [ebp],ecx |
322 | .lp1: mov [ebp],ecx |
323 | .exit: |
323 | .exit: |
324 | sti |
324 | sti |
325 | popad |
325 | popad |
326 | retn |
326 | retn |
327 | .skip: |
327 | .skip: |
328 | add esi,SR |
328 | add esi,SR |
329 | dec edi |
329 | dec edi |
330 | jnz @b |
330 | jnz @b |
331 | jmp .exit |
331 | jmp .exit |
332 | .forced: |
332 | .forced: |
333 | jif eax,l,[viewport.left],.exit |
333 | jif eax,l,[viewport.left],.exit |
334 | jif ebx,l,[viewport.top],.exit |
334 | jif ebx,l,[viewport.top],.exit |
335 | jif eax,ge,[viewport.right],.exit |
335 | jif eax,ge,[viewport.right],.exit |
336 | jif ebx,ge,[viewport.bottom],.exit |
336 | jif ebx,ge,[viewport.bottom],.exit |
337 | push edx |
337 | push edx |
338 | call [set_bank] |
338 | call [set_bank] |
339 | pop edx |
339 | pop edx |
340 | test ecx,0x01000000 |
340 | test ecx,0x01000000 |
341 | jz .lp2 |
341 | jz .lp2 |
342 | not dword[ebp] |
342 | not dword[ebp] |
343 | jmp .exit |
343 | jmp .exit |
344 | .lp2: mov [ebp],ecx |
344 | .lp2: mov [ebp],ecx |
345 | jmp .exit |
345 | jmp .exit |
346 | endf |
346 | endf |
347 | 347 | ||
348 | ;----------------------------------------------------------------------------- |
348 | ;----------------------------------------------------------------------------- |
349 | func vm_mike_get_pixel.32 ;/////////////////////////////////////////////////// |
349 | func vm_mike_get_pixel.32 ;/////////////////////////////////////////////////// |
350 | ;----------------------------------------------------------------------------- |
350 | ;----------------------------------------------------------------------------- |
351 | ; eax = x coordinate |
351 | ; eax = x coordinate |
352 | ; ebx = y coordinate |
352 | ; ebx = y coordinate |
353 | ;----------------------------------------------------------------------------- |
353 | ;----------------------------------------------------------------------------- |
354 | begin |
354 | begin |
355 | pushad |
355 | pushad |
356 | cli |
356 | cli |
357 | imul ebx,[bytes_per_scanline] |
357 | imul ebx,[BytesPerScanLine] |
358 | shl eax,2 |
358 | shl eax,2 |
359 | add eax,ebx |
359 | add eax,ebx |
360 | add eax,[lfb_address] |
360 | add eax,[LFBAddress] |
361 | push eax |
361 | push eax |
362 | call [set_bank] |
362 | call [set_bank] |
363 | pop eax |
363 | pop eax |
364 | mov eax,[ebp] |
364 | mov eax,[ebp] |
365 | and eax,0x00FFFFFF |
365 | and eax,0x00FFFFFF |
366 | mov [esp+4*6],eax |
366 | mov [esp+4*6],eax |
367 | sti |
367 | sti |
368 | popad |
368 | popad |
369 | retn |
369 | retn |
370 | endf |
370 | endf |
371 | 371 | ||
372 | ;----------------------------------------------------------------------------- |
372 | ;----------------------------------------------------------------------------- |
373 | func vm_mike_put_image.32 ;/////////////////////////////////////////////////// |
373 | func vm_mike_put_image.32 ;/////////////////////////////////////////////////// |
374 | ;----------------------------------------------------------------------------- |
374 | ;----------------------------------------------------------------------------- |
375 | ; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
375 | ; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
376 | ; ebx(ecx) image size [x]*65536+[y] |
376 | ; ebx(ecx) image size [x]*65536+[y] |
377 | ; ecx(edx) image position in window [x]*65536+[y] |
377 | ; ecx(edx) image position in window [x]*65536+[y] |
378 | ; ret: eax 0 succesful, 1 overlapped |
378 | ; ret: eax 0 succesful, 1 overlapped |
379 | ;----------------------------------------------------------------------------- |
379 | ;----------------------------------------------------------------------------- |
380 | begin |
380 | begin |
381 | mov eax,ebx |
381 | mov eax,ebx |
382 | mov ebx,ecx |
382 | mov ebx,ecx |
383 | mov ecx,edx |
383 | mov ecx,edx |
384 | 384 | ||
385 | .direct: |
385 | .direct: |
386 | pushad |
386 | pushad |
387 | cli |
387 | cli |
388 | jif ebx,z,0x0000FFFF,.exit,test |
388 | jif ebx,z,0x0000FFFF,.exit,test |
389 | jif ebx,z,0xFFFF0000,.exit,test |
389 | jif ebx,z,0xFFFF0000,.exit,test |
390 | 390 | ||
391 | call get_cursor_rect |
391 | call get_cursor_rect |
392 | 392 | ||
393 | mov ebp,eax |
393 | mov ebp,eax |
394 | movsx eax,word[esp+4*6+2] |
394 | movsx eax,word[esp+4*6+2] |
395 | movsx ebx,word[esp+4*6] |
395 | movsx ebx,word[esp+4*6] |
396 | movsx ecx,word[esp+4*4+2] |
396 | movsx ecx,word[esp+4*4+2] |
397 | movsx edx,word[esp+4*4] |
397 | movsx edx,word[esp+4*4] |
398 | 398 | ||
399 | lea edi,[ecx*3] |
399 | lea edi,[ecx*3] |
400 | push edi |
400 | push edi |
401 | add ecx,eax |
401 | add ecx,eax |
402 | add edx,ebx |
402 | add edx,ebx |
403 | mov edi,[0x00003010] |
403 | mov edi,[TASK_BASE] |
404 | movsx esi,word[edi-0x3000+0] |
404 | movsx esi,word[edi-CURRENT_TASK+0] |
405 | add eax,esi |
405 | add eax,esi |
406 | add ecx,esi |
406 | add ecx,esi |
407 | movsx esi,word[edi-0x3000+4] |
407 | movsx esi,word[edi-CURRENT_TASK+4] |
408 | add ebx,esi |
408 | add ebx,esi |
409 | add edx,esi |
409 | add edx,esi |
410 | ; add eax,[esi-0x3000+0] |
410 | ; add eax,[esi-CURRENT_TASK+0] |
411 | ; add ebx,[esi-0x3000+4] |
411 | ; add ebx,[esi-CURRENT_TASK+4] |
412 | ; add ecx,[esi-0x3000+0] |
412 | ; add ecx,[esi-CURRENT_TASK+0] |
413 | ; add edx,[esi-0x3000+4] |
413 | ; add edx,[esi-CURRENT_TASK+4] |
414 | 414 | ||
415 | ; cmp eax,640 |
415 | ; cmp eax,640 |
416 | ; jb @f |
416 | ; jb @f |
417 | ; SHFLOW '%x %x %x %x',eax,ebx,ecx,edx |
417 | ; SHFLOW '%x %x %x %x',eax,ebx,ecx,edx |
418 | ; @@: |
418 | ; @@: |
419 | 419 | ||
420 | mov esi,[0x00003000] |
420 | mov esi,[CURRENT_TASK] |
421 | mov esi,[CLIP_RECTS+esi*4] |
421 | mov esi,[CLIP_RECTS+esi*4] |
422 | mov edi,[esi] |
422 | mov edi,[esi] |
423 | or edi,edi |
423 | or edi,edi |
424 | jz .exit |
424 | jz .exit |
425 | add esi,4 |
425 | add esi,4 |
426 | cld |
426 | cld |
427 | .nx: jif ecx,l,[rr.left],.skip |
427 | .nx: jif ecx,l,[rr.left],.skip |
428 | jif eax,ge,[rr.right],.skip |
428 | jif eax,ge,[rr.right],.skip |
429 | jif edx,l,[rr.top],.skip |
429 | jif edx,l,[rr.top],.skip |
430 | jif ebx,ge,[rr.bottom],.skip |
430 | jif ebx,ge,[rr.bottom],.skip |
431 | pushad |
431 | pushad |
432 | jif eax,ge,[rr.left],@f |
432 | jif eax,ge,[rr.left],@f |
433 | mov eax,[rr.left] |
433 | mov eax,[rr.left] |
434 | @@: jif ebx,ge,[rr.top],@f |
434 | @@: jif ebx,ge,[rr.top],@f |
435 | mov ebx,[rr.top] |
435 | mov ebx,[rr.top] |
436 | @@: jif ecx,l,[rr.right],@f |
436 | @@: jif ecx,l,[rr.right],@f |
437 | mov ecx,[rr.right] |
437 | mov ecx,[rr.right] |
438 | @@: jif edx,l,[rr.bottom],@f |
438 | @@: jif edx,l,[rr.bottom],@f |
439 | mov edx,[rr.bottom] |
439 | mov edx,[rr.bottom] |
440 | @@: call is_intersect_rc |
440 | @@: call is_intersect_rc |
441 | jc .put |
441 | jc .put |
442 | cmp [mouse_invisible],0 |
442 | cmp byte[MOUSE_VISIBLE],0 |
443 | jne .put |
443 | je .put |
444 | call [SF.draw_mouse_under] |
444 | call [SF.draw_mouse_under] |
445 | mov [mouse_invisible],1 |
445 | mov byte[MOUSE_VISIBLE],0 |
446 | .put: mov esi,ebx |
446 | .put: mov esi,ebx |
447 | sub esi,[esp+4*4] |
447 | sub esi,[esp+4*4] |
448 | imul esi,[esp+4*8] |
448 | imul esi,[esp+4*8] |
449 | mov edi,eax |
449 | mov edi,eax |
450 | sub edi,[esp+4*7] |
450 | sub edi,[esp+4*7] |
451 | lea edi,[edi*3] |
451 | lea edi,[edi*3] |
452 | add esi,edi |
452 | add esi,edi |
453 | add esi,ebp |
453 | add esi,ebp |
454 | mov edi,[bytes_per_scanline] |
454 | mov edi,[BytesPerScanLine] |
455 | imul edi,ebx |
455 | imul edi,ebx |
456 | lea edi,[edi+eax*4] |
456 | lea edi,[edi+eax*4] |
457 | add edi,[lfb_address] |
457 | add edi,[LFBAddress] |
458 | .xxx: push eax esi edi eax |
458 | .xxx: push eax esi edi eax |
459 | @@: lodsd |
459 | @@: lodsd |
460 | 460 | ||
461 | push ebp edi |
461 | push ebp edi |
462 | call [set_bank] |
462 | call [set_bank] |
463 | mov [ebp],eax |
463 | mov [ebp],eax |
464 | pop edi ebp |
464 | pop edi ebp |
465 | add edi,4 |
465 | add edi,4 |
466 | 466 | ||
467 | dec esi |
467 | dec esi |
468 | inc dword[esp] |
468 | inc dword[esp] |
469 | cmp [esp],ecx |
469 | cmp [esp],ecx |
470 | jl @b |
470 | jl @b |
471 | pop eax edi esi eax |
471 | pop eax edi esi eax |
472 | add esi,[esp+4*8] |
472 | add esi,[esp+4*8] |
473 | add edi,[bytes_per_scanline] |
473 | add edi,[BytesPerScanLine] |
474 | inc ebx |
474 | inc ebx |
475 | cmp ebx,edx |
475 | cmp ebx,edx |
476 | jl .xxx |
476 | jl .xxx |
477 | popad |
477 | popad |
478 | .skip: |
478 | .skip: |
479 | add esi,SR |
479 | add esi,SR |
480 | dec edi |
480 | dec edi |
481 | jnz .nx |
481 | jnz .nx |
482 | 482 | ||
483 | .exit: |
483 | .exit: |
484 | add esp,4 |
484 | add esp,4 |
485 | sti |
485 | sti |
486 | popad |
486 | popad |
487 | xor eax,eax |
487 | xor eax,eax |
488 | retn |
488 | retn |
489 | endf |
489 | endf |
490 | 490 | ||
491 | ;----------------------------------------------------------------------------- |
491 | ;----------------------------------------------------------------------------- |
492 | func vm_mike_draw_bg.32 ;///////////////////////////////////////////////////// |
492 | func vm_mike_draw_bg.32 ;///////////////////////////////////////////////////// |
493 | ;----------------------------------------------------------------------------- |
493 | ;----------------------------------------------------------------------------- |
494 | begin |
494 | begin |
495 | pushad |
495 | pushad |
496 | 496 | ||
497 | cmp byte[bg_type],BGT_TILE |
497 | cmp byte[bg_type],BGT_TILE |
498 | je .tiled |
498 | je .tiled |
499 | 499 | ||
500 | mov eax,[bg_width] |
500 | mov eax,[bg_width] |
501 | cmp eax,[screen_width] |
501 | cmp eax,[ScreenWidth] |
502 | jne @f |
502 | jne @f |
503 | mov eax,[bg_height] |
503 | mov eax,[bg_height] |
504 | cmp eax,[screen_height] |
504 | cmp eax,[ScreenHeight] |
505 | je .tiled |
505 | je .tiled |
506 | @@: |
506 | @@: |
507 | imul eax,[bg_width],3 |
507 | imul eax,[bg_width],3 |
508 | mov [bg_bytes_per_scanline],eax |
508 | mov [bg_BytesPerScanLine],eax |
509 | 509 | ||
510 | mov eax,[viewport.left] |
510 | mov eax,[viewport.left] |
511 | mov ebx,[viewport.top] |
511 | mov ebx,[viewport.top] |
512 | mov ecx,[viewport.right] |
512 | mov ecx,[viewport.right] |
513 | mov edx,[viewport.bottom] |
513 | mov edx,[viewport.bottom] |
514 | 514 | ||
515 | cmp [bg_width],1 |
515 | cmp [bg_width],1 |
516 | jne @f |
516 | jne @f |
517 | cmp [bg_height],1 |
517 | cmp [bg_height],1 |
518 | je .color |
518 | je .color |
519 | @@: |
519 | @@: |
520 | cli |
520 | cli |
521 | 521 | ||
522 | call [SF.draw_mouse_under] |
522 | call [SF.draw_mouse_under] |
523 | mov [mouse_invisible],1 |
523 | mov byte[MOUSE_VISIBLE],0 |
524 | 524 | ||
525 | mov esi,[CLIP_RECTS+4] |
525 | mov esi,[CLIP_RECTS+4] |
526 | mov ebp,[esi] |
526 | mov ebp,[esi] |
527 | or ebp,ebp |
527 | or ebp,ebp |
528 | jz .exit |
528 | jz .exit |
529 | add esi,4 |
529 | add esi,4 |
530 | .nx: jif ecx,l,[rr.left],.skip |
530 | .nx: jif ecx,l,[rr.left],.skip |
531 | jif eax,ge,[rr.right],.skip |
531 | jif eax,ge,[rr.right],.skip |
532 | jif edx,l,[rr.top],.skip |
532 | jif edx,l,[rr.top],.skip |
533 | jif ebx,ge,[rr.bottom],.skip |
533 | jif ebx,ge,[rr.bottom],.skip |
534 | pushad |
534 | pushad |
535 | jif eax,ge,[rr.left],@f |
535 | jif eax,ge,[rr.left],@f |
536 | mov eax,[rr.left] |
536 | mov eax,[rr.left] |
537 | @@: jif ebx,ge,[rr.top],@f |
537 | @@: jif ebx,ge,[rr.top],@f |
538 | mov ebx,[rr.top] |
538 | mov ebx,[rr.top] |
539 | @@: jif ecx,l,[rr.right],@f |
539 | @@: jif ecx,l,[rr.right],@f |
540 | mov ecx,[rr.right] |
540 | mov ecx,[rr.right] |
541 | @@: jif edx,l,[rr.bottom],@f |
541 | @@: jif edx,l,[rr.bottom],@f |
542 | mov edx,[rr.bottom] |
542 | mov edx,[rr.bottom] |
543 | @@: ;call is_intersect_rc |
543 | @@: ;call is_intersect_rc |
544 | ;jc .put |
544 | ;jc .put |
545 | ;cmp [mouse_invisible],0 |
545 | ;cmp [mouse_invisible],0 |
546 | ;jne .put |
546 | ;jne .put |
547 | ;call [SF.draw_mouse_under] |
547 | ;call [SF.draw_mouse_under] |
548 | ;mov [mouse_invisible],1 |
548 | ;mov [mouse_invisible],1 |
549 | .put: mov ebp,[bytes_per_scanline] |
549 | .put: mov ebp,[BytesPerScanLine] |
550 | imul ebp,ebx |
550 | imul ebp,ebx |
551 | lea ebp,[ebp+eax*4] |
551 | lea ebp,[ebp+eax*4] |
552 | add ebp,[lfb_address] |
552 | add ebp,[LFBAddress] |
553 | .xxx: push eax ebp |
553 | .xxx: push eax ebp |
554 | @@: push ebp |
554 | @@: push ebp |
555 | call [set_bank] |
555 | call [set_bank] |
556 | push eax edx |
556 | push eax edx |
557 | mul [bg_width] |
557 | mul [bg_width] |
558 | div [screen_width] |
558 | div dword[ScreenWidth] |
559 | lea edi,[eax*3] |
559 | lea edi,[eax*3] |
560 | mov eax,ebx |
560 | mov eax,ebx |
561 | mul [bg_height] |
561 | mul [bg_height] |
562 | div [screen_height] |
562 | div dword[ScreenHeight] |
563 | mul [bg_bytes_per_scanline] |
563 | mul [bg_BytesPerScanLine] |
564 | add edi,eax |
564 | add edi,eax |
565 | add edi,bg_address |
565 | add edi,IMG_BACKGROUND |
566 | mov eax,[edi] |
566 | mov eax,[edi] |
567 | mov [ebp],eax |
567 | mov [ebp],eax |
568 | pop edx eax |
568 | pop edx eax |
569 | pop ebp |
569 | pop ebp |
570 | add ebp,4 |
570 | add ebp,4 |
571 | inc eax |
571 | inc eax |
572 | cmp eax,ecx |
572 | cmp eax,ecx |
573 | jl @b |
573 | jl @b |
574 | pop ebp eax |
574 | pop ebp eax |
575 | add ebp,[bytes_per_scanline] |
575 | add ebp,[BytesPerScanLine] |
576 | inc ebx |
576 | inc ebx |
577 | cmp ebx,edx |
577 | cmp ebx,edx |
578 | jl .xxx |
578 | jl .xxx |
579 | popad |
579 | popad |
580 | .skip: |
580 | .skip: |
581 | add esi,SR |
581 | add esi,SR |
582 | dec ebp |
582 | dec ebp |
583 | jnz .nx |
583 | jnz .nx |
584 | 584 | ||
585 | .exit: |
585 | .exit: |
586 | sti |
586 | sti |
587 | popad |
587 | popad |
588 | retn |
588 | retn |
589 | 589 | ||
590 | .tiled: |
590 | .tiled: |
591 | mov eax,bg_address |
591 | mov eax,IMG_BACKGROUND |
592 | mov ebx,[bg_width-2] |
592 | mov ebx,[bg_width-2] |
593 | mov bx,word[bg_height] |
593 | mov bx,word[bg_height] |
594 | xor ecx,ecx |
594 | xor ecx,ecx |
595 | .lp1: push eax |
595 | .lp1: push eax |
596 | call vm_mike_put_image.32.direct |
596 | call vm_mike_put_image.32.direct |
597 | pop eax |
597 | pop eax |
598 | rol ecx,16 |
598 | rol ecx,16 |
599 | add cx,word[bg_width] |
599 | add cx,word[bg_width] |
600 | cmp cx,word[screen_width] |
600 | cmp cx,word[ScreenWidth] |
601 | jae @f |
601 | jae @f |
602 | rol ecx,16 |
602 | rol ecx,16 |
603 | jmp .lp1 |
603 | jmp .lp1 |
604 | @@: shr ecx,16 |
604 | @@: shr ecx,16 |
605 | add ecx,[bg_height] |
605 | add ecx,[bg_height] |
606 | cmp ecx,[screen_height] |
606 | cmp ecx,[ScreenHeight] |
607 | jb .lp1 |
607 | jb .lp1 |
608 | popad |
608 | popad |
609 | retn |
609 | retn |
610 | 610 | ||
611 | .color: |
611 | .color: |
612 | mov edi,[bg_address] |
612 | mov edi,[IMG_BACKGROUND] |
613 | and edi,0x00FFFFFF |
613 | and edi,0x00FFFFFF |
614 | call vm_mike_draw_rect.32 |
614 | call vm_mike_draw_rect.32 |
615 | popad |
615 | popad |
616 | retn |
616 | retn |
617 | endf |
617 | endf |