forked from KolibriOS/kolibrios
* 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:
parent
6c6a00efd0
commit
141e4c2c3d
@ -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:
|
||||||
|
@ -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)
|
||||||
|
|
||||||
|
@ -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]
|
||||||
|
@ -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
|
||||||
|
@ -769,108 +769,89 @@ 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
|
|
||||||
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
|
mul ebx
|
||||||
xchg ebp, eax ; BytesPerScanLine*(Ywin+y)
|
xchg ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
|
||||||
jz @f
|
jz @f
|
||||||
add ebp,eax ; +X
|
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
|
||||||
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
|
xchg edi, ebp
|
||||||
stosw
|
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
||||||
shr eax,16
|
; 2) Calculate offset in background memory block
|
||||||
stosb
|
push eax
|
||||||
xchg ebp, edi ; ebp+=3
|
xor edx, edx
|
||||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
mov eax, ebx
|
||||||
jz @f
|
mov ecx, [BgrDataHeight]
|
||||||
inc ebp ; +1
|
div ecx ; edx := y mod BgrDataHeight
|
||||||
@@:
|
sub ecx, edx ; ecx := BgrDataHeight - (y mod BgrDataHeight)
|
||||||
pop ebx
|
|
||||||
pop eax
|
pop eax
|
||||||
jmp hook1
|
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:
|
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
|
||||||
|
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
|
inc ebx
|
||||||
mov eax,[BytesPerScanLine]
|
cmp ebx, [draw_data+32+RECT.bottom]
|
||||||
mul ebx
|
jbe dp2
|
||||||
xchg ebp, eax ; BytesPerScanLine*(Ywin+y)
|
popad
|
||||||
add ebp, eax ; +X
|
mov [EGA_counter], 1
|
||||||
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
|
call VGA_drawbackground
|
||||||
ret
|
ret
|
||||||
|
|
||||||
@ -879,220 +860,194 @@ hook1:
|
|||||||
|
|
||||||
vesa20_drawbackground_stretch:
|
vesa20_drawbackground_stretch:
|
||||||
call [disable_mouse]
|
call [disable_mouse]
|
||||||
push ebp
|
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 eax
|
||||||
push ebx
|
|
||||||
push ecx
|
|
||||||
push edx
|
push edx
|
||||||
mov edx,dword [WinMapAddress-8] ; B
|
; External loop for all y from start to end
|
||||||
add edx,dword [WinMapAddress-8] ; +B
|
mov ebx, [draw_data+32+RECT.top] ; y start
|
||||||
add edx,dword [WinMapAddress-8] ; +B
|
mov ebp, [draw_data+32+RECT.left] ; x start
|
||||||
push edx
|
; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp]
|
||||||
mov ebp,[draw_data+32+RECT.left] ; x start:=(x+Xwin)
|
; and LFB data (output for our function) [edi]
|
||||||
mov ebx,[draw_data+32+RECT.top] ; y start:=(y+Ywin)
|
mov eax, [BytesPerScanLine]
|
||||||
mov eax,[BytesPerScanLine]
|
|
||||||
mul ebx
|
mul ebx
|
||||||
xchg ebp, eax ; BytesPerScanLine*(Ywin+y)
|
xchg ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
add ebp, eax ; +X
|
add ebp, eax
|
||||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size
|
||||||
jz @f
|
jz @f
|
||||||
add ebp,eax ; +X
|
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
|
||||||
|
|
||||||
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]
|
|
||||||
@@:
|
|
||||||
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
|
|
||||||
@@:
|
|
||||||
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
|
|
||||||
@@:
|
|
||||||
and eax,0xffffff
|
|
||||||
xchg edi, ebp
|
xchg edi, ebp
|
||||||
stosw
|
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
|
||||||
shr eax,16
|
push ebx
|
||||||
stosb
|
; 2) Calculate offset in background memory block
|
||||||
xchg ebp, edi ; ebp+=3
|
push eax
|
||||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
mov eax, ebx
|
||||||
jz @f
|
mul dword [BgrDataHeight]
|
||||||
inc ebp ; +1
|
mov ecx, [ScreenHeight]
|
||||||
@@:
|
inc ecx
|
||||||
pop ebx
|
div ecx ; eax := y * BgrDataHeight / ScreenHeight
|
||||||
|
; edx := (y * BgrDataHeight) mod ScreenHeight
|
||||||
|
mov esi, eax
|
||||||
pop eax
|
pop eax
|
||||||
jmp shook1
|
push edx ; dword [esp] = (y * BgrDataHeight) mod ScreenHeight
|
||||||
|
; dword [esp+4] = y * BgrDataHeight / ScreenHeight
|
||||||
overlapping_of_points:
|
push eax
|
||||||
push ecx edi
|
mov ecx, [BgrDataWidth]
|
||||||
mov ecx,eax
|
mul ecx
|
||||||
mov edx,ebx
|
imul esi, ecx
|
||||||
xor eax,eax
|
dec ecx
|
||||||
mov al,cl
|
push ecx
|
||||||
xor ebx,ebx
|
mov ecx, [ScreenWidth]
|
||||||
mov bl,dl
|
inc ecx
|
||||||
add eax,ebx
|
div ecx ; eax := x * BgrDataWidth / ScreenWidth
|
||||||
rcr eax,1
|
; edx := (x * BgrDataWidth) mod ScreenWidth
|
||||||
xor edi,edi
|
add esi, eax
|
||||||
mov di,ax
|
lea esi, [esi*3]
|
||||||
xor eax,eax
|
add esi, [img_background]
|
||||||
mov al,ch
|
push ecx edx esi
|
||||||
xor ebx,ebx
|
; 3) Loop through redraw rectangle and copy background data
|
||||||
mov bl,dh
|
; Registers meaning:
|
||||||
add eax,ebx
|
; ecx = (x * BgrDataWidth) / ScreenWidth
|
||||||
rcr eax,1
|
; edx = (x * BgrDataWidth) mod ScreenWidth (used to fast recalculating of ecx,esi)
|
||||||
ror edi,8
|
; esi -> bgr memory, edi -> output
|
||||||
add edi,eax
|
; ebp = offset in WinMapAddress
|
||||||
ror ecx,8
|
; dword [esp] = saved esi
|
||||||
ror edx,8
|
; dword [esp+4] = saved edx
|
||||||
xor eax,eax
|
; dword [esp+8] = saved ecx
|
||||||
mov al,ch
|
; dword [esp+12] = limit for overlapping of points
|
||||||
xor ebx,ebx
|
; dword [esp+16] = x
|
||||||
mov bl,dh
|
; dword [esp+20] = (y * BgrDataHeight) mod ScreenHeight (used to fast recalculating of esi)
|
||||||
add eax,ebx
|
; dword [esp+24] = y
|
||||||
rcr eax,1
|
; precalculated constants:
|
||||||
ror edi,8
|
; dword [esp+28] = BgrDataHeight mod ScreenHeight
|
||||||
add eax,edi
|
; dword [esp+32] = BgrDataHeight div ScreenHeight
|
||||||
ror eax,16
|
; dword [esp+36] = BgrDataWidth mod ScreenWidth
|
||||||
pop edi ecx
|
; dword [esp+40] = BgrDataWidth div ScreenWidth
|
||||||
ret
|
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
|
||||||
|
@@:
|
||||||
|
mov [edi], ax
|
||||||
|
shr eax, 16
|
||||||
|
mov [edi+2], al
|
||||||
snbgp:
|
snbgp:
|
||||||
add ebp,3 ; +3
|
cmp [ScreenBPP], byte 25
|
||||||
cmp [ScreenBPP],byte 24 ; 24 or 32 bpp ? - x size
|
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
|
jz @f
|
||||||
inc ebp ; +1
|
sub edi, eax
|
||||||
@@:
|
@@:
|
||||||
|
add edi, [BytesPerScanLine]
|
||||||
shook1:
|
; restore ecx,edx; advance esi to next background line
|
||||||
inc edi ; ptrBuffer++
|
pop esi edx ecx
|
||||||
add esi,3 ; ptrImage+=3
|
push ecx edx
|
||||||
inc eax
|
xor ebx, ebx
|
||||||
cmp eax,[draw_data+32+RECT.right] ; X > xend?
|
mov eax, [esp+20-4]
|
||||||
jle sdp3
|
add eax, [esp+28-4]
|
||||||
; jbe sdp3
|
cmp eax, [ScreenHeight]
|
||||||
|
jbe @f
|
||||||
mov ebp,[draw_data+32+RECT.left]
|
sub eax, [ScreenHeight]
|
||||||
|
mov ebx, 1
|
||||||
inc ebx
|
sub eax, 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
|
mov [esp+20-4], eax
|
||||||
|
add ebx, [esp+32-4]
|
||||||
; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB
|
lea ebx, [ebx*3]
|
||||||
|
imul ebx, [BgrDataWidth]
|
||||||
call calculate_edi
|
add esi, ebx
|
||||||
|
push esi
|
||||||
; cmp ebx,[ScreenHeight]
|
mov eax, [draw_data+32+RECT.left]
|
||||||
; ja @f
|
mov [esp+16], eax
|
||||||
|
jmp sdp3
|
||||||
cmp ebx,[draw_data+32+RECT.bottom]
|
sdpdone:
|
||||||
jle sdp3
|
add esp, 44
|
||||||
; jbe sdp3
|
popad
|
||||||
@@:
|
|
||||||
add esp,4
|
|
||||||
|
|
||||||
pop edx
|
|
||||||
pop ecx
|
|
||||||
pop ebx
|
|
||||||
pop eax
|
|
||||||
pop ebp
|
|
||||||
mov [EGA_counter],1
|
mov [EGA_counter],1
|
||||||
call VGA_drawbackground
|
call VGA_drawbackground
|
||||||
ret
|
ret
|
||||||
|
|
||||||
|
overlapping_of_points:
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user