Subversion Repositories Kolibri OS

Rev

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

Rev 5201 Rev 5565
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
2
;;                                                              ;;
3
;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2015. All rights reserved. ;;
4
;; Distributed under terms of the GNU General Public License    ;;
4
;; Distributed under terms of the GNU General Public License    ;;
5
;;                                                              ;;
5
;;                                                              ;;
6
;;  VESA20.INC                                                  ;;
6
;;  VESA20.INC                                                  ;;
7
;;                                                              ;;
7
;;                                                              ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
8
;;  Vesa 2.0 functions for MenuetOS                             ;;
Line 15... Line 15...
15
;;                                                              ;;
15
;;                                                              ;;
16
;;  See file COPYING for details                                ;;
16
;;  See file COPYING for details                                ;;
17
;;                                                              ;;
17
;;                                                              ;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 19... Line 19...
19
 
19
 
Line 20... Line 20...
20
$Revision: 5201 $
20
$Revision: 5565 $
21
 
21
 
22
uglobal
22
uglobal
23
align 4
23
align 4
Line 234... Line 234...
234
;     lea     eax, [eax + eax * 2]
234
;     lea     eax, [eax + eax * 2]
235
        call    esi
235
        call    esi
236
        add     eax, [putimg.arg_0]
236
        add     eax, [putimg.arg_0]
237
        mov     [putimg.line_increment], eax
237
        mov     [putimg.line_increment], eax
238
; winmap new line increment
238
; winmap new line increment
239
        mov     eax, [Screen_Max_X]
239
        mov     eax, [_display.width]
240
        inc     eax
-
 
241
        sub     eax, [putimg.real_sx]
240
        sub     eax, [putimg.real_sx]
242
        mov     [putimg.winmap_newline], eax
241
        mov     [putimg.winmap_newline], eax
243
; screen new line increment
242
; screen new line increment
244
        mov     eax, [_display.pitch]
243
        mov     eax, [_display.lfb_pitch]
245
        mov     ebx, [_display.bytes_per_pixel]
244
        mov     ebx, [_display.bytes_per_pixel]
246
        imul    ecx, ebx
245
        imul    ecx, ebx
247
        sub     eax, ecx
246
        sub     eax, ecx
248
        mov     [putimg.screen_newline], eax
247
        mov     [putimg.screen_newline], eax
249
; pointer to image
248
; pointer to image
Line 260... Line 259...
260
;        imul    eax, [Screen_Max_X]
259
;        imul    eax, [Screen_Max_X]
261
;        add     eax, [putimg.abs_cy]
260
;        add     eax, [putimg.abs_cy]
262
        mov     eax, [d_width_calc_area + eax*4]
261
        mov     eax, [d_width_calc_area + eax*4]
Line 263... Line 262...
263
 
262
 
264
        add     eax, [putimg.abs_cx]
263
        add     eax, [putimg.abs_cx]
265
        add     eax, [_WinMapAddress]
264
        add     eax, [_display.win_map]
Line 266... Line 265...
266
        xchg    eax, ebp
265
        xchg    eax, ebp
267
 
266
 
268
        mov     ecx, [putimg.real_sx]
267
        mov     ecx, [putimg.real_sx]
Line 874... Line 873...
874
 
873
 
875
align 4
874
align 4
Line 876... Line 875...
876
__sys_putpixel:
875
__sys_putpixel:
877
 
876
 
878
        pushad
877
        pushad
879
        cmp     [Screen_Max_X], eax
878
        cmp     eax, [_display.width]
880
        jb      .exit
879
        jge     .exit
881
        cmp     [Screen_Max_Y], ebx
880
        cmp     ebx, [_display.height]
882
        jb      .exit
881
        jge     .exit
Line 883... Line 882...
883
        test    edi, 1           ; force ?
882
        test    edi, 1           ; force ?
884
        jnz     .forced
883
        jnz     .forced
885
 
884
 
886
; not forced
885
; not forced
887
        mov     edx, [d_width_calc_area + ebx*4]
886
        mov     edx, [d_width_calc_area + ebx*4]
888
        add     edx, [_WinMapAddress]
887
        add     edx, [_display.win_map]
Line 889... Line 888...
889
        movzx   edx, byte [eax+edx]
888
        movzx   edx, byte [eax+edx]
Line 1439... Line 1438...
1439
        jbe     .end_y
1438
        jbe     .end_y
1440
        mov     ebx, [drbar.bar_sy]
1439
        mov     ebx, [drbar.bar_sy]
1441
  .end_y:
1440
  .end_y:
1442
        mov     [drbar.real_sy], ebx
1441
        mov     [drbar.real_sy], ebx
1443
; line_inc_map
1442
; line_inc_map
1444
        mov     eax, [Screen_Max_X]
1443
        mov     eax, [_display.width]
1445
        sub     eax, [drbar.real_sx]
1444
        sub     eax, [drbar.real_sx]
1446
        inc     eax
-
 
1447
        mov     [drbar.line_inc_map], eax
1445
        mov     [drbar.line_inc_map], eax
1448
; line_inc_scr
1446
; line_inc_scr
1449
        mov     eax, [drbar.real_sx]
1447
        mov     eax, [drbar.real_sx]
1450
        mov     ebx, [_display.bytes_per_pixel]
1448
        mov     ebx, [_display.bytes_per_pixel]
1451
        imul    eax, ebx
1449
        imul    eax, ebx
1452
        neg     eax
1450
        neg     eax
1453
        add     eax, [_display.pitch]
1451
        add     eax, [_display.lfb_pitch]
1454
        mov     [drbar.line_inc_scr], eax
1452
        mov     [drbar.line_inc_scr], eax
1455
; pointer to screen
1453
; pointer to screen
1456
        mov     edx, [drbar.abs_cy]
1454
        mov     edx, [drbar.abs_cy]
1457
;        imul    edx, [BytesPerScanLine]
1455
;        imul    edx, [BytesPerScanLine]
1458
        mov     edx, [BPSLine_calc_area+edx*4]
1456
        mov     edx, [BPSLine_calc_area+edx*4]
Line 1464... Line 1462...
1464
;        imul    eax, [Screen_Max_X]
1462
;        imul    eax, [Screen_Max_X]
1465
;        add     eax, [drbar.abs_cy]
1463
;        add     eax, [drbar.abs_cy]
1466
        mov     eax, [d_width_calc_area + eax*4]
1464
        mov     eax, [d_width_calc_area + eax*4]
Line 1467... Line 1465...
1467
 
1465
 
1468
        add     eax, [drbar.abs_cx]
1466
        add     eax, [drbar.abs_cx]
1469
        add     eax, [_WinMapAddress]
1467
        add     eax, [_display.win_map]
Line 1470... Line 1468...
1470
        xchg    eax, ebp
1468
        xchg    eax, ebp
1471
 
1469
 
1472
        mov     ebx, [drbar.real_sx]
1470
        mov     ebx, [drbar.real_sx]
Line 2034... Line 2032...
2034
  @@:
2032
  @@:
2035
        add     ebp, LFB_BASE
2033
        add     ebp, LFB_BASE
2036
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
2034
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
2037
        call    calculate_edi
2035
        call    calculate_edi
2038
        xchg    edi, ebp
2036
        xchg    edi, ebp
2039
        add     ebp, [_WinMapAddress]
2037
        add     ebp, [_display.win_map]
2040
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
2038
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
2041
; 2) Calculate offset in background memory block
2039
; 2) Calculate offset in background memory block
2042
        push    eax
2040
        push    eax
2043
        xor     edx, edx
2041
        xor     edx, edx
2044
        mov     eax, ebx
2042
        mov     eax, ebx
Line 2147... Line 2145...
2147
; Helper variables
2145
; Helper variables
2148
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
2146
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
2149
        mov     eax, [BgrDataWidth]
2147
        mov     eax, [BgrDataWidth]
2150
        dec     eax
2148
        dec     eax
2151
        xor     edx, edx
2149
        xor     edx, edx
2152
        div     dword [Screen_Max_X]
2150
        div     dword [screen_workarea.right]
2153
        push    eax     ; high
2151
        push    eax     ; high
2154
        xor     eax, eax
2152
        xor     eax, eax
2155
        div     dword [Screen_Max_X]
2153
        div     dword [screen_workarea.right]
2156
        push    eax     ; low
2154
        push    eax     ; low
Line 2157... Line 2155...
2157
 
2155
 
2158
; the same for height
2156
; the same for height
2159
        mov     eax, [BgrDataHeight]
2157
        mov     eax, [BgrDataHeight]
2160
        dec     eax
2158
        dec     eax
2161
        xor     edx, edx
2159
        xor     edx, edx
2162
        div     dword [Screen_Max_Y]
2160
        div     dword [screen_workarea.bottom]
2163
        push    eax     ; high
2161
        push    eax     ; high
2164
        xor     eax, eax
2162
        xor     eax, eax
2165
        div     dword [Screen_Max_Y]
2163
        div     dword [screen_workarea.bottom]
Line 2166... Line 2164...
2166
        push    eax     ; low
2164
        push    eax     ; low
2167
 
2165
 
2168
; External loop for all y from start to end
2166
; External loop for all y from start to end
Line 2256... Line 2254...
2256
; precalculated constants:
2254
; precalculated constants:
2257
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
2255
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
2258
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
2256
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
Line 2259... Line 2257...
2259
 
2257
 
2260
  sdp3a:
2258
  sdp3a:
2261
        mov     eax, [_WinMapAddress]
2259
        mov     eax, [_display.win_map]
2262
        cmp     [ebp+eax], byte 1
2260
        cmp     [ebp+eax], byte 1
2263
        jnz     snbgp
2261
        jnz     snbgp
2264
        mov     eax, [bgr_cur_line+esi]
2262
        mov     eax, [bgr_cur_line+esi]
2265
        test    ecx, ecx
2263
        test    ecx, ecx
Line 2321... Line 2319...
2321
        ja      sdpdone
2319
        ja      sdpdone
Line 2322... Line 2320...
2322
 
2320
 
2323
; advance edi, ebp to next scan line
2321
; advance edi, ebp to next scan line
2324
        sub     eax, [draw_data+32+RECT.left]
2322
        sub     eax, [draw_data+32+RECT.left]
2325
        sub     ebp, eax
2323
        sub     ebp, eax
2326
        add     ebp, [Screen_Max_X]
-
 
2327
        add     ebp, 1
2324
        add     ebp, [_display.width]
2328
        sub     edi, eax
2325
        sub     edi, eax
2329
        sub     edi, eax
2326
        sub     edi, eax
2330
        cmp     byte [_display.bytes_per_pixel], 2
2327
        cmp     byte [_display.bytes_per_pixel], 2
2331
        jz      @f
2328
        jz      @f
2332
        sub     edi, eax
2329
        sub     edi, eax
2333
        cmp     byte [_display.bytes_per_pixel], 3
2330
        cmp     byte [_display.bytes_per_pixel], 3
2334
        jz      @f
2331
        jz      @f
Line 2335... Line 2332...
2335
        sub     edi, eax
2332
        sub     edi, eax
2336
 
2333
 
2337
  @@:
2334
  @@:
2338
        add     edi, [_display.pitch]
2335
        add     edi, [_display.lfb_pitch]
2339
; restore ecx,edx; advance esi to next background line
2336
; restore ecx,edx; advance esi to next background line
2340
        mov     eax, [esp+28]
2337
        mov     eax, [esp+28]
2341
        mov     ebx, [esp+32]
2338
        mov     ebx, [esp+32]
Line 2354... Line 2351...
2354
        cmp     ebx, -1
2351
        cmp     ebx, -1
2355
        jnz     bgr_resmooth0
2352
        jnz     bgr_resmooth0
2356
        push    edi
2353
        push    edi
2357
        mov     esi, bgr_next_line
2354
        mov     esi, bgr_next_line
2358
        mov     edi, bgr_cur_line
2355
        mov     edi, bgr_cur_line
2359
        mov     ecx, [Screen_Max_X]
2356
        mov     ecx, [_display.width]
2360
        inc     ecx
-
 
2361
        rep movsd
2357
        rep movsd
2362
        jmp     bgr_resmooth1
2358
        jmp     bgr_resmooth1
Line 2363... Line 2359...
2363
 
2359
 
2364
  sdpdone:
2360
  sdpdone: