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 | func color_24_to_4_bits |
1 | func color_24_to_4_bits |
2 | begin |
2 | begin |
3 | push edx |
3 | push edx |
4 | mov dl,0 |
4 | mov dl,0 |
5 | cmp al,85 ; blue |
5 | cmp al,85 ; blue |
6 | jbe .p13green |
6 | jbe .p13green |
7 | or dl,0x01 |
7 | or dl,0x01 |
8 | cmp al,170 |
8 | cmp al,170 |
9 | jbe .p13green |
9 | jbe .p13green |
10 | or dl,0x08 |
10 | or dl,0x08 |
11 | .p13green: |
11 | .p13green: |
12 | shr eax,8 |
12 | shr eax,8 |
13 | cmp al,85 ; green |
13 | cmp al,85 ; green |
14 | jbe .p13red |
14 | jbe .p13red |
15 | or dl,0x02 |
15 | or dl,0x02 |
16 | cmp al,170 |
16 | cmp al,170 |
17 | jbe .p13red |
17 | jbe .p13red |
18 | or dl,0x08 |
18 | or dl,0x08 |
19 | .p13red: |
19 | .p13red: |
20 | cmp ah,85 ; red |
20 | cmp ah,85 ; red |
21 | jbe .p13cont |
21 | jbe .p13cont |
22 | or dl,0x04 |
22 | or dl,0x04 |
23 | cmp ah,170 |
23 | cmp ah,170 |
24 | jbe .p13cont |
24 | jbe .p13cont |
25 | or dl,0x08 |
25 | or dl,0x08 |
26 | .p13cont: |
26 | .p13cont: |
27 | mov eax,edx |
27 | mov eax,edx |
28 | pop edx |
28 | pop edx |
29 | ret |
29 | ret |
30 | endf |
30 | endf |
31 | 31 | ||
32 | ;----------------------------------------------------------------------------- |
32 | ;----------------------------------------------------------------------------- |
33 | func vm_mike_draw_rect.04 ;/////////////////////////////////////////////////// |
33 | func vm_mike_draw_rect.04 ;/////////////////////////////////////////////////// |
34 | ;----------------------------------------------------------------------------- |
34 | ;----------------------------------------------------------------------------- |
35 | ; eax - x start |
35 | ; eax - x start |
36 | ; ebx - y start |
36 | ; ebx - y start |
37 | ; ecx - x end |
37 | ; ecx - x end |
38 | ; edx - y end |
38 | ; edx - y end |
39 | ; edi - color |
39 | ; edi - color |
40 | ;----------------------------------------------------------------------------- |
40 | ;----------------------------------------------------------------------------- |
41 | ;- eax(ebx) [x start]*65536 + [x size] |
41 | ;- eax(ebx) [x start]*65536 + [x size] |
42 | ;- ebx(ecx) [y start]*65536 + [y size] |
42 | ;- ebx(ecx) [y start]*65536 + [y size] |
43 | ;- ecx(edx) color 0x00RRGGBB |
43 | ;- ecx(edx) color 0x00RRGGBB |
44 | ;----------------------------------------------------------------------------- |
44 | ;----------------------------------------------------------------------------- |
45 | begin |
45 | begin |
46 | pushad |
46 | pushad |
47 | cli |
47 | cli |
48 | jif eax,e,ecx,.exit |
48 | jif eax,e,ecx,.exit |
49 | jif ebx,e,edx,.exit |
49 | jif ebx,e,edx,.exit |
50 | 50 | ||
51 | call get_cursor_rect |
51 | call get_cursor_rect |
52 | 52 | ||
53 | push eax |
53 | push eax |
54 | mov eax,edi |
54 | mov eax,edi |
55 | call color_24_to_4_bits |
55 | call color_24_to_4_bits |
56 | mov edi,eax |
56 | mov edi,eax |
57 | pop eax |
57 | pop eax |
58 | 58 | ||
59 | mov ebp,[0x3010] |
59 | mov ebp,[TASK_BASE] |
60 | movsx esi,word[ebp-0x3000+0] |
60 | movsx esi,word[ebp-CURRENT_TASK+0] |
61 | add eax,esi |
61 | add eax,esi |
62 | add ecx,esi |
62 | add ecx,esi |
63 | movsx esi,word[ebp-0x3000+4] |
63 | movsx esi,word[ebp-CURRENT_TASK+4] |
64 | add ebx,esi |
64 | add ebx,esi |
65 | add edx,esi |
65 | add edx,esi |
66 | ; add eax,[ebp-0x3000+0] |
66 | ; add eax,[ebp-CURRENT_TASK+0] |
67 | ; add ebx,[ebp-0x3000+4] |
67 | ; add ebx,[ebp-CURRENT_TASK+4] |
68 | ; add ecx,[ebp-0x3000+0] |
68 | ; add ecx,[ebp-CURRENT_TASK+0] |
69 | ; add edx,[ebp-0x3000+4] |
69 | ; add edx,[ebp-CURRENT_TASK+4] |
70 | 70 | ||
71 | mov esi,[0x00003000] |
71 | mov esi,[CURRENT_TASK] |
72 | mov esi,[CLIP_RECTS+esi*4] |
72 | mov esi,[CLIP_RECTS+esi*4] |
73 | mov ebp,[esi] |
73 | mov ebp,[esi] |
74 | or ebp,ebp |
74 | or ebp,ebp |
75 | jz .exit |
75 | jz .exit |
76 | add esi,4 |
76 | add esi,4 |
77 | .nx: jif ecx,le,[rr.left],.skip |
77 | .nx: jif ecx,le,[rr.left],.skip |
78 | jif eax,ge,[rr.right],.skip |
78 | jif eax,ge,[rr.right],.skip |
79 | jif edx,le,[rr.top],.skip |
79 | jif edx,le,[rr.top],.skip |
80 | jif ebx,ge,[rr.bottom],.skip |
80 | jif ebx,ge,[rr.bottom],.skip |
81 | pushad |
81 | pushad |
82 | jif eax,ge,[rr.left],@f |
82 | jif eax,ge,[rr.left],@f |
83 | mov eax,[rr.left] |
83 | mov eax,[rr.left] |
84 | @@: jif ebx,ge,[rr.top],@f |
84 | @@: jif ebx,ge,[rr.top],@f |
85 | mov ebx,[rr.top] |
85 | mov ebx,[rr.top] |
86 | @@: jif ecx,l,[rr.right],@f |
86 | @@: jif ecx,l,[rr.right],@f |
87 | mov ecx,[rr.right] |
87 | mov ecx,[rr.right] |
88 | @@: jif edx,l,[rr.bottom],@f |
88 | @@: jif edx,l,[rr.bottom],@f |
89 | mov edx,[rr.bottom] |
89 | mov edx,[rr.bottom] |
90 | @@: call is_intersect_rc |
90 | @@: call is_intersect_rc |
91 | jc .put |
91 | jc .put |
92 | cmp [mouse_invisible],0 |
92 | cmp byte[MOUSE_VISIBLE],0 |
93 | jne .put |
93 | je .put |
94 | call [SF.draw_mouse_under] |
94 | call [SF.draw_mouse_under] |
95 | mov [mouse_invisible],1 |
95 | mov byte[MOUSE_VISIBLE],0 |
96 | .put: sub edx,ebx |
96 | .put: sub edx,ebx |
97 | push edx edi ebx eax |
97 | push edx edi ebx eax |
98 | mov edi,ebx |
98 | mov edi,ebx |
99 | shl edi,6 |
99 | shl edi,6 |
100 | shl ebx,4 |
100 | shl ebx,4 |
101 | add edi,ebx |
101 | add edi,ebx |
102 | shr eax,3 |
102 | shr eax,3 |
103 | add edi,eax |
103 | add edi,eax |
104 | add edi,0x000A0000 |
104 | add edi,VGABasePtr |
105 | pop eax ebx |
105 | pop eax ebx |
106 | 106 | ||
107 | mov ebx,eax |
107 | mov ebx,eax |
108 | mov esi,ecx |
108 | mov esi,ecx |
109 | sub esi,eax |
109 | sub esi,eax |
110 | mov dx,0x03CE |
110 | mov dx,0x03CE |
111 | 111 | ||
112 | ;edi = Offset in VMem |
112 | ;edi = Offset in VMem |
113 | ;esi = Length |
113 | ;esi = Length |
114 | ;ebx = x |
114 | ;ebx = x |
115 | ; dx = Graphix Controller |
115 | ; dx = Graphix Controller |
116 | 116 | ||
117 | mov cl,bl ; Get StartBit |
117 | mov cl,bl ; Get StartBit |
118 | and ecx,07h |
118 | and ecx,07h |
119 | 119 | ||
120 | mov eax,esi |
120 | mov eax,esi |
121 | add eax,ecx |
121 | add eax,ecx |
122 | cmp eax,8 ; Is x+Length |
122 | cmp eax,8 ; Is x+Length |
123 | jb .D_One |
123 | jb .D_One |
124 | 124 | ||
125 | mov ax,0xff08 ; 11111111b | BitMask Register |
125 | mov ax,0xff08 ; 11111111b | BitMask Register |
126 | shr ah,cl ; BitMask |
126 | shr ah,cl ; BitMask |
127 | out dx,ax ; Write BitMask |
127 | out dx,ax ; Write BitMask |
128 | push ecx |
128 | push ecx |
129 | mov ah,[esp+4] |
129 | mov ah,[esp+4] |
130 | mov ecx,[esp+4+4] |
130 | mov ecx,[esp+4+4] |
131 | push edi |
131 | push edi |
132 | .D_LL: ; Draw Left of Box |
132 | .D_LL: ; Draw Left of Box |
133 | mov al,[edi] |
133 | mov al,[edi] |
134 | mov [edi],ah |
134 | mov [edi],ah |
135 | add edi,80 ; edi:=edi+80 |
135 | add edi,80 ; edi:=edi+80 |
136 | dec ecx |
136 | dec ecx |
137 | jnz .D_LL |
137 | jnz .D_LL |
138 | pop edi |
138 | pop edi |
139 | inc edi |
139 | inc edi |
140 | pop ecx |
140 | pop ecx |
141 | 141 | ||
142 | mov ax,0xFF08 ; BitMask Register |
142 | mov ax,0xFF08 ; BitMask Register |
143 | out dx,ax ; Write BitMask |
143 | out dx,ax ; Write BitMask |
144 | 144 | ||
145 | mov eax,esi |
145 | mov eax,esi |
146 | mov ch,8 |
146 | mov ch,8 |
147 | sub ch,cl |
147 | sub ch,cl |
148 | movzx ecx,ch |
148 | movzx ecx,ch |
149 | sub eax,ecx |
149 | sub eax,ecx |
150 | shr eax,3 ; Length div 8 |
150 | shr eax,3 ; Length div 8 |
151 | 151 | ||
152 | push edi ebx |
152 | push edi ebx |
153 | mov ebx,[esp+8+4] |
153 | mov ebx,[esp+8+4] |
154 | mov edx,eax |
154 | mov edx,eax |
155 | mov al,[esp+8] |
155 | mov al,[esp+8] |
156 | .D_LC: |
156 | .D_LC: |
157 | mov ecx,edx |
157 | mov ecx,edx |
158 | rep stosb |
158 | rep stosb |
159 | add edi,80 |
159 | add edi,80 |
160 | sub edi,edx |
160 | sub edi,edx |
161 | dec ebx |
161 | dec ebx |
162 | jnz .D_LC |
162 | jnz .D_LC |
163 | pop ebx edi |
163 | pop ebx edi |
164 | add edi,edx |
164 | add edi,edx |
165 | 165 | ||
166 | mov ecx,ebx ; ecx:=x+Length |
166 | mov ecx,ebx ; ecx:=x+Length |
167 | add ecx,esi |
167 | add ecx,esi |
168 | and ecx,07h ; ecx and 07 |
168 | and ecx,07h ; ecx and 07 |
169 | mov ah,0ffh |
169 | mov ah,0ffh |
170 | shr ah,cl ; BitMask |
170 | shr ah,cl ; BitMask |
171 | jz .D_End |
171 | jz .D_End |
172 | 172 | ||
173 | not ah |
173 | not ah |
174 | mov al,8 ; BitMask Register |
174 | mov al,8 ; BitMask Register |
175 | mov dx,03ceh ; Graphics Controller |
175 | mov dx,03ceh ; Graphics Controller |
176 | out dx,ax ; Write BitMask |
176 | out dx,ax ; Write BitMask |
177 | mov ecx,[esp+4] |
177 | mov ecx,[esp+4] |
178 | mov al,[esp] |
178 | mov al,[esp] |
179 | .D_LR: |
179 | .D_LR: |
180 | mov ah,[edi] |
180 | mov ah,[edi] |
181 | mov [edi],al |
181 | mov [edi],al |
182 | add edi,80 |
182 | add edi,80 |
183 | dec ecx |
183 | dec ecx |
184 | jnz .D_LR |
184 | jnz .D_LR |
185 | 185 | ||
186 | jmp .D_End |
186 | jmp .D_End |
187 | 187 | ||
188 | .D_One: |
188 | .D_One: |
189 | mov ah,0ffh |
189 | mov ah,0ffh |
190 | shr ah,cl ; Left BitMask |
190 | shr ah,cl ; Left BitMask |
191 | 191 | ||
192 | add ebx,esi |
192 | add ebx,esi |
193 | dec ebx |
193 | dec ebx |
194 | and ebx,07h |
194 | and ebx,07h |
195 | 195 | ||
196 | mov ecx,7 |
196 | mov ecx,7 |
197 | sub ecx,ebx |
197 | sub ecx,ebx |
198 | 198 | ||
199 | mov bl,0ffh |
199 | mov bl,0ffh |
200 | shl bl,cl ; Right BitMask |
200 | shl bl,cl ; Right BitMask |
201 | 201 | ||
202 | and ah,bl ; Full BitMask |
202 | and ah,bl ; Full BitMask |
203 | mov al,8 ; BitMask Register |
203 | mov al,8 ; BitMask Register |
204 | out dx,ax ; Write BitMask |
204 | out dx,ax ; Write BitMask |
205 | mov ecx,[esp+4] |
205 | mov ecx,[esp+4] |
206 | mov al,[esp] |
206 | mov al,[esp] |
207 | .D_L: |
207 | .D_L: |
208 | mov dl,[edi] ; Fill Latches |
208 | mov dl,[edi] ; Fill Latches |
209 | mov [edi],al ; Write Pixel |
209 | mov [edi],al ; Write Pixel |
210 | add edi,80 |
210 | add edi,80 |
211 | dec ecx |
211 | dec ecx |
212 | jnz .D_L |
212 | jnz .D_L |
213 | .D_End: |
213 | .D_End: |
214 | pop edi |
214 | pop edi |
215 | add esp,4 |
215 | add esp,4 |
216 | popad |
216 | popad |
217 | .skip: |
217 | .skip: |
218 | add esi,SR |
218 | add esi,SR |
219 | dec ebp |
219 | dec ebp |
220 | jnz .nx |
220 | jnz .nx |
221 | 221 | ||
222 | .exit: |
222 | .exit: |
223 | sti |
223 | sti |
224 | popad |
224 | popad |
225 | retn |
225 | retn |
226 | endf |
226 | endf |
227 | 227 | ||
228 | ;----------------------------------------------------------------------------- |
228 | ;----------------------------------------------------------------------------- |
229 | func vm_mike_draw_line.04 ;/////////////////////////////////////////////////// |
229 | func vm_mike_draw_line.04 ;/////////////////////////////////////////////////// |
230 | ;----------------------------------------------------------------------------- |
230 | ;----------------------------------------------------------------------------- |
231 | ; eax(ebx) [x start] shl 16 + [x end] |
231 | ; eax(ebx) [x start] shl 16 + [x end] |
232 | ; ebx(ecx) [y start] shl 16 + [y end] |
232 | ; ebx(ecx) [y start] shl 16 + [y end] |
233 | ; ecx(edx) colour 0x00RRGGBB |
233 | ; ecx(edx) colour 0x00RRGGBB |
234 | ; edi = 0x00000001 force |
234 | ; edi = 0x00000001 force |
235 | ;----------------------------------------------------------------------------- |
235 | ;----------------------------------------------------------------------------- |
236 | begin |
236 | begin |
237 | push 0 |
237 | push 0 |
238 | pushad |
238 | pushad |
239 | cli |
239 | cli |
240 | 240 | ||
241 | test ecx,0x01000000 |
241 | test ecx,0x01000000 |
242 | jnz .exit |
242 | jnz .exit |
243 | 243 | ||
244 | call get_cursor_rect |
244 | call get_cursor_rect |
245 | 245 | ||
246 | mov eax,ecx |
246 | mov eax,ecx |
247 | call color_24_to_4_bits |
247 | call color_24_to_4_bits |
248 | ; mov [esp+4*8],ecx |
248 | ; mov [esp+4*8],ecx |
249 | mov [esp+4*8],al |
249 | mov [esp+4*8],al |
250 | 250 | ||
251 | movsx eax,word[esp+4*7] ; x end |
251 | movsx eax,word[esp+4*7] ; x end |
252 | cmp ax,[esp+4*7+2] ; x start |
252 | cmp ax,[esp+4*7+2] ; x start |
253 | je dl.vert_line |
253 | je dl.vert_line |
254 | movsx eax,word[esp+4*4] ; y end |
254 | movsx eax,word[esp+4*4] ; y end |
255 | cmp ax,[esp+4*4+2] ; y start |
255 | cmp ax,[esp+4*4+2] ; y start |
256 | je dl.horz_line |
256 | je dl.horz_line |
257 | 257 | ||
258 | .exit: |
258 | .exit: |
259 | sti |
259 | sti |
260 | popad |
260 | popad |
261 | add esp,4 |
261 | add esp,4 |
262 | retn |
262 | retn |
263 | 263 | ||
264 | dl.vert_line: |
264 | dl.vert_line: |
265 | push eax |
265 | push eax |
266 | mov cl,al |
266 | mov cl,al |
267 | and cl,7 |
267 | and cl,7 |
268 | mov ax,0x8008 |
268 | mov ax,0x8008 |
269 | shr ah,cl |
269 | shr ah,cl |
270 | mov dx,0x03CE |
270 | mov dx,0x03CE |
271 | out dx,ax |
271 | out dx,ax |
272 | pop eax |
272 | pop eax |
273 | mov ecx,[esp+4*8] |
273 | mov ecx,[esp+4*8] |
274 | 274 | ||
275 | test edi,1 |
275 | test edi,1 |
276 | jnz .forced |
276 | jnz .forced |
277 | mov esi,[0x00003000] |
277 | mov esi,[CURRENT_TASK] |
278 | mov esi,[CLIP_RECTS+esi*4] |
278 | mov esi,[CLIP_RECTS+esi*4] |
279 | mov edi,[esi] |
279 | mov edi,[esi] |
280 | or edi,edi |
280 | or edi,edi |
281 | jz .exit |
281 | jz .exit |
282 | add esi,4 |
282 | add esi,4 |
283 | .nx: movsx ebx,word[esp+4*4+2] ; y start |
283 | .nx: movsx ebx,word[esp+4*4+2] ; y start |
284 | movsx edx,word[esp+4*4] ; y end |
284 | movsx edx,word[esp+4*4] ; y end |
285 | cmp ebx,edx |
285 | cmp ebx,edx |
286 | je .exit |
286 | je .exit |
287 | jl @f |
287 | jl @f |
288 | xchg ebx,edx |
288 | xchg ebx,edx |
289 | @@: jif eax,l,[rr.left],.skip |
289 | @@: jif eax,l,[rr.left],.skip |
290 | jif eax,ge,[rr.right],.skip |
290 | jif eax,ge,[rr.right],.skip |
291 | jif edx,l,[rr.top],.skip |
291 | jif edx,l,[rr.top],.skip |
292 | jif ebx,ge,[rr.bottom],.skip |
292 | jif ebx,ge,[rr.bottom],.skip |
293 | jif ebx,ge,[rr.top],@f |
293 | jif ebx,ge,[rr.top],@f |
294 | mov ebx,[rr.top] |
294 | mov ebx,[rr.top] |
295 | @@: jif edx,l,[rr.bottom],@f |
295 | @@: jif edx,l,[rr.bottom],@f |
296 | mov edx,[rr.bottom] |
296 | mov edx,[rr.bottom] |
297 | dec edx |
297 | dec edx |
298 | .draw: |
298 | .draw: |
299 | @@: call is_intersect_vln |
299 | @@: call is_intersect_vln |
300 | jc .put |
300 | jc .put |
301 | cmp [mouse_invisible],0 |
301 | cmp byte[MOUSE_VISIBLE],0 |
302 | jne .put |
302 | je .put |
303 | call [SF.draw_mouse_under] |
303 | call [SF.draw_mouse_under] |
304 | mov [mouse_invisible],1 |
304 | mov byte[MOUSE_VISIBLE],0 |
305 | .put: push ebx eax |
305 | .put: push ebx eax |
306 | mov ebp,ebx |
306 | mov ebp,ebx |
307 | shl ebp,6 |
307 | shl ebp,6 |
308 | shl ebx,4 |
308 | shl ebx,4 |
309 | add ebp,ebx |
309 | add ebp,ebx |
310 | shr eax,3 |
310 | shr eax,3 |
311 | add ebp,eax |
311 | add ebp,eax |
312 | add ebp,0x000A0000 |
312 | add ebp,VGABasePtr |
313 | pop eax ebx |
313 | pop eax ebx |
314 | @@: mov ch,[ebp] |
314 | @@: mov ch,[ebp] |
315 | mov [ebp],cl |
315 | mov [ebp],cl |
316 | add ebp,80 |
316 | add ebp,80 |
317 | inc ebx |
317 | inc ebx |
318 | cmp ebx,edx |
318 | cmp ebx,edx |
319 | jle @b |
319 | jle @b |
320 | .skip: |
320 | .skip: |
321 | add esi,SR |
321 | add esi,SR |
322 | dec edi |
322 | dec edi |
323 | jnz .nx |
323 | jnz .nx |
324 | .exit: |
324 | .exit: |
325 | sti |
325 | sti |
326 | popad |
326 | popad |
327 | add esp,4 |
327 | add esp,4 |
328 | retn |
328 | retn |
329 | .forced: |
329 | .forced: |
330 | jif eax,l,[viewport.left],.exit |
330 | jif eax,l,[viewport.left],.exit |
331 | jif eax,ge,[viewport.right],.exit |
331 | jif eax,ge,[viewport.right],.exit |
332 | movsx ebx,word[esp+4*4+2] ; y start |
332 | movsx ebx,word[esp+4*4+2] ; y start |
333 | movsx edx,word[esp+4*4] ; y end |
333 | movsx edx,word[esp+4*4] ; y end |
334 | jif ebx,e,edx,.exit |
334 | jif ebx,e,edx,.exit |
335 | jl @f |
335 | jl @f |
336 | xchg ebx,edx |
336 | xchg ebx,edx |
337 | @@: jif edx,l,[viewport.top],.exit |
337 | @@: jif edx,l,[viewport.top],.exit |
338 | jif ebx,ge,[viewport.bottom],.exit |
338 | jif ebx,ge,[viewport.bottom],.exit |
339 | jif ebx,ge,[viewport.top],@f |
339 | jif ebx,ge,[viewport.top],@f |
340 | mov ebx,[viewport.top] |
340 | mov ebx,[viewport.top] |
341 | @@: jif edx,l,[viewport.bottom],@f |
341 | @@: jif edx,l,[viewport.bottom],@f |
342 | mov edx,[viewport.bottom] |
342 | mov edx,[viewport.bottom] |
343 | dec edx |
343 | dec edx |
344 | @@: mov edi,1 |
344 | @@: mov edi,1 |
345 | jmp .draw |
345 | jmp .draw |
346 | 346 | ||
347 | dl.horz_line: |
347 | dl.horz_line: |
348 | cld |
348 | cld |
349 | mov ecx,[esp+4*8] |
349 | mov ecx,[esp+4*8] |
350 | test edi,1 |
350 | test edi,1 |
351 | jnz .forced |
351 | jnz .forced |
352 | mov esi,[0x00003000] |
352 | mov esi,[CURRENT_TASK] |
353 | mov esi,[CLIP_RECTS+esi*4] |
353 | mov esi,[CLIP_RECTS+esi*4] |
354 | mov edi,[esi] |
354 | mov edi,[esi] |
355 | or edi,edi |
355 | or edi,edi |
356 | jz .exit |
356 | jz .exit |
357 | add esi,4 |
357 | add esi,4 |
358 | .nx: movsx ebx,word[esp+4*7+2] ; x start |
358 | .nx: movsx ebx,word[esp+4*7+2] ; x start |
359 | movsx edx,word[esp+4*7] ; x end |
359 | movsx edx,word[esp+4*7] ; x end |
360 | cmp ebx,edx |
360 | cmp ebx,edx |
361 | je .exit |
361 | je .exit |
362 | jl @f |
362 | jl @f |
363 | xchg ebx,edx |
363 | xchg ebx,edx |
364 | @@: jif eax,l,[rr.top],.skip |
364 | @@: jif eax,l,[rr.top],.skip |
365 | jif eax,ge,[rr.bottom],.skip |
365 | jif eax,ge,[rr.bottom],.skip |
366 | jif edx,l,[rr.left],.skip |
366 | jif edx,l,[rr.left],.skip |
367 | jif ebx,ge,[rr.right],.skip |
367 | jif ebx,ge,[rr.right],.skip |
368 | jif ebx,ge,[rr.left],@f |
368 | jif ebx,ge,[rr.left],@f |
369 | mov ebx,[rr.left] |
369 | mov ebx,[rr.left] |
370 | @@: jif edx,l,[rr.right],@f |
370 | @@: jif edx,l,[rr.right],@f |
371 | mov edx,[rr.right] |
371 | mov edx,[rr.right] |
372 | dec edx |
372 | dec edx |
373 | .draw: |
373 | .draw: |
374 | @@: call is_intersect_hln |
374 | @@: call is_intersect_hln |
375 | jc .put |
375 | jc .put |
376 | cmp [mouse_invisible],0 |
376 | cmp byte[MOUSE_VISIBLE],0 |
377 | jne .put |
377 | je .put |
378 | call [SF.draw_mouse_under] |
378 | call [SF.draw_mouse_under] |
379 | mov [mouse_invisible],1 |
379 | mov byte[MOUSE_VISIBLE],0 |
380 | .put: push edi ebx eax |
380 | .put: push edi ebx eax |
381 | mov edi,eax |
381 | mov edi,eax |
382 | shl edi,6 |
382 | shl edi,6 |
383 | shl eax,4 |
383 | shl eax,4 |
384 | add edi,eax |
384 | add edi,eax |
385 | shr ebx,3 |
385 | shr ebx,3 |
386 | add edi,ebx |
386 | add edi,ebx |
387 | add edi,0x000A0000 |
387 | add edi,VGABasePtr |
388 | pop eax ebx |
388 | pop eax ebx |
389 | 389 | ||
390 | push eax ebx edx esi ecx |
390 | push eax ebx edx esi ecx |
391 | mov esi,edx |
391 | mov esi,edx |
392 | sub esi,ebx |
392 | sub esi,ebx |
393 | inc esi |
393 | inc esi |
394 | mov dx,0x03CE |
394 | mov dx,0x03CE |
395 | ;edi = Offset in VMem |
395 | ;edi = Offset in VMem |
396 | ;esi = Length |
396 | ;esi = Length |
397 | ;ebx = x |
397 | ;ebx = x |
398 | ; dx = Graphix Controller |
398 | ; dx = Graphix Controller |
399 | mov cl,bl ; Get StartBit |
399 | mov cl,bl ; Get StartBit |
400 | and ecx,07h |
400 | and ecx,07h |
401 | 401 | ||
402 | mov eax,esi |
402 | mov eax,esi |
403 | add eax,ecx |
403 | add eax,ecx |
404 | cmp eax,8 ; Is x+Length |
404 | cmp eax,8 ; Is x+Length |
405 | jb .D_One |
405 | jb .D_One |
406 | 406 | ||
407 | mov ax,0xFF08 ; 11111111b | BitMask Register |
407 | mov ax,0xFF08 ; 11111111b | BitMask Register |
408 | shr ah,cl ; BitMask |
408 | shr ah,cl ; BitMask |
409 | out dx,ax ; Write BitMask |
409 | out dx,ax ; Write BitMask |
410 | mov al,[edi] |
410 | mov al,[edi] |
411 | mov eax,[esp] |
411 | mov eax,[esp] |
412 | mov [edi],al |
412 | mov [edi],al |
413 | inc edi |
413 | inc edi |
414 | 414 | ||
415 | mov ax,0xFF08 ; BitMask | BitMask Register |
415 | mov ax,0xFF08 ; BitMask | BitMask Register |
416 | out dx,ax ; Write BitMask |
416 | out dx,ax ; Write BitMask |
417 | 417 | ||
418 | mov eax,esi |
418 | mov eax,esi |
419 | mov ch,8 |
419 | mov ch,8 |
420 | sub ch,cl |
420 | sub ch,cl |
421 | mov cl,ch |
421 | mov cl,ch |
422 | xor ch,ch |
422 | xor ch,ch |
423 | sub eax,ecx |
423 | sub eax,ecx |
424 | shr eax,3 ; Length div 8 |
424 | shr eax,3 ; Length div 8 |
425 | mov ecx,eax |
425 | mov ecx,eax |
426 | mov eax,[esp] |
426 | mov eax,[esp] |
427 | rep stosb |
427 | rep stosb |
428 | 428 | ||
429 | mov ecx,ebx ; ecx:=x+Length |
429 | mov ecx,ebx ; ecx:=x+Length |
430 | add ecx,esi |
430 | add ecx,esi |
431 | and ecx,07h ; ecx and 07 |
431 | and ecx,07h ; ecx and 07 |
432 | mov ah,0ffh |
432 | mov ah,0ffh |
433 | shr ah,cl ; BitMask |
433 | shr ah,cl ; BitMask |
434 | jz .D_End |
434 | jz .D_End |
435 | 435 | ||
436 | not ah |
436 | not ah |
437 | mov al,8 ; BitMask Register |
437 | mov al,8 ; BitMask Register |
438 | out dx,ax ; Write BitMask |
438 | out dx,ax ; Write BitMask |
439 | mov cl,[edi] |
439 | mov cl,[edi] |
440 | mov eax,[esp] |
440 | mov eax,[esp] |
441 | mov [edi],al |
441 | mov [edi],al |
442 | jmp .D_End |
442 | jmp .D_End |
443 | 443 | ||
444 | .D_One: |
444 | .D_One: |
445 | mov ax,0xff08 ; | BitMask Register |
445 | mov ax,0xff08 ; | BitMask Register |
446 | shr ah,cl ; Left BitMask |
446 | shr ah,cl ; Left BitMask |
447 | 447 | ||
448 | add ebx,esi |
448 | add ebx,esi |
449 | dec ebx |
449 | dec ebx |
450 | and ebx,07h |
450 | and ebx,07h |
451 | 451 | ||
452 | mov ecx,7 |
452 | mov ecx,7 |
453 | sub ecx,ebx |
453 | sub ecx,ebx |
454 | 454 | ||
455 | mov bl,0ffh |
455 | mov bl,0ffh |
456 | shl bl,cl ; Right BitMask |
456 | shl bl,cl ; Right BitMask |
457 | 457 | ||
458 | and ah,bl ; Full BitMask |
458 | and ah,bl ; Full BitMask |
459 | out dx,ax ; Write BitMask |
459 | out dx,ax ; Write BitMask |
460 | 460 | ||
461 | mov dl,[edi] ; Fill Latches |
461 | mov dl,[edi] ; Fill Latches |
462 | mov eax,[esp] |
462 | mov eax,[esp] |
463 | mov [edi],al ; Write Pixel |
463 | mov [edi],al ; Write Pixel |
464 | .D_End: |
464 | .D_End: |
465 | pop ecx esi edx ebx eax edi |
465 | pop ecx esi edx ebx eax edi |
466 | 466 | ||
467 | ; mov ebp,[bytes_per_scanline] |
467 | ; mov ebp,[BytesPerScanLine] |
468 | ; imul ebp,eax |
468 | ; imul ebp,eax |
469 | ; lea ebp,[ebp+ebx*4] |
469 | ; lea ebp,[ebp+ebx*4] |
470 | ; add ebp,[lfb_address] |
470 | ; add ebp,[LFBAddress] |
471 | ; @@: test ecx,0x01000000 |
471 | ; @@: test ecx,0x01000000 |
472 | ; jz .dr |
472 | ; jz .dr |
473 | ; mov ecx,[ebp] |
473 | ; mov ecx,[ebp] |
474 | ; not ecx |
474 | ; not ecx |
475 | ; or ecx,0x01000000 |
475 | ; or ecx,0x01000000 |
476 | ; .dr: mov [ebp],ecx |
476 | ; .dr: mov [ebp],ecx |
477 | ; add ebp,4 |
477 | ; add ebp,4 |
478 | ; inc ebx |
478 | ; inc ebx |
479 | ; cmp ebx,edx |
479 | ; cmp ebx,edx |
480 | ; jle @b |
480 | ; jle @b |
481 | .skip: |
481 | .skip: |
482 | add esi,SR |
482 | add esi,SR |
483 | dec edi |
483 | dec edi |
484 | jnz .nx |
484 | jnz .nx |
485 | .exit: |
485 | .exit: |
486 | sti |
486 | sti |
487 | popad |
487 | popad |
488 | add esp,4 |
488 | add esp,4 |
489 | retn |
489 | retn |
490 | .forced: |
490 | .forced: |
491 | jif eax,l,[viewport.top],.exit |
491 | jif eax,l,[viewport.top],.exit |
492 | jif eax,ge,[viewport.bottom],.exit |
492 | jif eax,ge,[viewport.bottom],.exit |
493 | movsx ebx,word[esp+4*7+2] ; x start |
493 | movsx ebx,word[esp+4*7+2] ; x start |
494 | movsx edx,word[esp+4*7] ; x end |
494 | movsx edx,word[esp+4*7] ; x end |
495 | cmp ebx,edx |
495 | cmp ebx,edx |
496 | je .exit |
496 | je .exit |
497 | jl @f |
497 | jl @f |
498 | xchg ebx,edx |
498 | xchg ebx,edx |
499 | @@: jif edx,l,[viewport.left],.exit |
499 | @@: jif edx,l,[viewport.left],.exit |
500 | jif ebx,ge,[viewport.right],.exit |
500 | jif ebx,ge,[viewport.right],.exit |
501 | jif ebx,ge,[viewport.left],@f |
501 | jif ebx,ge,[viewport.left],@f |
502 | mov ebx,[viewport.left] |
502 | mov ebx,[viewport.left] |
503 | @@: jif edx,l,[viewport.right],@f |
503 | @@: jif edx,l,[viewport.right],@f |
504 | mov edx,[viewport.right] |
504 | mov edx,[viewport.right] |
505 | dec edx |
505 | dec edx |
506 | @@: mov edi,1 |
506 | @@: mov edi,1 |
507 | jmp .draw |
507 | jmp .draw |
508 | endf |
508 | endf |
509 | 509 | ||
510 | ;----------------------------------------------------------------------------- |
510 | ;----------------------------------------------------------------------------- |
511 | func vm_mike_put_pixel.04 ;/////////////////////////////////////////////////// |
511 | func vm_mike_put_pixel.04 ;/////////////////////////////////////////////////// |
512 | ;----------------------------------------------------------------------------- |
512 | ;----------------------------------------------------------------------------- |
513 | ; eax = x coordinate |
513 | ; eax = x coordinate |
514 | ; ebx = y coordinate |
514 | ; ebx = y coordinate |
515 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
515 | ; ecx = ?? RR GG BB ; 0x01000000 negation |
516 | ; edi = 0x00000001 force |
516 | ; edi = 0x00000001 force |
517 | ;----------------------------------------------------------------------------- |
517 | ;----------------------------------------------------------------------------- |
518 | begin |
518 | begin |
519 | pushad |
519 | pushad |
520 | cli |
520 | cli |
521 | ; mov edx,[bytes_per_scanline] |
521 | ; mov edx,[BytesPerScanLine] |
522 | ; imul edx,ebx |
522 | ; imul edx,ebx |
523 | ; lea edx,[edx+eax*4] |
523 | ; lea edx,[edx+eax*4] |
524 | ; add edx,[lfb_address] |
524 | ; add edx,[LFBAddress] |
525 | ; test ecx,0x01000000 |
525 | ; test ecx,0x01000000 |
526 | ; jz @f |
526 | ; jz @f |
527 | ; mov ecx,[edx] |
527 | ; mov ecx,[edx] |
528 | ; not ecx |
528 | ; not ecx |
529 | @@: test edi,1 |
529 | @@: test edi,1 |
530 | jnz .forced |
530 | jnz .forced |
531 | mov esi,[0x00003000] |
531 | mov esi,[CURRENT_TASK] |
532 | mov esi,[CLIP_RECTS+esi*4] |
532 | mov esi,[CLIP_RECTS+esi*4] |
533 | mov edi,[esi] |
533 | mov edi,[esi] |
534 | or edi,edi |
534 | or edi,edi |
535 | jz .exit |
535 | jz .exit |
536 | add esi,4 |
536 | add esi,4 |
537 | @@: jif eax,l,[rr.left],.skip |
537 | @@: jif eax,l,[rr.left],.skip |
538 | jif eax,ge,[rr.right],.skip |
538 | jif eax,ge,[rr.right],.skip |
539 | jif ebx,l,[rr.top],.skip |
539 | jif ebx,l,[rr.top],.skip |
540 | jif ebx,ge,[rr.bottom],.skip |
540 | jif ebx,ge,[rr.bottom],.skip |
541 | call get_cursor_rect |
541 | call get_cursor_rect |
542 | call is_intersect_pt |
542 | call is_intersect_pt |
543 | jc .put |
543 | jc .put |
544 | cmp [mouse_invisible],0 |
544 | cmp byte[MOUSE_VISIBLE],0 |
545 | jne .put |
545 | je .put |
546 | call [SF.draw_mouse_under] |
546 | call [SF.draw_mouse_under] |
547 | mov [mouse_invisible],1 |
547 | mov byte[MOUSE_VISIBLE],0 |
548 | .put:;mov [edx],ecx |
548 | .put:;mov [edx],ecx |
549 | ; mov ax,SegA000 {Calculate Offset} |
549 | ; mov ax,SegA000 {Calculate Offset} |
550 | ; mov es,ax |
550 | ; mov es,ax |
551 | ; mov bx,[y] |
551 | ; mov bx,[y] |
552 | mov edi,ebx |
552 | mov edi,ebx |
553 | shl edi,6 ; 80*y |
553 | shl edi,6 ; 80*y |
554 | shl ebx,4 |
554 | shl ebx,4 |
555 | add edi,ebx |
555 | add edi,ebx |
556 | 556 | ||
557 | push ecx |
557 | push ecx |
558 | mov cl,al |
558 | mov cl,al |
559 | shr eax,3 ; /8 |
559 | shr eax,3 ; /8 |
560 | add edi,eax ; 80*y + (x/8) |
560 | add edi,eax ; 80*y + (x/8) |
561 | 561 | ||
562 | and cl,7 ; Get Bit that Changes |
562 | and cl,7 ; Get Bit that Changes |
563 | mov ax,0x8008 |
563 | mov ax,0x8008 |
564 | shr ah,cl |
564 | shr ah,cl |
565 | mov dx,0x03CE |
565 | mov dx,0x03CE |
566 | out dx,ax |
566 | out dx,ax |
567 | add edi,0x000A0000 |
567 | add edi,VGABasePtr |
568 | 568 | ||
569 | call color_24_to_4_bits |
569 | call color_24_to_4_bits |
570 | mov ah,[edi] ; dummy read |
570 | mov ah,[edi] ; dummy read |
571 | mov [edi],al |
571 | mov [edi],al |
572 | 572 | ||
573 | .exit: |
573 | .exit: |
574 | sti |
574 | sti |
575 | popad |
575 | popad |
576 | retn |
576 | retn |
577 | .skip: |
577 | .skip: |
578 | add esi,SR |
578 | add esi,SR |
579 | dec edi |
579 | dec edi |
580 | jnz @b |
580 | jnz @b |
581 | jmp .exit |
581 | jmp .exit |
582 | .forced: |
582 | .forced: |
583 | jif eax,l,[viewport.left],.exit |
583 | jif eax,l,[viewport.left],.exit |
584 | jif ebx,l,[viewport.top],.exit |
584 | jif ebx,l,[viewport.top],.exit |
585 | jif eax,ge,[viewport.right],.exit |
585 | jif eax,ge,[viewport.right],.exit |
586 | jif ebx,ge,[viewport.bottom],.exit |
586 | jif ebx,ge,[viewport.bottom],.exit |
587 | 587 | ||
588 | ; mov ax,SegA000 {Calculate Offset} |
588 | ; mov ax,SegA000 {Calculate Offset} |
589 | ; mov es,ax |
589 | ; mov es,ax |
590 | ; mov bx,[y] |
590 | ; mov bx,[y] |
591 | mov edi,ebx |
591 | mov edi,ebx |
592 | shl edi,6 ; 80*y |
592 | shl edi,6 ; 80*y |
593 | shl ebx,4 |
593 | shl ebx,4 |
594 | add edi,ebx |
594 | add edi,ebx |
595 | 595 | ||
596 | push ecx |
596 | push ecx |
597 | mov cl,al |
597 | mov cl,al |
598 | shr eax,3 ; /8 |
598 | shr eax,3 ; /8 |
599 | add edi,eax ; 80*y + (x/8) |
599 | add edi,eax ; 80*y + (x/8) |
600 | 600 | ||
601 | and cl,7 ; Get Bit that Changes |
601 | and cl,7 ; Get Bit that Changes |
602 | mov ax,0x8008 |
602 | mov ax,0x8008 |
603 | shr ah,cl |
603 | shr ah,cl |
604 | mov dx,0x03CE |
604 | mov dx,0x03CE |
605 | out dx,ax |
605 | out dx,ax |
606 | add edi,0x000A0000 |
606 | add edi,VGABasePtr |
607 | 607 | ||
608 | pop eax |
608 | pop eax |
609 | call color_24_to_4_bits |
609 | call color_24_to_4_bits |
610 | mov ah,[edi] ; dummy read |
610 | mov ah,[edi] ; dummy read |
611 | mov [edi],al |
611 | mov [edi],al |
612 | 612 | ||
613 | sti |
613 | sti |
614 | popad |
614 | popad |
615 | retn |
615 | retn |
616 | endf |
616 | endf |
617 | 617 | ||
618 | ;----------------------------------------------------------------------------- |
618 | ;----------------------------------------------------------------------------- |
619 | func vm_mike_get_pixel.04 ;/////////////////////////////////////////////////// |
619 | func vm_mike_get_pixel.04 ;/////////////////////////////////////////////////// |
620 | ;----------------------------------------------------------------------------- |
620 | ;----------------------------------------------------------------------------- |
621 | ; eax = x coordinate |
621 | ; eax = x coordinate |
622 | ; ebx = y coordinate |
622 | ; ebx = y coordinate |
623 | ;----------------------------------------------------------------------------- |
623 | ;----------------------------------------------------------------------------- |
624 | 624 | ||
625 | clr_table dd \ |
625 | clr_table dd \ |
626 | 0x00000000,0x00000080,0x00008000,0x00008080,\ |
626 | 0x00000000,0x00000080,0x00008000,0x00008080,\ |
627 | 0x00800000,0x00800080,0x00808000,0x00808080,\ |
627 | 0x00800000,0x00800080,0x00808000,0x00808080,\ |
628 | 0x00CCCCCC,0x000000FF,0x0000FF00,0x0000FFFF,\ |
628 | 0x00CCCCCC,0x000000FF,0x0000FF00,0x0000FFFF,\ |
629 | 0x00FF0000,0x00FF00FF,0x00FFFF00,0x00FFFFFF |
629 | 0x00FF0000,0x00FF00FF,0x00FFFF00,0x00FFFFFF |
630 | 630 | ||
631 | begin |
631 | begin |
632 | pushad |
632 | pushad |
633 | cli |
633 | cli |
634 | 634 | ||
635 | mov edi,ebx |
635 | mov edi,ebx |
636 | shl edi,6 ; 80*y |
636 | shl edi,6 ; 80*y |
637 | shl ebx,4 |
637 | shl ebx,4 |
638 | add edi,ebx |
638 | add edi,ebx |
639 | mov cl,al |
639 | mov cl,al |
640 | shr eax,3 ; /8 |
640 | shr eax,3 ; /8 |
641 | add edi,eax ; 80*y + (x/8) |
641 | add edi,eax ; 80*y + (x/8) |
642 | add edi,0x000A0000 |
642 | add edi,VGABasePtr |
643 | 643 | ||
644 | and ecx,7 |
644 | and ecx,7 |
645 | neg ecx |
645 | neg ecx |
646 | add cl,7 |
646 | add cl,7 |
647 | mov dx,0x03CE |
647 | mov dx,0x03CE |
648 | xor bl,bl |
648 | xor bl,bl |
649 | mov ah,3 |
649 | mov ah,3 |
650 | @1: |
650 | @1: |
651 | mov al,4 |
651 | mov al,4 |
652 | out dx,al |
652 | out dx,al |
653 | inc dx |
653 | inc dx |
654 | mov al,ah |
654 | mov al,ah |
655 | out dx,al |
655 | out dx,al |
656 | dec dx |
656 | dec dx |
657 | mov al,[edi] |
657 | mov al,[edi] |
658 | shr al,cl |
658 | shr al,cl |
659 | and al,1 |
659 | and al,1 |
660 | xchg cl,ah |
660 | xchg cl,ah |
661 | shl al,cl |
661 | shl al,cl |
662 | xchg cl,ah |
662 | xchg cl,ah |
663 | or bl,al |
663 | or bl,al |
664 | dec ah |
664 | dec ah |
665 | jns @1 |
665 | jns @1 |
666 | 666 | ||
667 | and ebx,0x0000000F |
667 | and ebx,0x0000000F |
668 | mov eax,[ebx*4+clr_table] |
668 | mov eax,[ebx*4+clr_table] |
669 | mov [esp+4*6],eax |
669 | mov [esp+4*6],eax |
670 | 670 | ||
671 | sti |
671 | sti |
672 | popad |
672 | popad |
673 | retn |
673 | retn |
674 | endf |
674 | endf |
675 | 675 | ||
676 | ;----------------------------------------------------------------------------- |
676 | ;----------------------------------------------------------------------------- |
677 | func vm_mike_put_image.04 ;/////////////////////////////////////////////////// |
677 | func vm_mike_put_image.04 ;/////////////////////////////////////////////////// |
678 | ;----------------------------------------------------------------------------- |
678 | ;----------------------------------------------------------------------------- |
679 | ; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
679 | ; eax(ebx) pointer to image in memory - RRGGBBRRGGBB.. |
680 | ; ebx(ecx) image size [x]*65536+[y] |
680 | ; ebx(ecx) image size [x]*65536+[y] |
681 | ; ecx(edx) image position in window [x]*65536+[y] |
681 | ; ecx(edx) image position in window [x]*65536+[y] |
682 | ; ret: eax 0 succesful, 1 overlapped |
682 | ; ret: eax 0 succesful, 1 overlapped |
683 | ;----------------------------------------------------------------------------- |
683 | ;----------------------------------------------------------------------------- |
684 | begin |
684 | begin |
685 | mov eax,ebx |
685 | mov eax,ebx |
686 | mov ebx,ecx |
686 | mov ebx,ecx |
687 | mov ecx,edx |
687 | mov ecx,edx |
688 | .direct: |
688 | .direct: |
689 | pushad |
689 | pushad |
690 | cli |
690 | cli |
691 | jif ebx,z,0x0000FFFF,.exit,test |
691 | jif ebx,z,0x0000FFFF,.exit,test |
692 | jif ebx,z,0xFFFF0000,.exit,test |
692 | jif ebx,z,0xFFFF0000,.exit,test |
693 | 693 | ||
694 | cld |
694 | cld |
695 | 695 | ||
696 | call get_cursor_rect |
696 | call get_cursor_rect |
697 | 697 | ||
698 | mov ebp,eax |
698 | mov ebp,eax |
699 | movsx eax,word[esp+4*6+2] |
699 | movsx eax,word[esp+4*6+2] |
700 | movsx ebx,word[esp+4*6] |
700 | movsx ebx,word[esp+4*6] |
701 | movsx ecx,word[esp+4*4+2] |
701 | movsx ecx,word[esp+4*4+2] |
702 | movsx edx,word[esp+4*4] |
702 | movsx edx,word[esp+4*4] |
703 | lea edi,[ecx*3] |
703 | lea edi,[ecx*3] |
704 | push edi |
704 | push edi |
705 | add ecx,eax |
705 | add ecx,eax |
706 | add edx,ebx |
706 | add edx,ebx |
707 | mov edi,[0x00003010] |
707 | mov edi,[TASK_BASE] |
708 | movsx esi,word[edi-0x3000+0] |
708 | movsx esi,word[edi-CURRENT_TASK+0] |
709 | add eax,esi |
709 | add eax,esi |
710 | add ecx,esi |
710 | add ecx,esi |
711 | movsx esi,word[edi-0x3000+4] |
711 | movsx esi,word[edi-CURRENT_TASK+4] |
712 | add ebx,esi |
712 | add ebx,esi |
713 | add edx,esi |
713 | add edx,esi |
714 | ; add eax,[esi-0x3000+0] |
714 | ; add eax,[esi-CURRENT_TASK+0] |
715 | ; add ebx,[esi-0x3000+4] |
715 | ; add ebx,[esi-CURRENT_TASK+4] |
716 | ; add ecx,[esi-0x3000+0] |
716 | ; add ecx,[esi-CURRENT_TASK+0] |
717 | ; add edx,[esi-0x3000+4] |
717 | ; add edx,[esi-CURRENT_TASK+4] |
718 | 718 | ||
719 | mov esi,[0x00003000] |
719 | mov esi,[CURRENT_TASK] |
720 | mov esi,[CLIP_RECTS+esi*4] |
720 | mov esi,[CLIP_RECTS+esi*4] |
721 | mov edi,[esi] |
721 | mov edi,[esi] |
722 | or edi,edi |
722 | or edi,edi |
723 | jz .exit |
723 | jz .exit |
724 | add esi,4 |
724 | add esi,4 |
725 | cld |
725 | cld |
726 | .nx: jif ecx,l,[rr.left],.skip |
726 | .nx: jif ecx,l,[rr.left],.skip |
727 | jif eax,ge,[rr.right],.skip |
727 | jif eax,ge,[rr.right],.skip |
728 | jif edx,l,[rr.top],.skip |
728 | jif edx,l,[rr.top],.skip |
729 | jif ebx,ge,[rr.bottom],.skip |
729 | jif ebx,ge,[rr.bottom],.skip |
730 | pushad |
730 | pushad |
731 | jif eax,ge,[rr.left],@f |
731 | jif eax,ge,[rr.left],@f |
732 | mov eax,[rr.left] |
732 | mov eax,[rr.left] |
733 | @@: jif ebx,ge,[rr.top],@f |
733 | @@: jif ebx,ge,[rr.top],@f |
734 | mov ebx,[rr.top] |
734 | mov ebx,[rr.top] |
735 | @@: jif ecx,l,[rr.right],@f |
735 | @@: jif ecx,l,[rr.right],@f |
736 | mov ecx,[rr.right] |
736 | mov ecx,[rr.right] |
737 | @@: jif edx,l,[rr.bottom],@f |
737 | @@: jif edx,l,[rr.bottom],@f |
738 | mov edx,[rr.bottom] |
738 | mov edx,[rr.bottom] |
739 | @@: call is_intersect_rc |
739 | @@: call is_intersect_rc |
740 | jc .put |
740 | jc .put |
741 | cmp [mouse_invisible],0 |
741 | cmp byte[MOUSE_VISIBLE],0 |
742 | jne .put |
742 | je .put |
743 | call [SF.draw_mouse_under] |
743 | call [SF.draw_mouse_under] |
744 | mov [mouse_invisible],1 |
744 | mov byte[MOUSE_VISIBLE],0 |
745 | .put: |
745 | .put: |
746 | mov esi,ebx |
746 | mov esi,ebx |
747 | sub esi,[esp+4*4] |
747 | sub esi,[esp+4*4] |
748 | imul esi,[esp+4*8] |
748 | imul esi,[esp+4*8] |
749 | mov edi,eax |
749 | mov edi,eax |
750 | sub edi,[esp+4*7] |
750 | sub edi,[esp+4*7] |
751 | lea edi,[edi*3] |
751 | lea edi,[edi*3] |
752 | add esi,edi |
752 | add esi,edi |
753 | add esi,ebp |
753 | add esi,ebp |
754 | mov edi,ebx |
754 | mov edi,ebx |
755 | mov ebp,ebx |
755 | mov ebp,ebx |
756 | shl edi,6 ; 80*y |
756 | shl edi,6 ; 80*y |
757 | shl ebp,4 |
757 | shl ebp,4 |
758 | add edi,ebp |
758 | add edi,ebp |
759 | add edi,0x000A0000 |
759 | add edi,VGABasePtr |
760 | .xxx: push eax edx esi edi ebx eax |
760 | .xxx: push eax edx esi edi ebx eax |
761 | or ebp,-1 |
761 | or ebp,-1 |
762 | mov edx,0x03CE |
762 | mov edx,0x03CE |
763 | @@: mov eax,[esp] |
763 | @@: mov eax,[esp] |
764 | push ecx edi |
764 | push ecx edi |
765 | mov cl,al |
765 | mov cl,al |
766 | shr eax,3 ; /8 |
766 | shr eax,3 ; /8 |
767 | add edi,eax ; 80*y + (x/8) |
767 | add edi,eax ; 80*y + (x/8) |
768 | 768 | ||
769 | mov eax,0x8008 |
769 | mov eax,0x8008 |
770 | and cl,7 ; Get Bit that Changes |
770 | and cl,7 ; Get Bit that Changes |
771 | shr ah,cl |
771 | shr ah,cl |
772 | out dx,ax |
772 | out dx,ax |
773 | 773 | ||
774 | lodsd |
774 | lodsd |
775 | dec esi |
775 | dec esi |
776 | and eax,0x00FFFFFF |
776 | and eax,0x00FFFFFF |
777 | cmp eax,ebp |
777 | cmp eax,ebp |
778 | jne .ppp |
778 | jne .ppp |
779 | mov cl,bl |
779 | mov cl,bl |
780 | jmp .ppp.2 |
780 | jmp .ppp.2 |
781 | .ppp: |
781 | .ppp: |
782 | mov ebp,eax |
782 | mov ebp,eax |
783 | call color_24_to_4_bits |
783 | call color_24_to_4_bits |
784 | mov bl,al |
784 | mov bl,al |
785 | .ppp.2: |
785 | .ppp.2: |
786 | mov al,[edi] ; dummy read |
786 | mov al,[edi] ; dummy read |
787 | mov [edi],cl |
787 | mov [edi],cl |
788 | pop edi ecx |
788 | pop edi ecx |
789 | inc dword[esp] |
789 | inc dword[esp] |
790 | cmp [esp],ecx |
790 | cmp [esp],ecx |
791 | jl @b |
791 | jl @b |
792 | pop eax ebx edi esi edx eax |
792 | pop eax ebx edi esi edx eax |
793 | inc ebx |
793 | inc ebx |
794 | add esi,[esp+4*8] |
794 | add esi,[esp+4*8] |
795 | add edi,80 |
795 | add edi,80 |
796 | cmp ebx,edx |
796 | cmp ebx,edx |
797 | jl .xxx |
797 | jl .xxx |
798 | popad |
798 | popad |
799 | .skip: |
799 | .skip: |
800 | add esi,SR |
800 | add esi,SR |
801 | dec edi |
801 | dec edi |
802 | jnz .nx |
802 | jnz .nx |
803 | 803 | ||
804 | .exit: |
804 | .exit: |
805 | add esp,4 |
805 | add esp,4 |
806 | sti |
806 | sti |
807 | popad |
807 | popad |
808 | xor eax,eax |
808 | xor eax,eax |
809 | retn |
809 | retn |
810 | endf |
810 | endf |
811 | 811 | ||
812 | ;----------------------------------------------------------------------------- |
812 | ;----------------------------------------------------------------------------- |
813 | func vm_mike_draw_bg.04 ;///////////////////////////////////////////////////// |
813 | func vm_mike_draw_bg.04 ;///////////////////////////////////////////////////// |
814 | ;----------------------------------------------------------------------------- |
814 | ;----------------------------------------------------------------------------- |
815 | begin |
815 | begin |
816 | pushad |
816 | pushad |
817 | 817 | ||
818 | cmp byte[0x460000-12],1 |
818 | cmp byte[0x460000-12],1 |
819 | je .tiled |
819 | je .tiled |
820 | 820 | ||
821 | mov eax,[viewport.left] |
821 | mov eax,[viewport.left] |
822 | mov ebx,[viewport.top] |
822 | mov ebx,[viewport.top] |
823 | mov ecx,[viewport.right] |
823 | mov ecx,[viewport.right] |
824 | mov edx,[viewport.bottom] |
824 | mov edx,[viewport.bottom] |
825 | mov edi,[0x00300000] |
825 | mov edi,[0x00300000] |
826 | 826 | ||
827 | cli |
827 | cli |
828 | jif eax,e,ecx,.exit |
828 | jif eax,e,ecx,.exit |
829 | jif ebx,e,edx,.exit |
829 | jif ebx,e,edx,.exit |
830 | 830 | ||
831 | call get_cursor_rect |
831 | call get_cursor_rect |
832 | 832 | ||
833 | push eax |
833 | push eax |
834 | mov eax,edi |
834 | mov eax,edi |
835 | call color_24_to_4_bits |
835 | call color_24_to_4_bits |
836 | mov edi,eax |
836 | mov edi,eax |
837 | pop eax |
837 | pop eax |
838 | 838 | ||
839 | mov esi,[CLIP_RECTS+4] |
839 | mov esi,[CLIP_RECTS+4] |
840 | mov ebp,[esi] |
840 | mov ebp,[esi] |
841 | or ebp,ebp |
841 | or ebp,ebp |
842 | jz .exit |
842 | jz .exit |
843 | add esi,4 |
843 | add esi,4 |
844 | .nx: jif ecx,le,[rr.left],.skip |
844 | .nx: jif ecx,le,[rr.left],.skip |
845 | jif eax,ge,[rr.right],.skip |
845 | jif eax,ge,[rr.right],.skip |
846 | jif edx,le,[rr.top],.skip |
846 | jif edx,le,[rr.top],.skip |
847 | jif ebx,ge,[rr.bottom],.skip |
847 | jif ebx,ge,[rr.bottom],.skip |
848 | pushad |
848 | pushad |
849 | jif eax,ge,[rr.left],@f |
849 | jif eax,ge,[rr.left],@f |
850 | mov eax,[rr.left] |
850 | mov eax,[rr.left] |
851 | @@: jif ebx,ge,[rr.top],@f |
851 | @@: jif ebx,ge,[rr.top],@f |
852 | mov ebx,[rr.top] |
852 | mov ebx,[rr.top] |
853 | @@: jif ecx,l,[rr.right],@f |
853 | @@: jif ecx,l,[rr.right],@f |
854 | mov ecx,[rr.right] |
854 | mov ecx,[rr.right] |
855 | @@: jif edx,l,[rr.bottom],@f |
855 | @@: jif edx,l,[rr.bottom],@f |
856 | mov edx,[rr.bottom] |
856 | mov edx,[rr.bottom] |
857 | @@: call is_intersect_rc |
857 | @@: call is_intersect_rc |
858 | jc .put |
858 | jc .put |
859 | cmp [mouse_invisible],0 |
859 | cmp byte[MOUSE_VISIBLE],0 |
860 | jne .put |
860 | je .put |
861 | call [SF.draw_mouse_under] |
861 | call [SF.draw_mouse_under] |
862 | mov [mouse_invisible],1 |
862 | mov byte[MOUSE_VISIBLE],0 |
863 | .put: sub edx,ebx |
863 | .put: sub edx,ebx |
864 | push edx edi ebx eax |
864 | push edx edi ebx eax |
865 | mov edi,ebx |
865 | mov edi,ebx |
866 | shl edi,6 |
866 | shl edi,6 |
867 | shl ebx,4 |
867 | shl ebx,4 |
868 | add edi,ebx |
868 | add edi,ebx |
869 | shr eax,3 |
869 | shr eax,3 |
870 | add edi,eax |
870 | add edi,eax |
871 | add edi,0x000A0000 |
871 | add edi,VGABasePtr |
872 | pop eax ebx |
872 | pop eax ebx |
873 | 873 | ||
874 | mov ebx,eax |
874 | mov ebx,eax |
875 | mov esi,ecx |
875 | mov esi,ecx |
876 | sub esi,eax |
876 | sub esi,eax |
877 | mov dx,0x03CE |
877 | mov dx,0x03CE |
878 | 878 | ||
879 | ;edi = Offset in VMem |
879 | ;edi = Offset in VMem |
880 | ;esi = Length |
880 | ;esi = Length |
881 | ;ebx = x |
881 | ;ebx = x |
882 | ; dx = Graphix Controller |
882 | ; dx = Graphix Controller |
883 | 883 | ||
884 | mov cl,bl ; Get StartBit |
884 | mov cl,bl ; Get StartBit |
885 | and ecx,07h |
885 | and ecx,07h |
886 | 886 | ||
887 | mov eax,esi |
887 | mov eax,esi |
888 | add eax,ecx |
888 | add eax,ecx |
889 | cmp eax,8 ; Is x+Length |
889 | cmp eax,8 ; Is x+Length |
890 | jb .D_One |
890 | jb .D_One |
891 | 891 | ||
892 | mov ax,0xff08 ; 11111111b | BitMask Register |
892 | mov ax,0xff08 ; 11111111b | BitMask Register |
893 | shr ah,cl ; BitMask |
893 | shr ah,cl ; BitMask |
894 | out dx,ax ; Write BitMask |
894 | out dx,ax ; Write BitMask |
895 | push ecx |
895 | push ecx |
896 | mov ah,[esp+4] |
896 | mov ah,[esp+4] |
897 | mov ecx,[esp+4+4] |
897 | mov ecx,[esp+4+4] |
898 | push edi |
898 | push edi |
899 | .D_LL: ; Draw Left of Box |
899 | .D_LL: ; Draw Left of Box |
900 | mov al,[edi] |
900 | mov al,[edi] |
901 | mov [edi],ah |
901 | mov [edi],ah |
902 | add edi,80 ; edi:=edi+80 |
902 | add edi,80 ; edi:=edi+80 |
903 | dec ecx |
903 | dec ecx |
904 | jnz .D_LL |
904 | jnz .D_LL |
905 | pop edi |
905 | pop edi |
906 | inc edi |
906 | inc edi |
907 | pop ecx |
907 | pop ecx |
908 | 908 | ||
909 | mov ax,0xFF08 ; BitMask Register |
909 | mov ax,0xFF08 ; BitMask Register |
910 | out dx,ax ; Write BitMask |
910 | out dx,ax ; Write BitMask |
911 | 911 | ||
912 | mov eax,esi |
912 | mov eax,esi |
913 | mov ch,8 |
913 | mov ch,8 |
914 | sub ch,cl |
914 | sub ch,cl |
915 | movzx ecx,ch |
915 | movzx ecx,ch |
916 | sub eax,ecx |
916 | sub eax,ecx |
917 | shr eax,3 ; Length div 8 |
917 | shr eax,3 ; Length div 8 |
918 | 918 | ||
919 | push edi ebx |
919 | push edi ebx |
920 | mov ebx,[esp+8+4] |
920 | mov ebx,[esp+8+4] |
921 | mov edx,eax |
921 | mov edx,eax |
922 | mov al,[esp+8] |
922 | mov al,[esp+8] |
923 | .D_LC: |
923 | .D_LC: |
924 | mov ecx,edx |
924 | mov ecx,edx |
925 | rep stosb |
925 | rep stosb |
926 | add edi,80 |
926 | add edi,80 |
927 | sub edi,edx |
927 | sub edi,edx |
928 | dec ebx |
928 | dec ebx |
929 | jnz .D_LC |
929 | jnz .D_LC |
930 | pop ebx edi |
930 | pop ebx edi |
931 | add edi,edx |
931 | add edi,edx |
932 | 932 | ||
933 | mov ecx,ebx ; ecx:=x+Length |
933 | mov ecx,ebx ; ecx:=x+Length |
934 | add ecx,esi |
934 | add ecx,esi |
935 | and ecx,07h ; ecx and 07 |
935 | and ecx,07h ; ecx and 07 |
936 | mov ah,0ffh |
936 | mov ah,0ffh |
937 | shr ah,cl ; BitMask |
937 | shr ah,cl ; BitMask |
938 | jz .D_End |
938 | jz .D_End |
939 | 939 | ||
940 | not ah |
940 | not ah |
941 | mov al,8 ; BitMask Register |
941 | mov al,8 ; BitMask Register |
942 | mov dx,03ceh ; Graphics Controller |
942 | mov dx,03ceh ; Graphics Controller |
943 | out dx,ax ; Write BitMask |
943 | out dx,ax ; Write BitMask |
944 | mov ecx,[esp+4] |
944 | mov ecx,[esp+4] |
945 | mov al,[esp] |
945 | mov al,[esp] |
946 | .D_LR: |
946 | .D_LR: |
947 | mov ah,[edi] |
947 | mov ah,[edi] |
948 | mov [edi],al |
948 | mov [edi],al |
949 | add edi,80 |
949 | add edi,80 |
950 | dec ecx |
950 | dec ecx |
951 | jnz .D_LR |
951 | jnz .D_LR |
952 | 952 | ||
953 | jmp .D_End |
953 | jmp .D_End |
954 | 954 | ||
955 | .D_One: |
955 | .D_One: |
956 | mov ah,0ffh |
956 | mov ah,0ffh |
957 | shr ah,cl ; Left BitMask |
957 | shr ah,cl ; Left BitMask |
958 | 958 | ||
959 | add ebx,esi |
959 | add ebx,esi |
960 | dec ebx |
960 | dec ebx |
961 | and ebx,07h |
961 | and ebx,07h |
962 | 962 | ||
963 | mov ecx,7 |
963 | mov ecx,7 |
964 | sub ecx,ebx |
964 | sub ecx,ebx |
965 | 965 | ||
966 | mov bl,0ffh |
966 | mov bl,0ffh |
967 | shl bl,cl ; Right BitMask |
967 | shl bl,cl ; Right BitMask |
968 | 968 | ||
969 | and ah,bl ; Full BitMask |
969 | and ah,bl ; Full BitMask |
970 | mov al,8 ; BitMask Register |
970 | mov al,8 ; BitMask Register |
971 | out dx,ax ; Write BitMask |
971 | out dx,ax ; Write BitMask |
972 | mov ecx,[esp+4] |
972 | mov ecx,[esp+4] |
973 | mov al,[esp] |
973 | mov al,[esp] |
974 | .D_L: |
974 | .D_L: |
975 | mov dl,[edi] ; Fill Latches |
975 | mov dl,[edi] ; Fill Latches |
976 | mov [edi],al ; Write Pixel |
976 | mov [edi],al ; Write Pixel |
977 | add edi,80 |
977 | add edi,80 |
978 | dec ecx |
978 | dec ecx |
979 | jnz .D_L |
979 | jnz .D_L |
980 | .D_End: |
980 | .D_End: |
981 | pop edi |
981 | pop edi |
982 | add esp,4 |
982 | add esp,4 |
983 | popad |
983 | popad |
984 | .skip: |
984 | .skip: |
985 | add esi,SR |
985 | add esi,SR |
986 | dec ebp |
986 | dec ebp |
987 | jnz .nx |
987 | jnz .nx |
988 | 988 | ||
989 | .exit: |
989 | .exit: |
990 | sti |
990 | sti |
991 | popad |
991 | popad |
992 | retn |
992 | retn |
993 | 993 | ||
994 | .tiled: |
994 | .tiled: |
995 | mov eax,bg_address |
995 | mov eax,IMG_BACKGROUND |
996 | mov ebx,[bg_width-2] |
996 | mov ebx,[bg_width-2] |
997 | mov bx,word[bg_height] |
997 | mov bx,word[bg_height] |
998 | xor ecx,ecx |
998 | xor ecx,ecx |
999 | xor edx,edx |
999 | xor edx,edx |
1000 | .lp1: push eax |
1000 | .lp1: push eax |
1001 | call vm_mike_put_image.04.direct |
1001 | call vm_mike_put_image.04.direct |
1002 | pop eax |
1002 | pop eax |
1003 | add edx,[bg_width] |
1003 | add edx,[bg_width] |
1004 | cmp edx,[screen_width] |
1004 | cmp edx,[ScreenWidth] |
1005 | jae @f |
1005 | jae @f |
1006 | shl edx,16 |
1006 | shl edx,16 |
1007 | add ecx,edx |
1007 | add ecx,edx |
1008 | shr edx,16 |
1008 | shr edx,16 |
1009 | jmp .lp1 |
1009 | jmp .lp1 |
1010 | @@: and ecx,0x0000FFFF |
1010 | @@: and ecx,0x0000FFFF |
1011 | xor edx,edx |
1011 | xor edx,edx |
1012 | add ecx,[bg_height] |
1012 | add ecx,[bg_height] |
1013 | cmp ecx,[screen_height] |
1013 | cmp ecx,[ScreenHeight] |
1014 | jb .lp1 |
1014 | jb .lp1 |
1015 | popad |
1015 | popad |
1016 | retn |
1016 | retn |
1017 | endf |
1017 | endf |