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