From 141e4c2c3d2b003aa22d0b8d3467d2193f6faeed Mon Sep 17 00:00:00 2001 From: "Evgeny Grechnikov (Diamond)" Date: Wed, 30 May 2007 13:48:21 +0000 Subject: [PATCH] * 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 --- kernel/trunk/blkdev/rd.inc | 19 +- kernel/trunk/const.inc | 3 + kernel/trunk/kernel.asm | 45 ++- kernel/trunk/video/vesa12.inc | 46 +-- kernel/trunk/video/vesa20.inc | 575 ++++++++++++++++------------------ 5 files changed, 316 insertions(+), 372 deletions(-) diff --git a/kernel/trunk/blkdev/rd.inc b/kernel/trunk/blkdev/rd.inc index 3ebb641258..ef7435c366 100644 --- a/kernel/trunk/blkdev/rd.inc +++ b/kernel/trunk/blkdev/rd.inc @@ -1,13 +1,13 @@ $Revision$ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; +;; ;; ;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; -;; RAMDISK functions ;; -;; (C) 2004 Ville Turjanmaa, License: GPL ;; -;; Addings by M.Lisovin ;; -;; LFN support by diamond ;; +;; RAMDISK functions ;; +;; (C) 2004 Ville Turjanmaa, License: GPL ;; +;; Addings by M.Lisovin ;; +;; LFN support by diamond ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; calculate fat chain @@ -1444,14 +1444,19 @@ fat_gen_short_name: add ebx, edi sub ebx, ecx push ebx + cmp ebx, ecx + jb @f + pop ebx + push ecx +@@: cmp edi, ecx jbe .skip @@: dec edi - mov al, ' ' - xchg al, [edi] + mov al, [edi] dec ebx mov [ebx], al + mov byte [edi], ' ' cmp edi, ecx ja @b .skip: diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index c395b6c934..6513333204 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -305,6 +305,9 @@ virtual at (OS_BASE+0x043BF80) tss TSS end virtual +BgrDrawMode equ (OS_BASE+0x043EFF4) +BgrDataWidth equ (OS_BASE+0x043EFF8) +BgrDataHeight equ (OS_BASE+0x043EFFC) WinMapAddress equ (OS_BASE+0x043F000) display_data equ (OS_BASE+0x043F000) diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 5285ac66a1..4dba9826dc 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -107,7 +107,7 @@ use16 org 0x0 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/preboot.inc" @@ -521,9 +521,9 @@ high_code: ; set background xor eax,eax inc eax - mov [display_data-12],eax - mov [display_data-8],eax - mov [display_data-4],eax + mov [BgrDrawMode],eax + mov [BgrDataWidth],eax + mov [BgrDataHeight],eax mov [mem_BACKGROUND],4095 stdcall kernel_alloc, [mem_BACKGROUND] mov [img_background], eax @@ -1119,7 +1119,6 @@ set_variables: pop eax 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 ;!! IP 04.02.2005: @@ -2287,7 +2286,7 @@ endg iglobal 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 'Kolibri',0 version_end: @@ -2356,8 +2355,8 @@ sys_background: je sbgrr cmp ecx,0 je sbgrr - mov [display_data-8],ebx - mov [display_data-4],ecx + mov [BgrDataWidth],ebx + mov [BgrDataHeight],ecx ; mov [bgrchanged],1 pushad @@ -2366,18 +2365,17 @@ sys_background: ; calculate RAW size xor eax,eax inc eax - cmp [display_data-8],eax + cmp [BgrDataWidth],eax jae @f - mov [display_data-8],eax + mov [BgrDataWidth],eax @@: - cmp [display_data-4],eax + cmp [BgrDataHeight],eax jae @f - mov [display_data-4],eax + mov [BgrDataHeight],eax @@: - mov eax,[display_data-8] - imul eax,[display_data-4] - inc eax - imul eax,3 + mov eax,[BgrDataWidth] + imul eax,[BgrDataHeight] + lea eax,[eax*3] mov [mem_BACKGROUND],eax ; get memory for new background stdcall kernel_alloc, [mem_BACKGROUND] @@ -2425,9 +2423,9 @@ draw_background_temp: cmp eax,4 ; TILED / STRETCHED jnz nosb4 - cmp ebx,[display_data-12] + cmp ebx,[BgrDrawMode] je nosb41 - mov [display_data-12],ebx + mov [BgrDrawMode],ebx ; mov [bgrchanged],1 nosb41: ret @@ -2436,11 +2434,8 @@ draw_background_temp: cmp eax,5 ; BLOCK MOVE TO BGR jnz nosb5 ; bughere - mov edi, [TASK_BASE] - add ebx, [edi+TASKDATA.mem_start] mov eax, ebx mov ebx, ecx - add ecx, edx add ebx, [img_background] ;IMG_BACKGROUND mov ecx, edx call memmove @@ -2457,9 +2452,9 @@ sys_getbackground: cmp eax,1 ; SIZE jnz nogb1 - mov eax,[display_data-8] + mov eax,[BgrDataWidth] shl eax,16 - mov ax,[display_data-4] + mov ax,[BgrDataWidth] mov [esp+36],eax ret nogb1: @@ -2480,7 +2475,7 @@ sys_getbackground: cmp eax,4 ; TILED / STRETCHED jnz nogb4 - mov eax,[display_data-12] + mov eax,[BgrDrawMode] nogb4: mov [esp+36],eax ret @@ -4098,7 +4093,7 @@ drawbackground: call [draw_pointer] ret dbrv20: - cmp [display_data-12],dword 1 + cmp [BgrDrawMode],dword 1 jne bgrstr call vesa20_drawbackground_tiled dec [mouse_pause] diff --git a/kernel/trunk/video/vesa12.inc b/kernel/trunk/video/vesa12.inc index 8699b4ef2e..a78c5cc8fd 100644 --- a/kernel/trunk/video/vesa12.inc +++ b/kernel/trunk/video/vesa12.inc @@ -206,8 +206,8 @@ vesa12_drawbackground: push edx xor edx,edx - mov eax,dword[WinMapAddress-8] - mov ebx,dword[WinMapAddress-4] + mov eax,dword[BgrDataWidth] + mov ebx,dword[BgrDataHeight] mul ebx mov ebx,3 mul ebx @@ -220,23 +220,19 @@ vesa12_drawbackground: push eax 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 push edx xor edx,edx - mov ecx,[WinMapAddress-8] - div ecx - mov eax,edx + div dword [BgrDataWidth] - push eax + push edx mov eax,ebx xor edx,edx - mov ecx,[WinMapAddress-4] - div ecx + div dword [BgrDataHeight] mov ebx,edx pop eax @@ -244,21 +240,19 @@ vesa12_drawbackground: no_vesa12_tiled_bgr: - cmp [WinMapAddress-12],dword 2 ; stretched background + cmp [BgrDrawMode],dword 2 ; stretched background jne no_vesa12_stretched_bgr push edx - imul eax,dword [WinMapAddress-8] - xor edx,edx + mul dword [BgrDataWidth] mov ecx,[ScreenWidth] inc ecx div ecx push eax mov eax,ebx - imul eax,dword [WinMapAddress-4] - xor edx,edx + mul dword [BgrDataHeight] mov ecx,[ScreenHeight] inc ecx div ecx @@ -270,34 +264,26 @@ vesa12_drawbackground: no_vesa12_stretched_bgr: - push eax - mov eax,ebx - 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 + mov esi,ebx + imul esi, dword [BgrDataWidth] add esi,eax + lea esi,[esi*3] add esi,[img_background] ;IMG_BACKGROUND pop ebx pop eax v12di4: - mov ecx,[esi] + mov cl,[esi+2] + shl ecx,16 + mov cx,[esi] pusha mov esi,eax mov edi,ebx mov eax,[ScreenWidth] add eax,1 mul ebx - add eax,esi - add eax,WinMapAddress - cmp [eax],byte 1 + cmp [eax+esi+WinMapAddress],byte 1 jnz v12nbgp mov eax,[BytesPerScanLine] mov ebx,edi diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 08a9e9c01f..a08b50aaf7 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -769,330 +769,285 @@ align 4 ; ret - - - - -;--------------vbe voodoo ------------------------------------------------ vesa20_drawbackground_tiled: - call [disable_mouse] - push ebp - push eax - push ebx - push ecx - push edx - mov edx,dword [WinMapAddress-8] ; B - add edx,dword [WinMapAddress-8] ; +B - add edx,dword [WinMapAddress-8] ; +B - push edx - mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) - mov eax,[BytesPerScanLine] - mul ebx - xchg ebp, eax ; BytesPerScanLine*(Ywin+y) - add ebp, eax ; +X - add ebp, eax ; +X - add ebp, eax ; +X - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - add ebp,eax ; +X + call [disable_mouse] + pushad +; External loop for all y from start to end + mov ebx, [draw_data+32+RECT.top] ; y start +dp2: + mov ebp, [draw_data+32+RECT.left] ; x start +; 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 - call calculate_edi -dp3: ; MAIN LOOP - cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) - jne nbgp - push eax - push ebx - mov ecx,dword [WinMapAddress-8] ; B - xor edx,edx ; edx:=0 - div ecx ; Xstart/B -; eax=Int(qn) edx:=Rem - lea esi,[edx+edx*2] ; esi:=edx*3 - mov ecx,dword [WinMapAddress-4] ; ecx:=H - mov eax,[esp+0] ; eax:=Ystart - xor edx,edx ; - div ecx ; Ystart/H - mov eax,edx ; eax:=Rem - xor edx,edx ; - mov ebx,[esp+8] ; ebx:=B*3 - mul ebx ; - add esi,eax ; -; mov eax,[esi+IMG_BACKGROUND] - mov eax,[img_background] - mov eax,[esi+eax] - and eax,0xffffff - xchg edi, ebp - stosw - shr eax,16 - stosb - xchg ebp, edi ; ebp+=3 - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - inc ebp ; +1 -@@: - pop ebx - pop eax - jmp hook1 + call calculate_edi + xchg edi, ebp +; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress +; 2) Calculate offset in background memory block + push eax + xor edx, edx + mov eax, ebx + mov ecx, [BgrDataHeight] + div ecx ; edx := y mod BgrDataHeight + sub ecx, edx ; ecx := BgrDataHeight - (y mod BgrDataHeight) + pop eax + push eax + mov esi, edx + imul esi, [BgrDataWidth] ; esi := (y mod BgrDataHeight) * BgrDataWidth + xor edx, edx + div dword [BgrDataWidth] ; edx := x mod BgrDataWidth + add esi, edx ; esi := (y mod BgrDataHeight)*BgrDataWidth + (x mod BgrDataWidth) + pop eax + lea esi, [esi*3] + add esi, [img_background] + xor edx, edx + inc edx +; 3) Loop through redraw rectangle and copy background data +; Registers meaning: +; eax = x, ebx = y (screen coordinates) +; ecx = deltax - number of pixels left in current tile block +; edx = 1 +; esi -> bgr memory, edi -> output +; ebp = offset in WinMapAddress +dp3: + cmp [ebp+WinMapAddress], dl + jnz nbgp + movsb + movsb + movsb + jmp @f nbgp: - add ebp,3 ; +3 - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - inc ebp ; +1 + add esi, 3 + add edi, 3 @@: -hook1: - inc edi ; ptrBuffer++ - add esi,3 ; ptrImage+=3 - inc eax - cmp eax,[draw_data+32+RECT.right] ; X > xend? - jle dp3 - 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,[draw_data+32+RECT.bottom] - jle dp3 - add esp,4 - pop edx - pop ecx - pop ebx - pop eax - pop ebp - mov [EGA_counter],1 - call VGA_drawbackground - ret + cmp [ScreenBPP], byte 25 ; 24 or 32 bpp? + sbb edi, -1 ; +1 for 32 bpp +; I do not use 'inc eax' because this is slightly slower then 'add eax,1' + add ebp, edx + add eax, edx + cmp eax, [draw_data+32+RECT.right] + ja dp4 + sub ecx, edx + jnz dp3 +; next tile block on x-axis + mov ecx, [BgrDataWidth] + sub esi, ecx + sub esi, ecx + sub esi, ecx + jmp dp3 +dp4: +; next scan line + inc ebx + cmp ebx, [draw_data+32+RECT.bottom] + jbe dp2 + popad + mov [EGA_counter], 1 + call VGA_drawbackground + ret ; ---------- vesa20_drawbackground_stretch: - call [disable_mouse] - push ebp - push eax - push ebx - push ecx - push edx - mov edx,dword [WinMapAddress-8] ; B - add edx,dword [WinMapAddress-8] ; +B - add edx,dword [WinMapAddress-8] ; +B - push edx - mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin) - mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin) - mov eax,[BytesPerScanLine] - mul ebx - xchg ebp, eax ; BytesPerScanLine*(Ywin+y) - add ebp, eax ; +X - add ebp, eax ; +X - add ebp, eax ; +X - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - add ebp,eax ; +X + call [disable_mouse] + pushad +; Helper variables + mov eax, [BgrDataWidth] + xor edx, edx + mov ecx, [ScreenWidth] + inc ecx + div ecx + push eax ; quo + push edx ; rem + mov eax, [BgrDataHeight] + xor edx, edx + mov ecx, [ScreenHeight] + inc ecx + div ecx + push eax + push edx +; External loop for all y from start to end + mov ebx, [draw_data+32+RECT.top] ; y start + mov ebp, [draw_data+32+RECT.left] ; x start +; 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 - call calculate_edi - -sdp3: ; MAIN LOOP - cmp [edi+WinMapAddress],byte 1 ; ptrBuffer^<>byte(1) - jne snbgp - push eax - push ebx - mov eax,dword [WinMapAddress-8] - imul eax, [esp+4] ;4 - xor edx,edx - mov ebx,[ScreenWidth] - div ebx - mov cx,dx - lea esi,[eax+eax*2] - mov eax,dword [WinMapAddress-4] - imul eax, [esp+0] ;0 - xor edx,edx - mov ebx,[ScreenHeight] - div ebx - shl ecx,16 - mov cx,dx - imul eax, [esp+8] ;8 - add esi,eax -; mov eax,[esi+IMG_BACKGROUND] - mov eax,[img_background] - - push eax - mov eax,[display_data-4] - imul eax,[display_data-8] - imul eax,3 - sub eax,3 - cmp eax,esi - pop eax - jbe @f - - mov eax,[esi+eax] + call calculate_edi + xchg edi, ebp +; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress + push ebx +; 2) Calculate offset in background memory block + push eax + mov eax, ebx + mul dword [BgrDataHeight] + mov ecx, [ScreenHeight] + inc ecx + div ecx ; eax := y * BgrDataHeight / ScreenHeight + ; edx := (y * BgrDataHeight) mod ScreenHeight + mov esi, eax + pop eax + push edx ; dword [esp] = (y * BgrDataHeight) mod ScreenHeight + ; dword [esp+4] = y * BgrDataHeight / ScreenHeight + push eax + mov ecx, [BgrDataWidth] + mul ecx + imul esi, ecx + dec ecx + push ecx + mov ecx, [ScreenWidth] + inc ecx + div ecx ; eax := x * BgrDataWidth / ScreenWidth + ; edx := (x * BgrDataWidth) mod ScreenWidth + add esi, eax + lea esi, [esi*3] + add esi, [img_background] + push ecx edx esi +; 3) Loop through redraw rectangle and copy background data +; Registers meaning: +; ecx = (x * BgrDataWidth) / ScreenWidth +; edx = (x * BgrDataWidth) mod ScreenWidth (used to fast recalculating of ecx,esi) +; esi -> bgr memory, edi -> output +; 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 - ror ecx,16 - xor eax,eax - mov ax,cx - shl eax,1 ; умножение на 2 - lea eax,[eax+eax*4] ; умножение на 5 - xor edx,edx - mov ebx,[ScreenWidth] - div ebx - cmp eax,5 - pop eax - jb @f -; mov ebx,[esi+IMG_BACKGROUND+3] - mov ebx,[img_background] - - push eax - mov eax,[display_data-4] - imul eax,[display_data-8] - imul eax,3 - sub eax,3 - cmp eax,esi - pop eax - jbe @f - - mov ebx,[esi+ebx+3] - - call overlapping_of_points + mov [edi], ax + shr eax, 16 + mov [edi+2], al +snbgp: + cmp [ScreenBPP], byte 25 + sbb edi, -4 + add ebp, 1 + mov eax, [esp+16] + add eax, 1 + mov [esp+16], eax + cmp eax, [draw_data+32+RECT.right] + ja sdp4 + mov eax, [esp+40] + add ecx, eax + lea eax, [eax*3] + add esi, eax + add edx, [esp+36] + cmp edx, [ScreenWidth] + jbe sdp3 + sub edx, [ScreenWidth] + add ecx, 1 + add esi, 3 + sub edx, 1 + jmp sdp3 +sdp4: +; next y + 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 - ror ecx,16 - xor eax,eax - mov ax,cx - shl eax,1 ; умножение на 2 - lea eax,[eax+eax*4] ; умножение на - xor edx,edx - mov ebx,[ScreenHeight] - div ebx - cmp eax,5 - pop eax - jb @f - 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 + add edi, [BytesPerScanLine] +; restore ecx,edx; advance esi to next background line + pop esi edx ecx + push ecx edx + xor ebx, ebx + mov eax, [esp+20-4] + add eax, [esp+28-4] + cmp eax, [ScreenHeight] + jbe @f + sub eax, [ScreenHeight] + mov ebx, 1 + sub eax, ebx @@: - and eax,0xffffff - xchg edi, ebp - stosw - shr eax,16 - stosb - xchg ebp, edi ; ebp+=3 - cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size - jz @f - inc ebp ; +1 -@@: - pop ebx - pop eax - jmp shook1 + mov [esp+20-4], eax + add ebx, [esp+32-4] + lea ebx, [ebx*3] + imul ebx, [BgrDataWidth] + add esi, ebx + push esi + mov eax, [draw_data+32+RECT.left] + mov [esp+16], eax + jmp sdp3 +sdpdone: + add esp, 44 + popad + mov [EGA_counter],1 + call VGA_drawbackground + ret overlapping_of_points: - push ecx edi - mov ecx,eax - mov edx,ebx - xor eax,eax - mov al,cl - xor ebx,ebx - mov bl,dl - add eax,ebx - rcr eax,1 - xor edi,edi - mov di,ax - xor eax,eax - mov al,ch - xor ebx,ebx - mov bl,dh - add eax,ebx - rcr eax,1 - ror edi,8 - add edi,eax - ror ecx,8 - ror edx,8 - xor eax,eax - mov al,ch - xor ebx,ebx - mov bl,dh - 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 + push ecx edx edi + mov ecx, eax + mov edx, ebx + movzx eax, cl + movzx ebx, dl + add eax, ebx + rcr eax, 1 + movzx edi, ax + movzx eax, ch + movzx ebx, dh + add eax, ebx + rcr eax, 1 + ror edi, 8 + add edi, eax + shr ecx, 8 + shr edx, 8 + movzx eax, ch + movzx ebx, dh + add eax, ebx + rcr eax, 1 + ror edi, 8 + add eax, edi + ror eax, 16 + pop edi edx ecx + ret