* Rewritten Vesa2 background code, it is much faster now

* Fixed kernel fault when creating files with unusual names with multiple dots

git-svn-id: svn://kolibrios.org@527 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Evgeny Grechnikov (Diamond) 2007-05-30 13:48:21 +00:00
parent 6c6a00efd0
commit 141e4c2c3d
5 changed files with 316 additions and 372 deletions

View File

@ -1,13 +1,13 @@
$Revision$ $Revision$
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;; RAMDISK functions ;; ;; RAMDISK functions ;;
;; (C) 2004 Ville Turjanmaa, License: GPL ;; ;; (C) 2004 Ville Turjanmaa, License: GPL ;;
;; Addings by M.Lisovin ;; ;; Addings by M.Lisovin ;;
;; LFN support by diamond ;; ;; LFN support by diamond ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; calculate fat chain ; calculate fat chain
@ -1444,14 +1444,19 @@ fat_gen_short_name:
add ebx, edi add ebx, edi
sub ebx, ecx sub ebx, ecx
push ebx push ebx
cmp ebx, ecx
jb @f
pop ebx
push ecx
@@:
cmp edi, ecx cmp edi, ecx
jbe .skip jbe .skip
@@: @@:
dec edi dec edi
mov al, ' ' mov al, [edi]
xchg al, [edi]
dec ebx dec ebx
mov [ebx], al mov [ebx], al
mov byte [edi], ' '
cmp edi, ecx cmp edi, ecx
ja @b ja @b
.skip: .skip:

View File

@ -305,6 +305,9 @@ virtual at (OS_BASE+0x043BF80)
tss TSS tss TSS
end virtual end virtual
BgrDrawMode equ (OS_BASE+0x043EFF4)
BgrDataWidth equ (OS_BASE+0x043EFF8)
BgrDataHeight equ (OS_BASE+0x043EFFC)
WinMapAddress equ (OS_BASE+0x043F000) WinMapAddress equ (OS_BASE+0x043F000)
display_data equ (OS_BASE+0x043F000) display_data equ (OS_BASE+0x043F000)

View File

@ -107,7 +107,7 @@ use16
org 0x0 org 0x0
jmp start_of_code jmp start_of_code
version db 'Kolibri OS version 0.6.5.0 ',13,10,13,10,0 version db 'Kolibri OS version 0.7.0.0 pre ',13,10,13,10,0
include "boot/bootstr.inc" ; language-independent boot messages include "boot/bootstr.inc" ; language-independent boot messages
include "boot/preboot.inc" include "boot/preboot.inc"
@ -521,9 +521,9 @@ high_code:
; set background ; set background
xor eax,eax xor eax,eax
inc eax inc eax
mov [display_data-12],eax mov [BgrDrawMode],eax
mov [display_data-8],eax mov [BgrDataWidth],eax
mov [display_data-4],eax mov [BgrDataHeight],eax
mov [mem_BACKGROUND],4095 mov [mem_BACKGROUND],4095
stdcall kernel_alloc, [mem_BACKGROUND] stdcall kernel_alloc, [mem_BACKGROUND]
mov [img_background], eax mov [img_background], eax
@ -1119,7 +1119,6 @@ set_variables:
pop eax pop eax
mov byte [SB16_Status],0 ; Minazzi Paolo mov byte [SB16_Status],0 ; Minazzi Paolo
mov [display_data-12],dword 1 ; tiled background
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
;!! IP 04.02.2005: ;!! IP 04.02.2005:
@ -2287,7 +2286,7 @@ endg
iglobal iglobal
version_inf: version_inf:
db 0,6,5,0 ; version 0.6.5.0 db 0,7,0,0 ; version 0.7.0.0
db UID_KOLIBRI db UID_KOLIBRI
db 'Kolibri',0 db 'Kolibri',0
version_end: version_end:
@ -2356,8 +2355,8 @@ sys_background:
je sbgrr je sbgrr
cmp ecx,0 cmp ecx,0
je sbgrr je sbgrr
mov [display_data-8],ebx mov [BgrDataWidth],ebx
mov [display_data-4],ecx mov [BgrDataHeight],ecx
; mov [bgrchanged],1 ; mov [bgrchanged],1
pushad pushad
@ -2366,18 +2365,17 @@ sys_background:
; calculate RAW size ; calculate RAW size
xor eax,eax xor eax,eax
inc eax inc eax
cmp [display_data-8],eax cmp [BgrDataWidth],eax
jae @f jae @f
mov [display_data-8],eax mov [BgrDataWidth],eax
@@: @@:
cmp [display_data-4],eax cmp [BgrDataHeight],eax
jae @f jae @f
mov [display_data-4],eax mov [BgrDataHeight],eax
@@: @@:
mov eax,[display_data-8] mov eax,[BgrDataWidth]
imul eax,[display_data-4] imul eax,[BgrDataHeight]
inc eax lea eax,[eax*3]
imul eax,3
mov [mem_BACKGROUND],eax mov [mem_BACKGROUND],eax
; get memory for new background ; get memory for new background
stdcall kernel_alloc, [mem_BACKGROUND] stdcall kernel_alloc, [mem_BACKGROUND]
@ -2425,9 +2423,9 @@ draw_background_temp:
cmp eax,4 ; TILED / STRETCHED cmp eax,4 ; TILED / STRETCHED
jnz nosb4 jnz nosb4
cmp ebx,[display_data-12] cmp ebx,[BgrDrawMode]
je nosb41 je nosb41
mov [display_data-12],ebx mov [BgrDrawMode],ebx
; mov [bgrchanged],1 ; mov [bgrchanged],1
nosb41: nosb41:
ret ret
@ -2436,11 +2434,8 @@ draw_background_temp:
cmp eax,5 ; BLOCK MOVE TO BGR cmp eax,5 ; BLOCK MOVE TO BGR
jnz nosb5 jnz nosb5
; bughere ; bughere
mov edi, [TASK_BASE]
add ebx, [edi+TASKDATA.mem_start]
mov eax, ebx mov eax, ebx
mov ebx, ecx mov ebx, ecx
add ecx, edx
add ebx, [img_background] ;IMG_BACKGROUND add ebx, [img_background] ;IMG_BACKGROUND
mov ecx, edx mov ecx, edx
call memmove call memmove
@ -2457,9 +2452,9 @@ sys_getbackground:
cmp eax,1 ; SIZE cmp eax,1 ; SIZE
jnz nogb1 jnz nogb1
mov eax,[display_data-8] mov eax,[BgrDataWidth]
shl eax,16 shl eax,16
mov ax,[display_data-4] mov ax,[BgrDataWidth]
mov [esp+36],eax mov [esp+36],eax
ret ret
nogb1: nogb1:
@ -2480,7 +2475,7 @@ sys_getbackground:
cmp eax,4 ; TILED / STRETCHED cmp eax,4 ; TILED / STRETCHED
jnz nogb4 jnz nogb4
mov eax,[display_data-12] mov eax,[BgrDrawMode]
nogb4: nogb4:
mov [esp+36],eax mov [esp+36],eax
ret ret
@ -4098,7 +4093,7 @@ drawbackground:
call [draw_pointer] call [draw_pointer]
ret ret
dbrv20: dbrv20:
cmp [display_data-12],dword 1 cmp [BgrDrawMode],dword 1
jne bgrstr jne bgrstr
call vesa20_drawbackground_tiled call vesa20_drawbackground_tiled
dec [mouse_pause] dec [mouse_pause]

View File

@ -206,8 +206,8 @@ vesa12_drawbackground:
push edx push edx
xor edx,edx xor edx,edx
mov eax,dword[WinMapAddress-8] mov eax,dword[BgrDataWidth]
mov ebx,dword[WinMapAddress-4] mov ebx,dword[BgrDataHeight]
mul ebx mul ebx
mov ebx,3 mov ebx,3
mul ebx mul ebx
@ -220,23 +220,19 @@ vesa12_drawbackground:
push eax push eax
push ebx push ebx
mov esi,[img_background] ;IMG_BACKGROUND
cmp [WinMapAddress-12],dword 1 ; tiled background cmp [BgrDrawMode],dword 1 ; tiled background
jne no_vesa12_tiled_bgr jne no_vesa12_tiled_bgr
push edx push edx
xor edx,edx xor edx,edx
mov ecx,[WinMapAddress-8] div dword [BgrDataWidth]
div ecx
mov eax,edx
push eax push edx
mov eax,ebx mov eax,ebx
xor edx,edx xor edx,edx
mov ecx,[WinMapAddress-4] div dword [BgrDataHeight]
div ecx
mov ebx,edx mov ebx,edx
pop eax pop eax
@ -244,21 +240,19 @@ vesa12_drawbackground:
no_vesa12_tiled_bgr: no_vesa12_tiled_bgr:
cmp [WinMapAddress-12],dword 2 ; stretched background cmp [BgrDrawMode],dword 2 ; stretched background
jne no_vesa12_stretched_bgr jne no_vesa12_stretched_bgr
push edx push edx
imul eax,dword [WinMapAddress-8] mul dword [BgrDataWidth]
xor edx,edx
mov ecx,[ScreenWidth] mov ecx,[ScreenWidth]
inc ecx inc ecx
div ecx div ecx
push eax push eax
mov eax,ebx mov eax,ebx
imul eax,dword [WinMapAddress-4] mul dword [BgrDataHeight]
xor edx,edx
mov ecx,[ScreenHeight] mov ecx,[ScreenHeight]
inc ecx inc ecx
div ecx div ecx
@ -270,34 +264,26 @@ vesa12_drawbackground:
no_vesa12_stretched_bgr: no_vesa12_stretched_bgr:
push eax mov esi,ebx
mov eax,ebx imul esi, dword [BgrDataWidth]
xor edx,edx
mov ebx,[WinMapAddress-8]
add ebx,[WinMapAddress-8]
add ebx,[WinMapAddress-8]
mul ebx
mov esi,eax
pop eax
add esi,eax
add esi,eax
add esi,eax add esi,eax
lea esi,[esi*3]
add esi,[img_background] ;IMG_BACKGROUND add esi,[img_background] ;IMG_BACKGROUND
pop ebx pop ebx
pop eax pop eax
v12di4: v12di4:
mov ecx,[esi] mov cl,[esi+2]
shl ecx,16
mov cx,[esi]
pusha pusha
mov esi,eax mov esi,eax
mov edi,ebx mov edi,ebx
mov eax,[ScreenWidth] mov eax,[ScreenWidth]
add eax,1 add eax,1
mul ebx mul ebx
add eax,esi cmp [eax+esi+WinMapAddress],byte 1
add eax,WinMapAddress
cmp [eax],byte 1
jnz v12nbgp jnz v12nbgp
mov eax,[BytesPerScanLine] mov eax,[BytesPerScanLine]
mov ebx,edi mov ebx,edi

View File

@ -769,330 +769,285 @@ align 4
; ret ; ret
;--------------vbe voodoo ------------------------------------------------
vesa20_drawbackground_tiled: vesa20_drawbackground_tiled:
call [disable_mouse] call [disable_mouse]
push ebp pushad
push eax ; External loop for all y from start to end
push ebx mov ebx, [draw_data+32+RECT.top] ; y start
push ecx dp2:
push edx mov ebp, [draw_data+32+RECT.left] ; x start
mov edx,dword [WinMapAddress-8] ; B ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
add edx,dword [WinMapAddress-8] ; +B ; and LFB data (output for our function) [edi]
add edx,dword [WinMapAddress-8] ; +B mov eax, [BytesPerScanLine]
push edx mul ebx
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) xchg ebp, eax
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) add ebp, eax
mov eax,[BytesPerScanLine] add ebp, eax
mul ebx add ebp, eax
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
add ebp, eax ; +X jz @f
add ebp, eax ; +X add ebp, eax
add ebp, eax ; +X
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp,eax ; +X
@@: @@:
add ebp,[LFBAddress] ; +LFB add ebp, [LFBAddress]
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
dp3: ; MAIN LOOP xchg edi, ebp
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
jne nbgp ; 2) Calculate offset in background memory block
push eax push eax
push ebx xor edx, edx
mov ecx,dword [WinMapAddress-8] ; B mov eax, ebx
xor edx,edx ; edx:=0 mov ecx, [BgrDataHeight]
div ecx ; Xstart/B div ecx ; edx := y mod BgrDataHeight
; eax=Int(qn) edx:=Rem sub ecx, edx ; ecx := BgrDataHeight - (y mod BgrDataHeight)
lea esi,[edx+edx*2] ; esi:=edx*3 pop eax
mov ecx,dword [WinMapAddress-4] ; ecx:=H push eax
mov eax,[esp+0] ; eax:=Ystart mov esi, edx
xor edx,edx ; imul esi, [BgrDataWidth] ; esi := (y mod BgrDataHeight) * BgrDataWidth
div ecx ; Ystart/H xor edx, edx
mov eax,edx ; eax:=Rem div dword [BgrDataWidth] ; edx := x mod BgrDataWidth
xor edx,edx ; add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth)
mov ebx,[esp+8] ; ebx:=B*3 pop eax
mul ebx ; lea esi, [esi*3]
add esi,eax ; add esi, [img_background]
; mov eax,[esi+IMG_BACKGROUND] xor edx, edx
mov eax,[img_background] inc edx
mov eax,[esi+eax] ; 3) Loop through redraw rectangle and copy background data
and eax,0xffffff ; Registers meaning:
xchg edi, ebp ; eax = x, ebx = y (screen coordinates)
stosw ; ecx = deltax - number of pixels left in current tile block
shr eax,16 ; edx = 1
stosb ; esi -> bgr memory, edi -> output
xchg ebp, edi ; ebp+=3 ; ebp = offset in WinMapAddress
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size dp3:
jz @f cmp [ebp+WinMapAddress], dl
inc ebp ; +1 jnz nbgp
@@: movsb
pop ebx movsb
pop eax movsb
jmp hook1 jmp @f
nbgp: nbgp:
add ebp,3 ; +3 add esi, 3
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size add edi, 3
jz @f
inc ebp ; +1
@@: @@:
hook1: cmp [ScreenBPP], byte 25 ; 24 or 32 bpp?
inc edi ; ptrBuffer++ sbb edi, -1 ; +1 for 32 bpp
add esi,3 ; ptrImage+=3 ; I do not use 'inc eax' because this is slightly slower then 'add eax,1'
inc eax add ebp, edx
cmp eax,[draw_data+32+RECT.right] ; X > xend? add eax, edx
jle dp3 cmp eax, [draw_data+32+RECT.right]
mov ebp,[draw_data+32+RECT.left] ja dp4
inc ebx sub ecx, edx
mov eax,[BytesPerScanLine] jnz dp3
mul ebx ; next tile block on x-axis
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) mov ecx, [BgrDataWidth]
add ebp, eax ; +X sub esi, ecx
add ebp, eax ; +X=X*2 sub esi, ecx
add ebp, eax ; +X=X*3 sub esi, ecx
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size jmp dp3
jz @f dp4:
add ebp,eax ; +X=X*4 ; next scan line
@@: inc ebx
add ebp,[LFBAddress] ; +LFB cmp ebx, [draw_data+32+RECT.bottom]
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB jbe dp2
call calculate_edi popad
cmp ebx,[draw_data+32+RECT.bottom] mov [EGA_counter], 1
jle dp3 call VGA_drawbackground
add esp,4 ret
pop edx
pop ecx
pop ebx
pop eax
pop ebp
mov [EGA_counter],1
call VGA_drawbackground
ret
; ---------- ; ----------
vesa20_drawbackground_stretch: vesa20_drawbackground_stretch:
call [disable_mouse] call [disable_mouse]
push ebp pushad
push eax ; Helper variables
push ebx mov eax, [BgrDataWidth]
push ecx xor edx, edx
push edx mov ecx, [ScreenWidth]
mov edx,dword [WinMapAddress-8] ; B inc ecx
add edx,dword [WinMapAddress-8] ; +B div ecx
add edx,dword [WinMapAddress-8] ; +B push eax ; quo
push edx push edx ; rem
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) mov eax, [BgrDataHeight]
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) xor edx, edx
mov eax,[BytesPerScanLine] mov ecx, [ScreenHeight]
mul ebx inc ecx
xchg ebp, eax ; BytesPerScanLine*(Ywin+y) div ecx
add ebp, eax ; +X push eax
add ebp, eax ; +X push edx
add ebp, eax ; +X ; External loop for all y from start to end
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size mov ebx, [draw_data+32+RECT.top] ; y start
jz @f mov ebp, [draw_data+32+RECT.left] ; x start
add ebp,eax ; +X ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
; and LFB data (output for our function) [edi]
mov eax, [BytesPerScanLine]
mul ebx
xchg ebp, eax
add ebp, eax
add ebp, eax
add ebp, eax
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp, eax
@@: @@:
add ebp,[LFBAddress] ; +LFB add ebp, [LFBAddress]
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi call calculate_edi
xchg edi, ebp
sdp3: ; MAIN LOOP ; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) push ebx
jne snbgp ; 2) Calculate offset in background memory block
push eax push eax
push ebx mov eax, ebx
mov eax,dword [WinMapAddress-8] mul dword [BgrDataHeight]
imul eax, [esp+4] ;4 mov ecx, [ScreenHeight]
xor edx,edx inc ecx
mov ebx,[ScreenWidth] div ecx ; eax := y * BgrDataHeight / ScreenHeight
div ebx ; edx := (y * BgrDataHeight) mod ScreenHeight
mov cx,dx mov esi, eax
lea esi,[eax+eax*2] pop eax
mov eax,dword [WinMapAddress-4] push edx ; dword [esp] = (y * BgrDataHeight) mod ScreenHeight
imul eax, [esp+0] ;0 ; dword [esp+4] = y * BgrDataHeight / ScreenHeight
xor edx,edx push eax
mov ebx,[ScreenHeight] mov ecx, [BgrDataWidth]
div ebx mul ecx
shl ecx,16 imul esi, ecx
mov cx,dx dec ecx
imul eax, [esp+8] ;8 push ecx
add esi,eax mov ecx, [ScreenWidth]
; mov eax,[esi+IMG_BACKGROUND] inc ecx
mov eax,[img_background] div ecx ; eax := x * BgrDataWidth / ScreenWidth
; edx := (x * BgrDataWidth) mod ScreenWidth
push eax add esi, eax
mov eax,[display_data-4] lea esi, [esi*3]
imul eax,[display_data-8] add esi, [img_background]
imul eax,3 push ecx edx esi
sub eax,3 ; 3) Loop through redraw rectangle and copy background data
cmp eax,esi ; Registers meaning:
pop eax ; ecx = (x * BgrDataWidth) / ScreenWidth
jbe @f ; edx = (x * BgrDataWidth) mod ScreenWidth (used to fast recalculating of ecx,esi)
; esi -> bgr memory, edi -> output
mov eax,[esi+eax] ; ebp = offset in WinMapAddress
; dword [esp] = saved esi
; dword [esp+4] = saved edx
; dword [esp+8] = saved ecx
; dword [esp+12] = limit for overlapping of points
; dword [esp+16] = x
; dword [esp+20] = (y * BgrDataHeight) mod ScreenHeight (used to fast recalculating of esi)
; dword [esp+24] = y
; precalculated constants:
; dword [esp+28] = BgrDataHeight mod ScreenHeight
; dword [esp+32] = BgrDataHeight div ScreenHeight
; dword [esp+36] = BgrDataWidth mod ScreenWidth
; dword [esp+40] = BgrDataWidth div ScreenWidth
sdp3:
cmp [ebp+WinMapAddress], byte 1
jnz snbgp
mov al, [esi+2]
shl eax, 16
mov ax, [esi]
cmp ecx, [esp+12]
jae @f
mov ebx, [esi+2]
shr ebx, 8
call overlapping_of_points
@@: @@:
push eax mov [edi], ax
ror ecx,16 shr eax, 16
xor eax,eax mov [edi+2], al
mov ax,cx snbgp:
shl eax,1 ; óìíîæåíèå íà 2 cmp [ScreenBPP], byte 25
lea eax,[eax+eax*4] ; óìíîæåíèå íà 5 sbb edi, -4
xor edx,edx add ebp, 1
mov ebx,[ScreenWidth] mov eax, [esp+16]
div ebx add eax, 1
cmp eax,5 mov [esp+16], eax
pop eax cmp eax, [draw_data+32+RECT.right]
jb @f ja sdp4
; mov ebx,[esi+IMG_BACKGROUND+3] mov eax, [esp+40]
mov ebx,[img_background] add ecx, eax
lea eax, [eax*3]
push eax add esi, eax
mov eax,[display_data-4] add edx, [esp+36]
imul eax,[display_data-8] cmp edx, [ScreenWidth]
imul eax,3 jbe sdp3
sub eax,3 sub edx, [ScreenWidth]
cmp eax,esi add ecx, 1
pop eax add esi, 3
jbe @f sub edx, 1
jmp sdp3
mov ebx,[esi+ebx+3] sdp4:
; next y
call overlapping_of_points mov ebx, [esp+24]
add ebx, 1
mov [esp+24], ebx
cmp ebx, [draw_data+32+RECT.bottom]
ja sdpdone
; advance edi, ebp to next scan line
sub eax, [draw_data+32+RECT.left]
sub ebp, eax
add ebp, [ScreenWidth]
add ebp, 1
sub edi, eax
sub edi, eax
sub edi, eax
cmp [ScreenBPP], byte 24
jz @f
sub edi, eax
@@: @@:
push eax add edi, [BytesPerScanLine]
ror ecx,16 ; restore ecx,edx; advance esi to next background line
xor eax,eax pop esi edx ecx
mov ax,cx push ecx edx
shl eax,1 ; óìíîæåíèå íà 2 xor ebx, ebx
lea eax,[eax+eax*4] ; óìíîæåíèå íà mov eax, [esp+20-4]
xor edx,edx add eax, [esp+28-4]
mov ebx,[ScreenHeight] cmp eax, [ScreenHeight]
div ebx jbe @f
cmp eax,5 sub eax, [ScreenHeight]
pop eax mov ebx, 1
jb @f sub eax, ebx
mov ebx,[display_data-8]
shl ebx,1
add ebx,[display_data-8]
add ebx,[img_background] ;IMG_BACKGROUND
push eax
mov eax,[display_data-4]
imul eax,[display_data-8]
imul eax,3
cmp eax,esi
pop eax
jbe @f
add ebx,esi
mov ebx,[ebx]
call overlapping_of_points
@@: @@:
and eax,0xffffff mov [esp+20-4], eax
xchg edi, ebp add ebx, [esp+32-4]
stosw lea ebx, [ebx*3]
shr eax,16 imul ebx, [BgrDataWidth]
stosb add esi, ebx
xchg ebp, edi ; ebp+=3 push esi
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size mov eax, [draw_data+32+RECT.left]
jz @f mov [esp+16], eax
inc ebp ; +1 jmp sdp3
@@: sdpdone:
pop ebx add esp, 44
pop eax popad
jmp shook1 mov [EGA_counter],1
call VGA_drawbackground
ret
overlapping_of_points: overlapping_of_points:
push ecx edi push ecx edx edi
mov ecx,eax mov ecx, eax
mov edx,ebx mov edx, ebx
xor eax,eax movzx eax, cl
mov al,cl movzx ebx, dl
xor ebx,ebx add eax, ebx
mov bl,dl rcr eax, 1
add eax,ebx movzx edi, ax
rcr eax,1 movzx eax, ch
xor edi,edi movzx ebx, dh
mov di,ax add eax, ebx
xor eax,eax rcr eax, 1
mov al,ch ror edi, 8
xor ebx,ebx add edi, eax
mov bl,dh shr ecx, 8
add eax,ebx shr edx, 8
rcr eax,1 movzx eax, ch
ror edi,8 movzx ebx, dh
add edi,eax add eax, ebx
ror ecx,8 rcr eax, 1
ror edx,8 ror edi, 8
xor eax,eax add eax, edi
mov al,ch ror eax, 16
xor ebx,ebx pop edi edx ecx
mov bl,dh ret
add eax,ebx
rcr eax,1
ror edi,8
add eax,edi
ror eax,16
pop edi ecx
ret
snbgp:
add ebp,3 ; +3
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
jz @f
inc ebp ; +1
@@:
shook1:
inc edi ; ptrBuffer++
add esi,3 ; ptrImage+=3
inc eax
cmp eax,[draw_data+32+RECT.right] ; X > xend?
jle sdp3
; jbe sdp3
mov ebp,[draw_data+32+RECT.left]
inc ebx
mov eax,[BytesPerScanLine]
mul ebx
xchg ebp, eax ; BytesPerScanLine*(Ywin+y)
add ebp, eax ; +X
add ebp, eax ; +X=X*2
add ebp, eax ; +X=X*3
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
jz @f
add ebp,eax ; +X=X*4
@@:
add ebp,[LFBAddress] ; +LFB
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
call calculate_edi
; cmp ebx,[ScreenHeight]
; ja @f
cmp ebx,[draw_data+32+RECT.bottom]
jle sdp3
; jbe sdp3
@@:
add esp,4
pop edx
pop ecx
pop ebx
pop eax
pop ebp
mov [EGA_counter],1
call VGA_drawbackground
ret