Subversion Repositories Kolibri OS

Rev

Rev 129 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

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