Subversion Repositories Kolibri OS

Rev

Rev 431 | Rev 473 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 431 Rev 469
Line 1... Line 1...
1
$Revision: 431 $
1
$Revision: 469 $
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
3
;;                                                              ;;
3
;;                                                              ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
4
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;                                                              ;;
6
;;                                                              ;;
Line 55... Line 55...
55
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
55
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
56
        mov     ecx, [edi]
56
     mov     ecx, [edi]
57
        and     ecx, 0xffffff
57
     and     ecx, 0xffffff
58
        ret
58
     ret
Line 59... Line -...
59
 
-
 
60
 
59
 
61
Vesa20_getpixel32:
60
Vesa20_getpixel32:
62
        imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
61
     imul    ebx, [BytesPerScanLine]    ; ebx = y * y multiplier
63
        lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
62
     lea     edi, [ebx+eax*4] ; edi = x*4+(y*y multiplier)
64
        add     edi, [LFBAddress]    ; ebx = where pixel is in memory
63
     add     edi, [LFBAddress]    ; ebx = where pixel is in memory
Line 100... Line 99...
100
; ecx = size [x|y]
99
; ecx = size [x|y]
101
; edx = coordinates [x|y]
100
; edx = coordinates [x|y]
102
; ebp = pointer to 'get' function
101
; ebp = pointer to 'get' function
103
; esi = pointer to 'init' function
102
; esi = pointer to 'init' function
104
; edi = parameter for 'get' function
103
; edi = parameter for 'get' function
-
 
104
 
105
vesa20_putimage:
105
vesa20_putimage:
106
        pushad
106
     pushad
107
        call    [disable_mouse]
107
     call    [disable_mouse]
108
 
-
 
109
        sub     esp, putimg.stack_data
108
     sub     esp, putimg.stack_data
110
 
-
 
111
        ; save pointer to image
109
; save pointer to image
112
        mov     [putimg.pti], ebx
110
     mov     [putimg.pti], ebx
113
 
-
 
114
        ; unpack the size
111
; unpack the size
115
        mov     eax, ecx
112
     mov     eax, ecx
116
        and     ecx, 0xFFFF
113
     and     ecx, 0xFFFF
117
        shr     eax, 16
114
     shr     eax, 16
118
        mov     [putimg.image_sx], eax
115
     mov     [putimg.image_sx], eax
119
        mov     [putimg.image_sy], ecx
116
     mov     [putimg.image_sy], ecx
120
 
-
 
121
        ; unpack the coordinates
117
; unpack the coordinates
122
        mov     eax, edx
118
     mov     eax, edx
123
        and     edx, 0xFFFF
119
     and     edx, 0xFFFF
124
        shr     eax, 16
120
     shr     eax, 16
125
        mov     [putimg.image_cx], eax
121
     mov     [putimg.image_cx], eax
126
        mov     [putimg.image_cy], edx
122
     mov     [putimg.image_cy], edx
127
 
-
 
128
        ; calculate absolute (i.e. screen) coordinates
123
; calculate absolute (i.e. screen) coordinates
129
        mov     eax, [TASK_BASE]
124
     mov     eax, [TASK_BASE]
130
        mov     ebx, [eax-twdw + WDATA.box.left]
125
     mov     ebx, [eax-twdw + WDATA.box.left]
131
        add     ebx, [putimg.image_cx]
126
     add     ebx, [putimg.image_cx]
132
        mov     [putimg.abs_cx], ebx
127
     mov     [putimg.abs_cx], ebx
133
        mov     ebx, [eax-twdw + WDATA.box.top]
128
     mov     ebx, [eax-twdw + WDATA.box.top]
134
        add     ebx, [putimg.image_cy]
129
     add     ebx, [putimg.image_cy]
135
        mov     [putimg.abs_cy], ebx
130
     mov     [putimg.abs_cy], ebx
136
 
-
 
137
        ; real_sx = MIN(wnd_sx-image_cx, image_sx);
131
; real_sx = MIN(wnd_sx-image_cx, image_sx);
138
        mov     ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
132
     mov     ebx, [eax-twdw + WDATA.box.width] ; ebx = wnd_sx
139
; \begin{diamond}[20.08.2006]
133
; \begin{diamond}[20.08.2006]
140
; note that WDATA.box.width is one pixel less than real window x-size
134
; note that WDATA.box.width is one pixel less than real window x-size
141
        inc     ebx
135
     inc     ebx
Line 149... Line 143...
149
        cmp     ebx, [putimg.image_sx]
143
     cmp     ebx, [putimg.image_sx]
150
        jbe     .end_x
144
     jbe     .end_x
151
        mov     ebx, [putimg.image_sx]
145
     mov     ebx, [putimg.image_sx]
152
      .end_x:
146
.end_x:
153
        mov     [putimg.real_sx], ebx
147
     mov     [putimg.real_sx], ebx
154
 
-
 
155
        ; init real_sy
148
; init real_sy
156
        mov     ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
149
     mov     ebx, [eax-twdw + WDATA.box.height] ; ebx = wnd_sy
157
; \begin{diamond}[20.08.2006]
150
; \begin{diamond}[20.08.2006]
158
        inc     ebx
151
     inc     ebx
159
; \end{diamond}[20.08.2006]
152
; \end{diamond}[20.08.2006]
Line 166... Line 159...
166
        cmp     ebx, [putimg.image_sy]
159
     cmp     ebx, [putimg.image_sy]
167
        jbe     .end_y
160
     jbe     .end_y
168
        mov     ebx, [putimg.image_sy]
161
     mov     ebx, [putimg.image_sy]
169
      .end_y:
162
.end_y:
170
        mov     [putimg.real_sy], ebx
163
     mov     [putimg.real_sy], ebx
171
 
-
 
172
        ; line increment
164
; line increment
173
        mov     eax, [putimg.image_sx]
165
     mov     eax, [putimg.image_sx]
174
        sub     eax, [putimg.real_sx]
166
     sub     eax, [putimg.real_sx]
175
;;        imul    eax, [putimg.source_bpp]
167
;;     imul    eax, [putimg.source_bpp]
176
;        lea     eax, [eax + eax * 2]
168
;     lea     eax, [eax + eax * 2]
177
        call    esi
169
     call    esi
178
        add     eax, [putimg.arg_0]
170
     add     eax, [putimg.arg_0]
179
        mov     [putimg.line_increment], eax
171
     mov     [putimg.line_increment], eax
180
 
-
 
181
        ; winmap new line increment
172
; winmap new line increment
182
        mov     eax, [ScreenWidth]
173
     mov     eax, [ScreenWidth]
183
        inc     eax
174
     inc     eax
184
        sub     eax, [putimg.real_sx]
175
     sub     eax, [putimg.real_sx]
185
        mov     [putimg.winmap_newline], eax
176
     mov     [putimg.winmap_newline], eax
186
 
-
 
187
        ; screen new line increment
177
; screen new line increment
188
        mov     eax, [BytesPerScanLine]
178
     mov     eax, [BytesPerScanLine]
189
        mov     ecx, [putimg.real_sx]
179
     mov     ecx, [putimg.real_sx]
190
        movzx   ebx, byte [ScreenBPP]
180
     movzx   ebx, byte [ScreenBPP]
191
        shr     ebx, 3
181
     shr     ebx, 3
192
        imul    ecx, ebx
182
     imul    ecx, ebx
193
        sub     eax, ecx
183
     sub     eax, ecx
194
        mov     [putimg.screen_newline], eax
184
     mov     [putimg.screen_newline], eax
195
 
-
 
196
        ; pointer to image
185
; pointer to image
197
        mov     esi, [putimg.pti]
186
     mov     esi, [putimg.pti]
198
 
-
 
199
        ; pointer to screen
187
; pointer to screen
200
        mov     edx, [putimg.abs_cy]
188
     mov     edx, [putimg.abs_cy]
201
        imul    edx, [BytesPerScanLine]
189
     imul    edx, [BytesPerScanLine]
202
        mov     eax, [putimg.abs_cx]
190
     mov     eax, [putimg.abs_cx]
203
        movzx   ebx, byte [ScreenBPP]
191
     movzx   ebx, byte [ScreenBPP]
204
        shr     ebx, 3
192
     shr     ebx, 3
205
        imul    eax, ebx
193
     imul    eax, ebx
206
        add     edx, eax
194
     add     edx, eax
207
        add     edx, [LFBAddress]
195
     add     edx, [LFBAddress]
208
 
-
 
209
        ; pointer to pixel map
196
; pointer to pixel map
210
        mov     eax, [putimg.abs_cy]
197
     mov     eax, [putimg.abs_cy]
211
        imul    eax, [ScreenWidth]
198
     imul    eax, [ScreenWidth]
212
        add     eax, [putimg.abs_cy]
199
     add     eax, [putimg.abs_cy]
213
        add     eax, [putimg.abs_cx]
200
     add     eax, [putimg.abs_cx]
214
        add     eax, WinMapAddress
201
     add     eax, WinMapAddress
215
        xchg    eax, ebp
202
     xchg    eax, ebp
216
 
-
 
217
        ; get process number
203
; get process number
218
        mov     ebx, [CURRENT_TASK]
204
     mov     ebx, [CURRENT_TASK]
219
 
-
 
220
        cmp     byte [ScreenBPP], 32
205
     cmp     byte [ScreenBPP], 32
221
        je      put_image_end_32
206
     je      put_image_end_32
222
 
-
 
223
;put_image_end_24:
207
;put_image_end_24:
224
        mov     edi, [putimg.real_sy]
208
     mov     edi, [putimg.real_sy]
225
        align   4
209
align   4
226
      .new_line:
210
.new_line:
227
        mov     ecx, [putimg.real_sx]
211
     mov     ecx, [putimg.real_sx]
228
 
-
 
229
;        push    ebp edx
212
;     push    ebp edx
230
        align   4
213
align   4
231
          .new_x:
214
.new_x:
232
 
-
 
233
                push    [putimg.edi]
215
     push    [putimg.edi]
234
                mov     eax, [putimg.ebp+4]
216
     mov     eax, [putimg.ebp+4]
235
                call    eax
217
     call    eax
236
                cmp     [ebp], bl
218
     cmp     [ebp], bl
237
                jne     .skip
219
     jne     .skip
238
;                mov     eax, [esi]        ; eax = RRBBGGRR
220
;     mov     eax, [esi]        ; eax = RRBBGGRR
239
                mov     [edx], ax
221
     mov     [edx], ax
240
                shr     eax, 16
222
     shr     eax, 16
241
                mov     [edx+2], al
223
     mov     [edx+2], al
242
              .skip:
224
.skip:
243
 
-
 
244
;            add     esi, 3 ;[putimg.source_bpp]
225
;     add     esi, 3 ;[putimg.source_bpp]
245
            add     edx, 3
226
     add     edx, 3
246
            inc     ebp
227
     inc     ebp
247
 
-
 
248
            dec     ecx
228
     dec     ecx
249
            jnz     .new_x
229
     jnz     .new_x
250
;        pop     edx ebp
230
;     pop     edx ebp
251
 
-
 
252
        add     esi, [putimg.line_increment]
231
     add     esi, [putimg.line_increment]
253
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
232
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
254
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
233
     add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
255
        ;inc     ebp
234
;     inc     ebp
256
 
-
 
257
        dec     edi
235
     dec     edi
258
        jnz     .new_line
236
     jnz     .new_line
259
   .finish:
237
.finish:
260
        add     esp, putimg.stack_data
238
     add     esp, putimg.stack_data
261
        popad
239
     popad
Line 264... Line 242...
264
put_image_end_32:
242
put_image_end_32:
265
        mov     edi, [putimg.real_sy]
243
     mov     edi, [putimg.real_sy]
266
        align   4
244
align   4
267
      .new_line:
245
.new_line:
268
        mov     ecx, [putimg.real_sx]
246
     mov     ecx, [putimg.real_sx]
269
 
-
 
270
;        push    ebp edx
247
;     push    ebp edx
271
        align   4
248
align   4
272
          .new_x:
249
.new_x:
273
 
-
 
274
                push    [putimg.edi]
250
     push    [putimg.edi]
275
                mov     eax, [putimg.ebp+4]
251
     mov     eax, [putimg.ebp+4]
276
                call    eax
252
     call    eax
277
                cmp     [ebp], bl
253
     cmp     [ebp], bl
278
                jne     .skip
254
     jne     .skip
279
;                mov     eax, [esi]        ; ecx = RRBBGGRR
255
;     mov     eax, [esi]        ; ecx = RRBBGGRR
280
                mov     [edx], eax
256
     mov     [edx], eax
281
              .skip:
257
.skip:
282
 
-
 
283
;            add     esi, [putimg.source_bpp]
258
;     add     esi, [putimg.source_bpp]
284
            add     edx, 4
259
     add     edx, 4
285
            inc     ebp
260
     inc     ebp
286
 
-
 
287
            dec     ecx
261
     dec     ecx
288
            jnz     .new_x
262
     jnz     .new_x
289
;        pop     edx ebp
263
;     pop     edx ebp
290
 
-
 
291
        add     esi, [putimg.line_increment]
264
     add     esi, [putimg.line_increment]
292
        add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
265
     add     edx, [putimg.screen_newline] ;[BytesPerScanLine]
293
        add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
266
     add     ebp, [putimg.winmap_newline] ;[ScreenWidth]
294
        ;inc     ebp
267
;     inc     ebp
295
 
-
 
296
        dec     edi
268
     dec     edi
297
        jnz     .new_line
269
     jnz     .new_line
298
   .finish:
270
.finish:
299
        add     esp, putimg.stack_data
271
     add     esp, putimg.stack_data
300
        popad
272
     popad
Line 311... Line 283...
311
; ebx = y coordinate
283
; ebx = y coordinate
312
; ecx = ?? RR GG BB    ; 0x01000000 negation
284
; ecx = ?? RR GG BB    ; 0x01000000 negation
313
; edi = 0x00000001 force
285
; edi = 0x00000001 force
Line 314... Line 286...
314
 
286
 
315
;;;        mov  [novesachecksum], dword 0
-
 
316
 
287
;;;        mov  [novesachecksum], dword 0
317
        pushad
288
     pushad
318
        test  edi,1                 ; force ?
289
     test  edi,1                 ; force ?
319
        jnz   .forced
290
     jnz   .forced
320
      ; not forced:
291
; not forced:
Line 338... Line 309...
338
      .noneg:
309
.noneg:
339
        ; OK to set pixel
310
; OK to set pixel
340
        call  dword [PUTPIXEL]    ; call the real put_pixel function
311
     call  dword [PUTPIXEL]    ; call the real put_pixel function
341
      .exit:
312
.exit:
342
        popad
313
     popad
343
 
-
 
344
        ret
314
     ret
Line 345... Line 315...
345
 
315
 
346
align 4
316
align 4
347
Vesa20_putpixel24:
-
 
348
 
317
Vesa20_putpixel24:
349
        ; eax = x
318
; eax = x
350
        ; ebx = y
-
 
351
 
319
; ebx = y
352
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
320
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
353
        lea     edi, [eax+eax*2]  ; edi = x*3
321
     lea     edi, [eax+eax*2]  ; edi = x*3
354
        mov     eax, [esp+32-8+4]
322
     mov     eax, [esp+32-8+4]
355
        add     edi, [LFBAddress]
323
     add     edi, [LFBAddress]
356
        add     edi, ebx          ; ebx = where to put pixel in memory
324
     add     edi, ebx          ; ebx = where to put pixel in memory
357
        mov     [edi], ax
325
     mov     [edi], ax
358
        shr     eax, 16
326
     shr     eax, 16
359
        mov     [edi+2], al
-
 
360
 
327
     mov     [edi+2], al
Line 361... Line 328...
361
        ret
328
     ret
362
 
329
 
363
 
-
 
364
align 4
330
 
365
Vesa20_putpixel32:
331
align 4
366
 
-
 
367
        ; eax = x
332
Vesa20_putpixel32:
368
        ; ebx = y
333
; eax = x
369
 
334
; ebx = y
370
        imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
335
     imul    ebx, [BytesPerScanLine]     ; ebx = y * y multiplier
371
        lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
336
     lea     edi, [ebx+eax*4]  ; edi = x*4+(y*y multiplier)
372
        mov     eax, [esp+32-8+4] ; eax = color
-
 
373
        add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
337
     mov     eax, [esp+32-8+4] ; eax = color
Line 374... Line -...
374
        mov     [edi], eax
-
 
375
 
338
     add     edi, [LFBAddress]     ; ebx = where to put pixel in memory
Line 376... Line 339...
376
        ret
339
     mov     [edi], eax
377
 
340
     ret
378
 
341
 
Line 416... Line 379...
416
        xor     ebp, ebp
379
     xor     ebp, ebp
417
        mov     si, ax        ; esi = x2
380
     mov     si, ax        ; esi = x2
418
        mov     bp, bx        ; ebp = y2
381
     mov     bp, bx        ; ebp = y2
419
        shr     eax, 16       ; eax = x1
382
     shr     eax, 16       ; eax = x1
420
        shr     ebx, 16       ; ebx = y1
383
     shr     ebx, 16       ; ebx = y1
421
 
-
 
422
        push    eax           ; save x1
384
     push    eax           ; save x1
423
        push    ebx           ; save y1
385
     push    ebx           ; save y1
424
        push    esi           ; save x2
386
     push    esi           ; save x2
425
        push    ebp           ; save y2
387
     push    ebp           ; save y2
426
 
-
 
427
        ; checking x-axis...
388
; checking x-axis...
428
        sub     esi, eax      ; esi = x2-x1
389
     sub     esi, eax      ; esi = x2-x1
429
        push    esi           ; save y2-y1
390
     push    esi           ; save y2-y1
430
        jl      .x2lx1        ; is x2 less than x1 ?
391
     jl      .x2lx1        ; is x2 less than x1 ?
431
        jg      .no_vline     ; x1 > x2 ?
392
     jg      .no_vline     ; x1 > x2 ?
Line 434... Line 395...
434
        push    edx    ; necessary to rightly restore stack frame at .exit
395
     push    edx    ; necessary to rightly restore stack frame at .exit
435
        jmp     .exit
396
     jmp     .exit
436
.x2lx1:
397
.x2lx1:
437
        neg     esi            ; get esi absolute value
398
     neg     esi            ; get esi absolute value
438
.no_vline:
399
.no_vline:
439
 
-
 
440
        ; checking y-axis...
400
; checking y-axis...
441
        sub     ebp, ebx       ; ebp = y2-y1
401
     sub     ebp, ebx       ; ebp = y2-y1
442
        push    ebp            ; save y2-y1
402
     push    ebp            ; save y2-y1
443
        jl      .y2ly1         ; is y2 less than y1 ?
403
     jl      .y2ly1         ; is y2 less than y1 ?
444
        jg      .no_hline      ; y1 > y2 ?
404
     jg      .no_hline      ; y1 > y2 ?
445
        mov     edx, [dl_x2]   ; else (if y1=y2)
405
     mov     edx, [dl_x2]   ; else (if y1=y2)
446
        call    hline
406
     call    hline
447
        jmp     .exit
407
     jmp     .exit
-
 
408
 
448
.y2ly1:
409
.y2ly1:
449
        neg     ebp            ; get ebp absolute value
410
     neg     ebp            ; get ebp absolute value
450
.no_hline:
411
.no_hline:
451
 
-
 
452
 
-
 
453
        cmp     ebp, esi
412
     cmp     ebp, esi
454
        jle     .x_rules       ; |y2-y1| < |x2-x1|  ?
413
     jle     .x_rules       ; |y2-y1| < |x2-x1|  ?
455
 
-
 
456
        cmp     [dl_y2], ebx   ; make sure y1 is at the begining
414
     cmp     [dl_y2], ebx   ; make sure y1 is at the begining
457
        jge     .no_reverse1
415
     jge     .no_reverse1
458
 
-
 
459
        neg     dword [dl_dx]
416
     neg     dword [dl_dx]
460
        mov     edx, [dl_x2]
417
     mov     edx, [dl_x2]
461
        mov     [dl_x2], eax
418
     mov     [dl_x2], eax
462
        mov     [dl_x1], edx
419
     mov     [dl_x1], edx
463
        mov     edx, [dl_y2]
420
     mov     edx, [dl_y2]
464
        mov     [dl_y2], ebx
421
     mov     [dl_y2], ebx
465
        mov     [dl_y1], edx
422
     mov     [dl_y1], edx
466
 
-
 
467
.no_reverse1:
423
.no_reverse1:
468
 
-
 
469
        mov     eax, [dl_dx]
424
     mov     eax, [dl_dx]
470
        cdq                    ; extend eax sing to edx
425
     cdq                    ; extend eax sing to edx
471
        shl     eax, 16        ; using 16bit fix-point maths
426
     shl     eax, 16        ; using 16bit fix-point maths
472
        idiv    ebp            ; eax = ((x2-x1)*65536)/(y2-y1)
427
     idiv    ebp            ; eax = ((x2-x1)*65536)/(y2-y1)
473
        mov     edx, ebp       ; edx = counter (number of pixels to draw)
428
     mov     edx, ebp       ; edx = counter (number of pixels to draw)
474
        mov     ebp, 1 *65536  ; <<16   ; ebp = dy = 1.0
429
     mov     ebp, 1 *65536  ; <<16   ; ebp = dy = 1.0
475
        mov     esi, eax       ; esi = dx
430
     mov     esi, eax       ; esi = dx
476
 
-
 
477
        jmp     .y_rules
431
     jmp     .y_rules
478
.x_rules:
-
 
Line -... Line 432...
-
 
432
 
479
 
433
.x_rules:
480
        cmp     [dl_x2], eax    ; make sure x1 is at the begining
434
     cmp     [dl_x2], eax    ; make sure x1 is at the begining
481
        jge     .no_reverse2
-
 
482
 
435
     jge     .no_reverse2
483
        neg     dword [dl_dy]
436
     neg     dword [dl_dy]
484
        mov     edx, [dl_x2]
437
     mov     edx, [dl_x2]
485
        mov     [dl_x2], eax
438
     mov     [dl_x2], eax
486
        mov     [dl_x1], edx
439
     mov     [dl_x1], edx
487
        mov     edx, [dl_y2]
440
     mov     edx, [dl_y2]
488
        mov     [dl_y2], ebx
441
     mov     [dl_y2], ebx
489
        mov     [dl_y1], edx
-
 
490
 
442
     mov     [dl_y1], edx
491
.no_reverse2:
-
 
492
 
443
.no_reverse2:
493
        xor     edx, edx
444
     xor     edx, edx
494
        mov     eax, [dl_dy]
445
     mov     eax, [dl_dy]
495
        cdq                    ; extend eax sing to edx
446
     cdq                    ; extend eax sing to edx
496
        shl     eax, 16        ; using 16bit fix-point maths
447
     shl     eax, 16        ; using 16bit fix-point maths
497
        idiv    esi            ; eax = ((y2-y1)*65536)/(x2-x1)
448
     idiv    esi            ; eax = ((y2-y1)*65536)/(x2-x1)
498
        mov     edx, esi       ; edx = counter (number of pixels to draw)
449
     mov     edx, esi       ; edx = counter (number of pixels to draw)
499
        mov     esi, 1 *65536  ;<< 16   ; esi = dx = 1.0
450
     mov     esi, 1 *65536  ;<< 16   ; esi = dx = 1.0
500
        mov     ebp, eax       ; ebp = dy
-
 
501
 
451
     mov     ebp, eax       ; ebp = dy
502
.y_rules:
-
 
503
 
452
.y_rules:
504
        mov     eax, [dl_x1]
453
     mov     eax, [dl_x1]
505
        mov     ebx, [dl_y1]
454
     mov     ebx, [dl_y1]
506
        shl     eax, 16
455
     shl     eax, 16
507
        shl     ebx, 16
-
 
508
 
456
     shl     ebx, 16
509
align 4
-
 
510
 
457
align 4
511
.draw:
458
.draw:
512
        push    eax ebx
459
     push    eax ebx
513
        shr     eax, 16
460
     shr     eax, 16
514
        shr     ebx, 16
461
     shr     ebx, 16
515
        call    [putpixel]
462
     call    [putpixel]
516
        pop     ebx eax
-
 
517
 
463
     pop     ebx eax
518
        add     ebx, ebp        ; y = y+dy
464
     add     ebx, ebp        ; y = y+dy
519
        add     eax, esi        ; x = x+dx
-
 
520
 
465
     add     eax, esi        ; x = x+dx
521
        dec     edx
466
     dec     edx
522
        jnz     .draw
-
 
523
 
467
     jnz     .draw
524
        ; force last drawn pixel to be at (x2,y2)
468
; force last drawn pixel to be at (x2,y2)
525
        mov     eax, [dl_x2]
469
     mov     eax, [dl_x2]
526
        mov     ebx, [dl_y2]
470
     mov     ebx, [dl_y2]
527
        call    [putpixel]
471
     call    [putpixel]
Line 539... Line 483...
539
; edx = x2
483
; edx = x2
540
; ebx = y
484
; ebx = y
541
; ecx = color
485
; ecx = color
542
; edi = force ?
486
; edi = force ?
543
        push    eax edx
487
     push    eax edx
544
 
-
 
545
        cmp     edx, eax      ; make sure x2 is above x1
488
     cmp     edx, eax      ; make sure x2 is above x1
546
        jge     @f
489
     jge     @f
547
        xchg    eax, edx
490
     xchg    eax, edx
548
        align   4
491
align   4
549
   @@:
492
@@:
550
        call    [putpixel]
493
     call    [putpixel]
551
        inc     eax
494
     inc     eax
552
        cmp     eax, edx
495
     cmp     eax, edx
553
        jle     @b
496
     jle     @b
554
 
-
 
555
        pop     edx eax
497
     pop     edx eax
556
ret
498
     ret
Line 557... Line 499...
557
 
499
 
Line 562... Line 504...
562
; ebx = y1
504
; ebx = y1
563
; edx = y2
505
; edx = y2
564
; ecx = color
506
; ecx = color
565
; edi = force ?
507
; edi = force ?
566
        push    ebx edx
508
     push    ebx edx
567
 
-
 
568
        cmp     edx, ebx      ; make sure y2 is above y1
509
     cmp     edx, ebx      ; make sure y2 is above y1
569
        jge     @f
510
     jge     @f
570
        xchg    ebx, edx
511
     xchg    ebx, edx
571
        align   4
512
align   4
572
   @@:
513
@@:
573
        call    [putpixel]
514
     call    [putpixel]
574
        inc     ebx
515
     inc     ebx
575
        cmp     ebx, edx
516
     cmp     ebx, edx
576
        jle     @b
517
     jle     @b
577
 
-
 
578
        pop     edx ebx
518
     pop     edx ebx
579
ret
519
     ret
Line 580... Line 520...
580
 
520
 
Line 603... Line 543...
603
; ebx   cy
543
; ebx   cy
604
; ecx   xe
544
; ecx   xe
605
; edx   ye
545
; edx   ye
606
; edi   color
546
; edi   color
607
vesa20_drawbar:
547
vesa20_drawbar:
608
 
-
 
609
        pushad
548
     pushad
610
        call    [disable_mouse]
549
     call    [disable_mouse]
611
 
-
 
612
        sub     esp, drbar.stack_data
550
     sub     esp, drbar.stack_data
613
 
-
 
614
        mov     [drbar.color], edi
551
     mov     [drbar.color], edi
615
 
-
 
616
        sub     edx, ebx
552
     sub     edx, ebx
617
        jle     .exit          ;// mike.dld, 2005-01-29
553
     jle     .exit          ;// mike.dld, 2005-01-29
618
        sub     ecx, eax
554
     sub     ecx, eax
619
        jle     .exit          ;// mike.dld, 2005-01-29
555
     jle     .exit          ;// mike.dld, 2005-01-29
620
        mov     [drbar.bar_sy], edx
556
     mov     [drbar.bar_sy], edx
621
        mov     [drbar.bar_sx], ecx
557
     mov     [drbar.bar_sx], ecx
622
 
-
 
623
        mov     [drbar.bar_cx], eax
558
     mov     [drbar.bar_cx], eax
624
        mov     [drbar.bar_cy], ebx
559
     mov     [drbar.bar_cy], ebx
625
 
-
 
626
        mov     edi, [TASK_BASE]
560
     mov     edi, [TASK_BASE]
627
        add     eax, [edi-twdw + WDATA.box.left] ; win_cx
561
     add     eax, [edi-twdw + WDATA.box.left] ; win_cx
628
        add     ebx, [edi-twdw + WDATA.box.top] ; win_cy
562
     add     ebx, [edi-twdw + WDATA.box.top] ; win_cy
629
        mov     [drbar.abs_cx], eax
563
     mov     [drbar.abs_cx], eax
630
        mov     [drbar.abs_cy], ebx
564
     mov     [drbar.abs_cy], ebx
631
 
-
 
632
        ; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
565
; real_sx = MIN(wnd_sx-bar_cx, bar_sx);
633
        mov     ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
566
     mov     ebx, [edi-twdw + WDATA.box.width] ; ebx = wnd_sx
634
; \begin{diamond}[20.08.2006]
567
; \begin{diamond}[20.08.2006]
635
; note that WDATA.box.width is one pixel less than real window x-size
568
; note that WDATA.box.width is one pixel less than real window x-size
636
        inc     ebx
569
     inc     ebx
Line 640... Line 573...
640
  .exit:                       ;// mike.dld, 2005-01-29
573
.exit:                       ;// mike.dld, 2005-01-29
641
        add     esp, drbar.stack_data
574
     add     esp, drbar.stack_data
642
        popad
575
     popad
643
        xor     eax, eax
576
     xor     eax, eax
644
        inc     eax
577
     inc     eax
645
 
-
 
646
        ret
578
     ret
647
      @@:
579
@@:
648
        cmp     ebx, [drbar.bar_sx]
580
     cmp     ebx, [drbar.bar_sx]
649
        jbe     .end_x
581
     jbe     .end_x
650
        mov     ebx, [drbar.bar_sx]
582
     mov     ebx, [drbar.bar_sx]
651
      .end_x:
583
.end_x:
652
        mov     [drbar.real_sx], ebx
584
     mov     [drbar.real_sx], ebx
653
 
-
 
654
        ; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
585
; real_sy = MIN(wnd_sy-bar_cy, bar_sy);
655
        mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
586
     mov     ebx, [edi-twdw + WDATA.box.height] ; ebx = wnd_sy
656
; \begin{diamond}[20.08.2006]
587
; \begin{diamond}[20.08.2006]
657
        inc     ebx
588
     inc     ebx
658
; \end{diamond}
589
; \end{diamond}
Line 660... Line 591...
660
        ja      @f
591
     ja      @f
661
        add     esp, drbar.stack_data
592
     add     esp, drbar.stack_data
662
        popad
593
     popad
663
        xor     eax, eax
594
     xor     eax, eax
664
        inc     eax
595
     inc     eax
665
 
-
 
666
        ret
596
     ret
667
      @@:
597
@@:
668
        cmp     ebx, [drbar.bar_sy]
598
     cmp     ebx, [drbar.bar_sy]
669
        jbe     .end_y
599
     jbe     .end_y
670
        mov     ebx, [drbar.bar_sy]
600
     mov     ebx, [drbar.bar_sy]
671
      .end_y:
601
.end_y:
672
        mov     [drbar.real_sy], ebx
602
     mov     [drbar.real_sy], ebx
673
 
-
 
674
        ; line_inc_map
603
; line_inc_map
675
        mov     eax, [ScreenWidth]
604
     mov     eax, [ScreenWidth]
676
        sub     eax, [drbar.real_sx]
605
     sub     eax, [drbar.real_sx]
677
        inc     eax
606
     inc     eax
678
        mov     [drbar.line_inc_map], eax
607
     mov     [drbar.line_inc_map], eax
679
 
-
 
680
        ; line_inc_scr
608
; line_inc_scr
681
        mov     eax, [drbar.real_sx]
609
     mov     eax, [drbar.real_sx]
682
        movzx   ebx, byte [ScreenBPP]
610
     movzx   ebx, byte [ScreenBPP]
683
        shr     ebx, 3
611
     shr     ebx, 3
684
        imul    eax, ebx
612
     imul    eax, ebx
685
        neg     eax
613
     neg     eax
686
        add     eax, [BytesPerScanLine]
614
     add     eax, [BytesPerScanLine]
687
        mov     [drbar.line_inc_scr], eax
615
     mov     [drbar.line_inc_scr], eax
688
 
-
 
689
        ; pointer to screen
616
; pointer to screen
690
        mov     edx, [drbar.abs_cy]
617
     mov     edx, [drbar.abs_cy]
691
        imul    edx, [BytesPerScanLine]
618
     imul    edx, [BytesPerScanLine]
692
        mov     eax, [drbar.abs_cx]
619
     mov     eax, [drbar.abs_cx]
693
;        movzx   ebx, byte [ScreenBPP]
620
;     movzx   ebx, byte [ScreenBPP]
694
;        shr     ebx, 3
621
;     shr     ebx, 3
695
        imul    eax, ebx
622
     imul    eax, ebx
696
        add     edx, eax
623
     add     edx, eax
697
        add     edx, [LFBAddress]
624
     add     edx, [LFBAddress]
698
 
-
 
699
        ; pointer to pixel map
625
; pointer to pixel map
700
        mov     eax, [drbar.abs_cy]
626
     mov     eax, [drbar.abs_cy]
701
        imul    eax, [ScreenWidth]
627
     imul    eax, [ScreenWidth]
702
        add     eax, [drbar.abs_cy]
628
     add     eax, [drbar.abs_cy]
703
        add     eax, [drbar.abs_cx]
629
     add     eax, [drbar.abs_cx]
704
        add     eax, WinMapAddress
630
     add     eax, WinMapAddress
705
        xchg    eax, ebp
631
     xchg    eax, ebp
706
 
-
 
707
        ; get process number
632
; get process number
708
        mov     ebx, [CURRENT_TASK]
633
     mov     ebx, [CURRENT_TASK]
709
 
-
 
710
        cmp     byte [ScreenBPP], 24
634
     cmp     byte [ScreenBPP], 24
711
        jne     draw_bar_end_32
635
     jne     draw_bar_end_32
712
draw_bar_end_24:
636
draw_bar_end_24:
713
        mov     eax, [drbar.color]    ;; BBGGRR00
637
     mov     eax, [drbar.color]    ;; BBGGRR00
714
        mov     bh, al                ;; bh  = BB
638
     mov     bh, al                ;; bh  = BB
Line 718... Line 642...
718
; bh - color low    BB
642
; bh - color low    BB
719
; ecx - temp
643
; ecx - temp
720
; edx - pointer to screen
644
; edx - pointer to screen
721
; esi - counter
645
; esi - counter
722
; edi - counter
646
; edi - counter
723
 
-
 
724
        mov     esi, [drbar.real_sy]
647
     mov     esi, [drbar.real_sy]
725
        align   4
648
align   4
726
     .new_y:
649
.new_y:
727
        mov     edi, [drbar.real_sx]
650
     mov     edi, [drbar.real_sx]
728
        align   4
651
align   4
729
     .new_x:
652
.new_x:
730
 
-
 
731
        cmp     byte [ebp], bl
653
     cmp     byte [ebp], bl
732
        jne     .skip
654
     jne     .skip
733
        mov     [edx], bh
655
     mov     [edx], bh
734
        mov     [edx + 1], ax
656
     mov     [edx + 1], ax
735
      .skip:
657
.skip:
736
 
-
 
737
        ; add pixel
658
; add pixel
738
        add     edx, 3
659
     add     edx, 3
739
        inc     ebp
660
     inc     ebp
740
 
-
 
741
        dec     edi
661
     dec     edi
742
        jnz     .new_x
662
     jnz     .new_x
743
 
-
 
744
        ; add line
663
; add line
745
        add     edx, [drbar.line_inc_scr]
664
     add     edx, [drbar.line_inc_scr]
746
        add     ebp, [drbar.line_inc_map]
665
     add     ebp, [drbar.line_inc_map]
747
 
-
 
748
    ;  drawing gradient bars
666
;  drawing gradient bars
749
        test    eax, 0x00800000
667
     test    eax, 0x00800000
750
        jz      @f
668
     jz      @f
751
        test    bh, bh
669
     test    bh, bh
752
        jz      @f
670
     jz      @f
753
        dec     bh
671
     dec     bh
754
      @@:
672
@@:
755
    ; 
673
; 
756
 
-
 
757
        dec     esi
674
     dec     esi
758
        jnz     .new_y
675
     jnz     .new_y
759
 
-
 
760
        add     esp, drbar.stack_data
676
     add     esp, drbar.stack_data
761
        popad
677
     popad
762
        xor     eax, eax
678
     xor     eax, eax
763
ret
679
     ret
Line 764... Line 680...
764
 
680
 
765
draw_bar_end_32:
681
draw_bar_end_32:
766
        mov     eax, [drbar.color]    ;; BBGGRR00
-
 
767
 
682
     mov     eax, [drbar.color]    ;; BBGGRR00
768
        mov     esi, [drbar.real_sy]
683
     mov     esi, [drbar.real_sy]
769
        align   4
684
align   4
770
     .new_y:
685
.new_y:
771
        mov     edi, [drbar.real_sx]
686
     mov     edi, [drbar.real_sx]
772
        align   4
687
align   4
773
     .new_x:
-
 
774
 
688
.new_x:
775
        cmp     byte [ebp], bl
689
     cmp     byte [ebp], bl
776
        jne     .skip
690
     jne     .skip
777
        mov     [edx], eax
691
     mov     [edx], eax
778
      .skip:
-
 
779
 
692
.skip:
780
        ; add pixel
693
; add pixel
781
        add     edx, 4
694
     add     edx, 4
782
        inc     ebp
-
 
783
 
695
     inc     ebp
784
        dec     edi
696
     dec     edi
785
        jnz     .new_x
-
 
786
 
697
     jnz     .new_x
787
        ; add line
698
; add line
788
        add     edx, [drbar.line_inc_scr]
699
     add     edx, [drbar.line_inc_scr]
789
        add     ebp, [drbar.line_inc_map]
-
 
790
 
700
     add     ebp, [drbar.line_inc_map]
791
    ;  drawing gradient bars
701
;  drawing gradient bars
792
        test    eax, 0x80000000
702
     test    eax, 0x80000000
793
        jz      @f
703
     jz      @f
794
        test    al, al
704
     test    al, al
795
        jz      @f
705
     jz      @f
796
        dec     al
706
     dec     al
797
      @@:
707
@@:
798
    ; 
-
 
799
 
708
; 
800
        dec     esi
709
     dec     esi
801
        jnz     .new_y
-
 
802
 
710
     jnz     .new_y
803
        add     esp, drbar.stack_data
711
     add     esp, drbar.stack_data
804
        popad
712
     popad
805
        call    VGA_draw_bar
713
     call    VGA_draw_bar
806
        xor     eax, eax
714
     xor     eax, eax
807
        mov     [EGA_counter],1
715
     mov     [EGA_counter],1
Line 808... Line -...
808
ret
-
 
809
 
716
     ret
Line 810... Line 717...
810
 
717
 
Line 866... Line 773...
866
 
773
 
867
 
774
 
868
 
-
 
869
;--------------vbe voodoo ------------------------------------------------
775
 
870
vesa20_drawbackground_tiled:
-
 
871
 
776
;--------------vbe voodoo ------------------------------------------------
872
     call [disable_mouse]
777
vesa20_drawbackground_tiled:
873
 
778
     call [disable_mouse]
874
     push ebp
779
     push ebp
875
     push eax
780
     push eax
876
     push ebx
-
 
877
     push ecx
781
     push ebx
878
     push edx
782
     push ecx
879
 
783
     push edx
880
     mov edx,dword [WinMapAddress-8] ; B
784
     mov edx,dword [WinMapAddress-8] ; B
881
     add edx,dword [WinMapAddress-8] ; +B
-
 
882
     add edx,dword [WinMapAddress-8] ; +B
785
     add edx,dword [WinMapAddress-8] ; +B
883
     push edx
786
     add edx,dword [WinMapAddress-8] ; +B
884
 
-
 
885
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
787
     push edx
886
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
788
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
887
 
789
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
888
     mov eax,[BytesPerScanLine]
790
     mov eax,[BytesPerScanLine]
889
     mul ebx
791
     mul ebx
890
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
792
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
891
     add ebp, eax   ; +X
-
 
892
     add ebp, eax   ; +X
793
     add ebp, eax   ; +X
893
     add ebp, eax   ; +X
794
     add ebp, eax   ; +X
894
 
795
     add ebp, eax   ; +X
895
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
796
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
896
     jz @f
797
     jz @f
897
     add ebp,eax ; +X
-
 
898
   @@:
798
     add ebp,eax ; +X
899
     add ebp,[LFBAddress]  ; +LFB
-
 
900
 
799
@@:
901
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
-
 
902
 
-
 
903
     call calculate_edi
800
     add ebp,[LFBAddress]  ; +LFB
904
 
-
 
905
 
801
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
906
   dp3:                             ; MAIN LOOP
-
 
907
 
-
 
908
     cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
-
 
909
;     je  ybgp
-
 
910
;
-
 
911
;     jmp nbgp
802
     call calculate_edi
912
;
-
 
913
;   ybgp:
803
dp3:                             ; MAIN LOOP
914
     jne nbgp
804
     cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1)
915
 
-
 
916
     push eax
805
     jne nbgp
917
     push ebx
806
     push eax
918
 
807
     push ebx
919
     mov ecx,dword [WinMapAddress-8]    ; B
-
 
920
     xor edx,edx                   ; edx:=0
808
     mov ecx,dword [WinMapAddress-8]    ; B
921
     div ecx                       ; Xstart/B
-
 
922
 
809
     xor edx,edx                   ; edx:=0
923
     ; eax=Int(qn) edx:=Rem
-
 
924
 
810
     div ecx                       ; Xstart/B
925
     lea esi,[edx+edx*2]           ; esi:=edx*3
811
; eax=Int(qn) edx:=Rem
926
 
812
     lea esi,[edx+edx*2]           ; esi:=edx*3
927
     mov ecx,dword [WinMapAddress-4]    ; ecx:=H
813
     mov ecx,dword [WinMapAddress-4]    ; ecx:=H
928
     mov eax,[esp+0]               ; eax:=Ystart
-
 
929
     xor edx,edx                   ;
814
     mov eax,[esp+0]               ; eax:=Ystart
930
     div ecx                       ; Ystart/H
815
     xor edx,edx                   ;
931
 
816
     div ecx                       ; Ystart/H
932
     mov eax,edx                   ; eax:=Rem
817
     mov eax,edx                   ; eax:=Rem
933
     xor edx,edx                   ;
818
     xor edx,edx                   ;
934
     mov ebx,[esp+8]               ; ebx:=B*3
819
     mov ebx,[esp+8]               ; ebx:=B*3
-
 
820
     mul ebx                       ;
-
 
821
     add esi,eax                   ;
935
     mul ebx                       ;
822
;     mov eax,[esi+IMG_BACKGROUND]
936
     add esi,eax                   ;
-
 
937
     mov eax,[esi+IMG_BACKGROUND]
823
     mov  eax,[img_background]
938
     and eax,0xffffff
824
     mov  eax,[esi+eax]
939
 
825
     and eax,0xffffff
940
     xchg edi, ebp
826
     xchg edi, ebp
941
     stosw
827
     stosw
942
     shr eax,16
828
     shr eax,16
943
     stosb
829
     stosb
944
     xchg ebp, edi                 ; ebp+=3
830
     xchg ebp, edi                 ; ebp+=3
945
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
831
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
946
     jz @f
-
 
947
     inc ebp ; +1
832
     jz @f
948
   @@:
833
     inc ebp ; +1
949
 
-
 
950
     pop ebx
834
@@:
951
     pop eax
-
 
952
 
835
     pop ebx
953
     jmp hook1
836
     pop eax
954
 
837
     jmp hook1
955
   nbgp:
838
nbgp:
956
     add ebp,3                     ; +3
839
     add ebp,3                     ; +3
957
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
840
     cmp [ScreenBPP],byte 24       ; 24 or 32 bpp ? - x size
958
     jz  @f
-
 
959
     inc ebp ; +1
841
     jz  @f
960
   @@:
-
 
961
 
842
     inc ebp ; +1
962
   hook1:
843
@@:
963
 
844
hook1:
964
     inc edi                       ; ptrBuffer++
845
     inc edi                       ; ptrBuffer++
965
     add esi,3                     ; ptrImage+=3
-
 
966
     inc eax
-
 
967
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
-
 
968
;     jg nodp3
-
 
969
;     jmp dp3
846
     add esi,3                     ; ptrImage+=3
970
;
-
 
971
;   nodp3:
847
     inc eax
972
     jle dp3
-
 
973
 
848
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
974
     mov ebp,[draw_data+32+RECT.left]
-
 
975
 
849
     jle dp3
976
     inc ebx
850
     mov ebp,[draw_data+32+RECT.left]
977
 
851
     inc ebx
978
     mov  eax,[BytesPerScanLine]
852
     mov  eax,[BytesPerScanLine]
979
     mul  ebx
853
     mul  ebx
Line 984... Line 858...
984
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
858
     cmp  [ScreenBPP],byte 24      ; 24 or 32 bpp ? - x size
985
     jz   @f
859
     jz   @f
986
     add  ebp,eax                  ; +X=X*4
860
     add  ebp,eax                  ; +X=X*4
987
   @@:
861
@@:
988
     add ebp,[LFBAddress]          ; +LFB
862
     add ebp,[LFBAddress]          ; +LFB
989
 
-
 
990
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
863
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
991
 
-
 
992
     call calculate_edi
864
     call calculate_edi
993
 
-
 
994
     cmp ebx,[draw_data+32+RECT.bottom]
865
     cmp ebx,[draw_data+32+RECT.bottom]
995
;     jg  dp4
-
 
996
;
-
 
997
;     jmp dp3
-
 
998
;
-
 
999
;   dp4:
-
 
1000
     jle dp3
866
     jle dp3
1001
 
-
 
1002
     add esp,4
867
     add esp,4
1003
 
-
 
1004
     pop edx
868
     pop edx
1005
     pop ecx
869
     pop ecx
1006
     pop ebx
870
     pop ebx
1007
     pop eax
871
     pop eax
1008
     pop ebp
872
     pop ebp
Line 1012... Line 876...
1012
 
876
 
Line 1013... Line 877...
1013
; ----------
877
; ----------
1014
 
-
 
1015
 
878
 
1016
vesa20_drawbackground_stretch:
-
 
1017
 
879
 
1018
     call  [disable_mouse]
880
vesa20_drawbackground_stretch:
1019
 
881
     call  [disable_mouse]
1020
     push ebp
882
     push ebp
1021
     push eax
883
     push eax
1022
     push ebx
-
 
1023
     push ecx
884
     push ebx
1024
     push edx
885
     push ecx
1025
 
886
     push edx
1026
     mov edx,dword [WinMapAddress-8] ; B
887
     mov edx,dword [WinMapAddress-8] ; B
1027
     add edx,dword [WinMapAddress-8] ; +B
-
 
1028
     add edx,dword [WinMapAddress-8] ; +B
888
     add edx,dword [WinMapAddress-8] ; +B
1029
     push edx
889
     add edx,dword [WinMapAddress-8] ; +B
1030
 
890
     push edx
1031
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
891
     mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
1032
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
892
     mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
1033
 
893
     dec ebx
1034
     mov eax,[BytesPerScanLine]
894
     mov eax,[BytesPerScanLine]
1035
     mul ebx
895
     mul ebx
1036
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
896
     xchg ebp, eax  ; BytesPerScanLine*(Ywin+y)
1037
     add ebp, eax   ; +X
-
 
1038
     add ebp, eax   ; +X
897
     add ebp, eax   ; +X
1039
     add ebp, eax   ; +X
898
     add ebp, eax   ; +X
1040
 
899
     add ebp, eax   ; +X
1041
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
900
     cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
1042
     jz  @f
901
     jz  @f
1043
     add ebp,eax ; +X
-
 
1044
   @@:
902
     add ebp,eax ; +X
1045
     add ebp,[LFBAddress] ; +LFB
-
 
1046
 
903
@@:
Line 1047... Line -...
1047
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
-
 
1048
 
904
     add ebp,[LFBAddress] ; +LFB
1049
     call calculate_edi
905
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1050
 
906
     call calculate_edi
1051
 
907
 
1052
sdp3: ; MAIN LOOP
908
sdp3: ; MAIN LOOP
Line 1068... Line 924...
1068
div ebx
924
     div ebx
1069
shl ecx,16
925
     shl ecx,16
1070
mov cx,dx
926
     mov cx,dx
1071
imul eax, [esp+8] ;8
927
     imul eax, [esp+8] ;8
1072
add esi,eax
928
     add esi,eax
1073
mov eax,[esi+IMG_BACKGROUND]
929
;     mov eax,[esi+IMG_BACKGROUND]
-
 
930
     mov  eax,[img_background]
-
 
931
 
-
 
932
     push eax
-
 
933
     mov  eax,[display_data-4]
-
 
934
     imul eax,[display_data-8]
-
 
935
     imul eax,3
-
 
936
     sub  eax,3
-
 
937
     cmp  eax,esi
-
 
938
     pop  eax
-
 
939
     jbe  @f
-
 
940
 
-
 
941
     mov  eax,[esi+eax]
-
 
942
@@:
1074
push eax
943
     push eax
1075
ror ecx,16
944
     ror ecx,16
1076
xor eax,eax
945
     xor eax,eax
1077
mov ax,cx
946
     mov ax,cx
1078
shl eax,1 ; óìíîæåíèå íà 2
947
     shl eax,1 ; óìíîæåíèå íà 2
Line 1081... Line 950...
1081
mov ebx,[ScreenWidth]
950
     mov ebx,[ScreenWidth]
1082
div ebx
951
     div ebx
1083
cmp eax,5
952
     cmp eax,5
1084
pop eax
953
     pop eax
1085
jb @f
954
     jb @f
1086
mov ebx,[esi+IMG_BACKGROUND+3]
955
;     mov ebx,[esi+IMG_BACKGROUND+3]
-
 
956
     mov  ebx,[img_background]
-
 
957
 
-
 
958
     push eax
-
 
959
     mov  eax,[display_data-4]
-
 
960
     imul eax,[display_data-8]
-
 
961
     imul eax,3
-
 
962
     sub  eax,3
-
 
963
     cmp  eax,esi
-
 
964
     pop  eax
-
 
965
     jbe  @f
-
 
966
 
-
 
967
     mov  ebx,[esi+ebx+3]
-
 
968
 
1087
call overlapping_of_points
969
     call overlapping_of_points
1088
@@:
970
@@:
1089
push eax
971
     push eax
1090
ror ecx,16
972
     ror ecx,16
1091
xor eax,eax
973
     xor eax,eax
Line 1099... Line 981...
1099
pop eax
981
     pop eax
1100
jb @f
982
     jb @f
1101
mov ebx,[display_data-8]
983
     mov ebx,[display_data-8]
1102
shl ebx,1
984
     shl ebx,1
1103
add ebx,[display_data-8]
985
     add ebx,[display_data-8]
1104
add ebx,IMG_BACKGROUND
986
     add ebx,[img_background]   ;IMG_BACKGROUND
-
 
987
 
-
 
988
     push eax
-
 
989
     mov  eax,[display_data-4]
-
 
990
     imul eax,[display_data-8]
-
 
991
     imul eax,3
-
 
992
     cmp  eax,esi
-
 
993
     pop  eax
-
 
994
     jbe  @f
-
 
995
 
1105
add ebx,esi
996
     add ebx,esi
1106
mov ebx,[ebx]
997
     mov ebx,[ebx]
1107
call overlapping_of_points
998
     call overlapping_of_points
1108
@@:
999
@@:
1109
and eax,0xffffff
1000
     and eax,0xffffff
Line 1160... Line 1051...
1160
     jz  @f
1051
     jz  @f
1161
     inc ebp ; +1
1052
     inc ebp ; +1
1162
   @@:
1053
@@:
Line 1163... Line 1054...
1163
 
1054
 
1164
   shook1:
-
 
1165
 
1055
shook1:
1166
     inc edi                       ; ptrBuffer++
1056
     inc edi                       ; ptrBuffer++
1167
     add esi,3                     ; ptrImage+=3
1057
     add esi,3                     ; ptrImage+=3
1168
     inc eax
1058
     inc eax
1169
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
1059
     cmp eax,[draw_data+32+RECT.right]         ; X > xend?
-
 
1060
     jle sdp3
Line 1170... Line 1061...
1170
     jle sdp3
1061
;     jbe sdp3
Line 1171... Line 1062...
1171
 
1062
 
Line 1187... Line 1078...
1187
 
1078
 
Line 1188... Line 1079...
1188
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
1079
     ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
Line -... Line 1080...
-
 
1080
 
-
 
1081
     call calculate_edi
-
 
1082
 
1189
 
1083
;     cmp ebx,[ScreenHeight]
1190
     call calculate_edi
1084
;     ja  @f
-
 
1085
 
1191
 
1086
     cmp ebx,[draw_data+32+RECT.bottom]
1192
     cmp ebx,[draw_data+32+RECT.bottom]
1087
     jle sdp3
Line 1193... Line 1088...
1193
     jle sdp3
1088
;     jbe sdp3
1194
 
1089
@@:
1195
     add esp,4
1090
     add esp,4