Fix for r.2446 - for Qemu or non-standart videocards. Unfortunately [BytesPerScanLine] does not always equal to [_display.width]*[ScreenBPP]/8

git-svn-id: svn://kolibrios.org@2480 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Marat Zakiyanov (Mario79) 2012-03-19 20:56:55 +00:00
parent a6e69b9e82
commit 4ba4f03104
6 changed files with 38 additions and 76 deletions

View File

@ -190,6 +190,8 @@ TASK_DATA equ (OS_BASE+0x0003020)
TASK_EVENT equ (OS_BASE+0x0003020)
d_width_calc_area equ (OS_BASE+0x0005000)
BPSLine_calc_area equ (OS_BASE+0x0339000)
mouseunder equ (OS_BASE+0x0006900)
CDDataBuf equ (OS_BASE+0x0007000)
FLOPPY_BUFF equ (OS_BASE+0x0008000)

View File

@ -403,6 +403,10 @@ high_code:
mov [_WinMapSize], eax
call calculate_fast_getting_offset_for_WinMapAddress
; for Qemu or non standart video cards
; Unfortunately [BytesPerScanLine] does not always
; equal to [_display.width] * [ScreenBPP] / 8
call calculate_fast_getting_offset_for_LFB
mov esi, BOOT_VAR+0x9080
movzx ecx, byte [esi-1]
@ -4849,6 +4853,21 @@ calculate_fast_getting_offset_for_WinMapAddress:
ret
;------------------------------------------------------------------------------
align 4
calculate_fast_getting_offset_for_LFB:
; calculate data area for fast getting offset to LFB
xor eax, eax
mov ecx, [_display.height]
inc ecx
mov edi, BPSLine_calc_area
cld
@@:
stosd
add eax, [BytesPerScanLine]
dec ecx
jnz @r
ret
;------------------------------------------------------------------------------
align 4
set_screen:
cmp eax, [Screen_Max_X]
jne .set

View File

@ -246,7 +246,8 @@
; 04 dword draw limit - y start
; 08 dword draw limit - x end
; 0C dword draw limit - y end
; 0x80339000 -> 3BFFF3 free (12k)
; 0x80339000 -> 33A7FF area for fast getting offset to LFB (6k)
; 0x8033A800 -> 3BFFF3 free (6k)
; 0x8033BFF4 -> 33BFFF background info
; 0x8033C000 page map (length b = memsize shr 15)
; 0x8033C000 + b start of static pagetables

View File

@ -345,9 +345,10 @@ blit_32:
mov edi, ebp
imul edi, [_display.pitch]
; imul edi, [_display.pitch]
mov edi, [BPSLine_calc_area+edi*4]
; imul ebp, [_display.width]
mov ebp, [d_width_calc_area + ebp*4]
mov ebp, [d_width_calc_area+ebp*4]
add ebp, ebx
add ebp, [_WinMapAddress]

View File

@ -618,9 +618,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
mov [_dy], edx
; mul dword [BytesPerScanLine]
mov eax, [d_width_calc_area + eax*4]
lea eax, [eax + eax*2]
mov eax, [BPSLine_calc_area+eax*4]
lea edx, [LFB_BASE+ecx*3]
add edx, eax
mov [cur_saved_base], edx
@ -737,9 +735,7 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword
mov [_dy], edx
; mul dword [BytesPerScanLine]
mov eax, [d_width_calc_area + eax*4]
shl eax, 2
mov eax, [BPSLine_calc_area+eax*4]
lea edx, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base], edx

View File

@ -72,8 +72,7 @@ align 4
.no_mouseunder:
;--------------------------------------
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2]; edi = x*3
add edi, ebx ; edi = x*3+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
@ -105,8 +104,7 @@ align 4
.no_mouseunder:
;--------------------------------------
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov ecx, [LFB_BASE+edi]
;--------------------------------------
@ -243,19 +241,7 @@ align 4
; pointer to screen
mov edx, [putimg.abs_cy]
; imul edx, [BytesPerScanLine]
mov edx, [d_width_calc_area + edx*4]
cmp bl, 4
je .32
lea edx, [edx+edx*2]
jmp @f
;-------------------------------------
align 4
.32:
shl edx, 2
;-------------------------------------
align 4
@@:
mov edx, [BPSLine_calc_area+edx*4]
mov eax, [putimg.abs_cx]
; movzx ebx, byte [ScreenBPP]
; shr ebx, 3
@ -740,9 +726,7 @@ Vesa20_putpixel24:
mov cx, bx
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
;--------------------------------------
@ -771,9 +755,7 @@ Vesa20_putpixel24_new:
mov cx, bx
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
lea ebx, [ebx + ebx*2]
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [eax+eax*2]; edi = x*3
mov eax, [esp+32-8+4]
;--------------------------------------
@ -819,9 +801,7 @@ Vesa20_putpixel32:
mov cx, bx
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color
;--------------------------------------
@ -849,9 +829,7 @@ Vesa20_putpixel32_new:
mov cx, bx
; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier
mov ebx, [d_width_calc_area + ebx*4]
shl ebx, 2
mov ebx, [BPSLine_calc_area+ebx*4]
lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier)
mov eax, [esp+32-8+4]; eax = color
;--------------------------------------
@ -1238,19 +1216,7 @@ align 4
; pointer to screen
mov edx, [drbar.abs_cy]
; imul edx, [BytesPerScanLine]
mov edx, [d_width_calc_area + edx*4]
cmp bl, 4
je .32
lea edx, [edx+edx*2]
jmp @f
;-------------------------------------
align 4
.32:
shl edx, 2
;-------------------------------------
align 4
@@:
mov edx, [BPSLine_calc_area+edx*4]
mov eax, [drbar.abs_cx]
imul eax, ebx
add edx, eax
@ -1656,18 +1622,7 @@ dp2:
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
; mul ebx
mov eax, [d_width_calc_area + ebx*4]
cmp [ScreenBPP], byte 32
je .32
lea eax, [eax+eax*2]
jmp @f
;-------------------------------------
align 4
.32:
shl eax, 2
;-------------------------------------
align 4
@@:
mov eax, [BPSLine_calc_area+ebx*4]
xchg ebp, eax
add ebp, eax
add ebp, eax
@ -1813,19 +1768,7 @@ vesa20_drawbackground_stretch:
; and LFB data (output for our function) [edi]
; mov eax, [BytesPerScanLine]
; mul ebx
mov eax, [d_width_calc_area + ebx*4]
cmp [ScreenBPP], byte 32
je .32
lea eax, [eax+eax*2]
jmp @f
;-------------------------------------
align 4
.32:
shl eax, 2
;-------------------------------------
align 4
@@:
mov eax, [BPSLine_calc_area+ebx*4]
xchg ebp, eax
add ebp, eax
add ebp, eax