Support for 16bpp video modes (usefull for embedded devices such as 86duino with vortex86 VGA)

git-svn-id: svn://kolibrios.org@5154 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
hidnplayr 2014-11-01 17:26:42 +00:00
parent 62b33c4994
commit 274d2c309b
8 changed files with 1431 additions and 839 deletions

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -218,14 +218,16 @@ calc_vmodes_table:
test [es:mi.ModeAttributes], 10000000b ;LFB ? test [es:mi.ModeAttributes], 10000000b ;LFB ?
jz @f jz @f
cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp cmp [es:mi.BitsPerPixel], 16 ;List only supported videomodes (16, 24 and 32 bpp)
jb @f jb @f
; cmp [es:mi.BitsPerPixel],16 ; 16 bpp might actually be 15 bpp
; jne .l0 cmp [es:mi.BitsPerPixel], 16
; cmp [es:mi.GreenMaskSize],5 jne .l0
; jne .l0 cmp [es:mi.GreenMaskSize], 5
jne .l0
; mov [es:mi.BitsPerPixel],15 ; mov [es:mi.BitsPerPixel],15
jmp @f ; 15 bpp isnt supported ATM
.l0: .l0:

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -430,7 +430,8 @@ struct display_t
y dd ? y dd ?
width dd ? width dd ?
height dd ? height dd ?
bpp dd ? bits_per_pixel dd ?
bytes_per_pixel dd ?
vrefresh dd ? vrefresh dd ?
pitch dd ? pitch dd ?
lfb dd ? lfb dd ?

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -378,14 +378,14 @@ _display display_t
_WinMapAddress rd 1 _WinMapAddress rd 1
_WinMapSize rd 1 _WinMapSize rd 1
LFBAddress rd 1 LFBAddress dd ?
Screen_Max_X rd 1 Screen_Max_X dd ?
Screen_Max_Y rd 1 Screen_Max_Y dd ?
SCR_MODE rw 2 SCR_MODE rw 2
PUTPIXEL rd 1 PUTPIXEL dd ?
GETPIXEL rd 1 GETPIXEL dd ?
if VESA_1_2_VIDEO if VESA_1_2_VIDEO
BANK_SWITCH rd 1 reserved for vesa 1.2 BANK_SWITCH rd 1 reserved for vesa 1.2
@ -401,7 +401,7 @@ d_width_calc_area rd 1140
mouseunder rd 16*24 mouseunder rd 16*24
MOUSE_PICTURE rd 1 MOUSE_PICTURE dd ?
MOUSE_SCROLL_H rw 1 MOUSE_SCROLL_H rw 1
MOUSE_X: rw 1 MOUSE_X: rw 1

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -24,29 +24,28 @@ $Revision$
uglobal uglobal
;-------------------------------------- ;--------------------------------------
align 4 align 4
mousecount dd 0x0 mousecount dd ?
mousedata dd 0x0 mousedata dd ?
Y_UNDER_sub_CUR_hot_y_add_curh: Y_UNDER_sub_CUR_hot_y_add_curh dw ?
dw 0 Y_UNDER_subtraction_CUR_hot_y dw ?
Y_UNDER_subtraction_CUR_hot_y: X_UNDER_sub_CUR_hot_x_add_curh dw ?
dw 0 X_UNDER_subtraction_CUR_hot_x dw ?
X_UNDER_sub_CUR_hot_x_add_curh:
dw 0
X_UNDER_subtraction_CUR_hot_x:
dw 0
endg endg
iglobal iglobal
;-------------------------------------- ;--------------------------------------
align 4 align 4
mouse_delay dd 10 mouse_delay dd 10
mouse_speed_factor: mouse_speed_factor:
dd 3 dd 3
mouse_timer_ticks dd 0 mouse_timer_ticks dd 0
endg endg
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
draw_mouse_under: draw_mouse_under:
; return old picture ; return old picture
cmp [_display.restore_cursor], 0 cmp [_display.restore_cursor], 0
je @F je @F
@ -57,15 +56,13 @@ draw_mouse_under:
stdcall [_display.restore_cursor], eax, ebx stdcall [_display.restore_cursor], eax, ebx
popad popad
ret ret
;--------------------------------------
align 4 @@:
@@:
pushad pushad
xor ecx, ecx xor ecx, ecx
xor edx, edx xor edx, edx
;--------------------------------------
align 4 mres:
mres:
movzx eax, word [X_UNDER] movzx eax, word [X_UNDER]
movzx ebx, word [Y_UNDER] movzx ebx, word [Y_UNDER]
add eax, ecx add eax, ecx
@ -97,7 +94,9 @@ mres:
jnz mres jnz mres
popad popad
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
save_draw_mouse: save_draw_mouse:
cmp [_display.move_cursor], 0 cmp [_display.move_cursor], 0
@ -173,11 +172,13 @@ drm:
push edx push edx
; helloworld ; helloworld
push ecx push ecx
add eax, ecx; save picture under mouse add eax, ecx ; save picture under mouse
add ebx, edx add ebx, edx
push ecx push ecx
or ecx, 0x04000000 ; don't load to mouseunder area or ecx, 0x04000000 ; don't load to mouseunder area
call getpixel push eax ebx edx edi
call [GETPIXEL]
pop edi edx ebx eax
mov [COLOR_TEMP], ecx mov [COLOR_TEMP], ecx
pop ecx pop ecx
mov eax, edx mov eax, edx
@ -189,12 +190,12 @@ drm:
and ebx, 0xffffff and ebx, 0xffffff
mov [eax], ebx mov [eax], ebx
pop ecx pop ecx
mov edi, edx ; y cycle mov edi, edx ; y cycle
shl edi, 4 ; *16 bytes per row shl edi, 4 ; *16 bytes per row
add edi, ecx ; x cycle add edi, ecx ; x cycle
mov esi, edi mov esi, edi
add edi, esi add edi, esi
add edi, esi ; *3 add edi, esi ; *3
add edi, [MOUSE_PICTURE] ; we have our str address add edi, [MOUSE_PICTURE] ; we have our str address
mov esi, edi mov esi, edi
add esi, 16*24*3 add esi, 16*24*3
@ -208,19 +209,19 @@ drm:
pop ecx pop ecx
pop ebx pop ebx
pop eax pop eax
add eax, ecx ; we have x coord+cycle add eax, ecx ; we have x coord+cycle
add ebx, edx ; and y coord+cycle add ebx, edx ; and y coord+cycle
push ecx push ecx
mov ecx, [MOUSE_COLOR_MEM] mov ecx, [MOUSE_COLOR_MEM]
mov edi, 1 ; force mov edi, 1 ; force
or ecx, 0x04000000 ; don't save to mouseunder area or ecx, 0x04000000 ; don't save to mouseunder area
; call [putpixel] ; call [putpixel]
call __sys_putpixel call __sys_putpixel
pop ecx pop ecx
mov ebx, [esp+0] ; pure y coord again mov ebx, [esp+0] ; pure y coord again
mov eax, [esp+4] ; and x mov eax, [esp+4] ; and x
inc ecx ; +1 cycle inc ecx ; +1 cycle
cmp ecx, 16 ; if more than 16 cmp ecx, 16 ; if more than 16
jnz drm jnz drm
xor ecx, ecx xor ecx, ecx
inc edx inc edx
@ -229,7 +230,9 @@ drm:
add esp, 8 add esp, 8
popad popad
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
combine_colors: combine_colors:
; in ; in
@ -244,7 +247,7 @@ combine_colors:
push edx push edx
push ecx push ecx
xor ecx, ecx xor ecx, ecx
; byte 2 ; byte 0
mov eax, 0xff mov eax, 0xff
sub al, [esi+0] sub al, [esi+0]
mov ebx, [esp] mov ebx, [esp]
@ -298,7 +301,9 @@ combine_colors:
pop ebx pop ebx
pop eax pop eax
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
check_mouse_area_for_getpixel: check_mouse_area_for_getpixel:
; in: ; in:
@ -309,26 +314,26 @@ check_mouse_area_for_getpixel:
push eax ebx push eax ebx
; check for Y ; check for Y
xor ecx, ecx xor ecx, ecx
mov cx, [Y_UNDER] ; [MOUSE_Y] mov cx, [Y_UNDER] ; [MOUSE_Y]
cmp ebx, ecx cmp ebx, ecx
jb .no_mouse_area jb .no_mouse_area
add ecx, 23 ; mouse cursor Y size add ecx, 23 ; mouse cursor Y size
cmp ebx, ecx cmp ebx, ecx
ja .no_mouse_area ja .no_mouse_area
; offset Y ; offset Y
sub bx, [Y_UNDER] ;[MOUSE_Y] sub bx, [Y_UNDER] ; [MOUSE_Y]
;-------------------------------------- ;--------------------------------------
; check for X ; check for X
xor ecx, ecx xor ecx, ecx
mov cx, [X_UNDER] ;[MOUSE_X] mov cx, [X_UNDER] ; [MOUSE_X]
cmp eax, ecx cmp eax, ecx
jb .no_mouse_area jb .no_mouse_area
add ecx, 15 ; mouse cursor X size add ecx, 15 ; mouse cursor X size
cmp eax, ecx cmp eax, ecx
ja .no_mouse_area ja .no_mouse_area
; offset X ; offset X
sub ax, [X_UNDER] ;[MOUSE_X] sub ax, [X_UNDER] ; [MOUSE_X]
;-------------------------------------- ;--------------------------------------
; eax = offset x ; eax = offset x
; ebx = offset y ; ebx = offset y
@ -341,13 +346,14 @@ check_mouse_area_for_getpixel:
or ecx, 0xff000000 or ecx, 0xff000000
pop ebx eax pop ebx eax
ret ret
;--------------------------------------
align 4 .no_mouse_area:
.no_mouse_area:
xor ecx, ecx xor ecx, ecx
pop ebx eax pop ebx eax
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
check_mouse_area_for_putpixel: check_mouse_area_for_putpixel:
; in: ; in:
@ -357,29 +363,29 @@ check_mouse_area_for_putpixel:
; eax = new color ; eax = new color
push eax push eax
; check for Y ; check for Y
mov ax, [Y_UNDER] ; [MOUSE_Y] mov ax, [Y_UNDER] ; [MOUSE_Y]
cmp cx, ax cmp cx, ax
jb .no_mouse_area jb .no_mouse_area
add ax, 23 ; mouse cursor Y size add ax, 23 ; mouse cursor Y size
cmp cx, ax cmp cx, ax
ja .no_mouse_area ja .no_mouse_area
; offset Y ; offset Y
sub cx, [Y_UNDER] ;[MOUSE_Y] sub cx, [Y_UNDER] ; [MOUSE_Y]
mov ax, cx mov ax, cx
shl eax, 16 shl eax, 16
;--------------------------------------
; check for X ; check for X
mov ax, [X_UNDER] ;[MOUSE_X] mov ax, [X_UNDER] ; [MOUSE_X]
shr ecx, 16 shr ecx, 16
cmp cx, ax cmp cx, ax
jb .no_mouse_area jb .no_mouse_area
add ax, 15 ; mouse cursor X size add ax, 15 ; mouse cursor X size
cmp cx, ax cmp cx, ax
ja .no_mouse_area ja .no_mouse_area
; offset X ; offset X
sub cx, [X_UNDER] ;[MOUSE_X] sub cx, [X_UNDER] ; [MOUSE_X]
mov ax, cx mov ax, cx
;--------------------------------------
; eax = (offset y) shl 16 + (offset x) ; eax = (offset y) shl 16 + (offset x)
pop ecx pop ecx
@ -387,8 +393,8 @@ check_mouse_area_for_putpixel:
push eax ebx push eax ebx
mov ebx, eax mov ebx, eax
shr ebx, 16 ;y shr ebx, 16 ; y
and eax, 0xffff ;x and eax, 0xffff ; x
shl ebx, 6 shl ebx, 6
shl eax, 2 shl eax, 2
@ -401,27 +407,25 @@ check_mouse_area_for_putpixel:
push esi edi push esi edi
rol eax, 16 rol eax, 16
movzx edi, ax ; y cycle movzx edi, ax ; y cycle
shl edi, 4 ; *16 bytes per row shl edi, 4 ; *16 bytes per row
shr eax, 16 shr eax, 16
add edi, eax ; x cycle add edi, eax ; x cycle
lea edi, [edi*3] lea edi, [edi*3]
add edi, [MOUSE_PICTURE] ; we have our str address add edi, [MOUSE_PICTURE] ; we have our str address
mov esi, edi mov esi, edi
add esi, 16*24*3 add esi, 16*24*3
call combine_colors call combine_colors
pop edi esi pop edi esi
;--------------------------------------
align 4
.end:
mov eax, ecx mov eax, ecx
ret ret
;--------------------------------------
align 4 .no_mouse_area:
.no_mouse_area:
pop eax pop eax
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
__sys_draw_pointer: __sys_draw_pointer:
pushad pushad
@ -433,14 +437,14 @@ __sys_draw_pointer:
je @f je @f
mov [redrawmouse_unconditional], 0 mov [redrawmouse_unconditional], 0
jmp redrawmouse jmp redrawmouse
;-------------------------------------- @@:
align 4
@@:
cmp eax, ecx cmp eax, ecx
jne redrawmouse jne redrawmouse
cmp ebx, edx cmp ebx, edx
je nodmp je nodmp
;-------------------------------------- ;--------------------------------------
align 4 align 4
redrawmouse: redrawmouse:
pushfd pushfd
@ -468,21 +472,19 @@ redrawmouse:
mov [X_UNDER_subtraction_CUR_hot_x], ax mov [X_UNDER_subtraction_CUR_hot_x], ax
add eax, [cur.w] add eax, [cur.w]
mov [X_UNDER_sub_CUR_hot_x_add_curh], ax mov [X_UNDER_sub_CUR_hot_x_add_curh], ax
;-------------------------------------- @@:
align 4
@@:
popfd popfd
;-------------------------------------- nodmp:
align 4
nodmp:
popad popad
ret ret
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword
mov eax, [BtnState] mov eax, [BtnState]
and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements and eax, 0x3FFFFFFF ; Top 2 bits are used to flag absolute movements
mov [BTN_DOWN], eax mov [BTN_DOWN], eax
;-------------------------------------- ;--------------------------------------
mov eax, [XMoving] mov eax, [XMoving]
@ -538,7 +540,9 @@ proc set_mouse_data stdcall uses edx, BtnState:dword, XMoving:dword, YMoving:dwo
call wakeup_osloop call wakeup_osloop
ret ret
endp endp
;----------------------------------------------------------------------------- ;-----------------------------------------------------------------------------
align 4 align 4
mouse_acceleration: mouse_acceleration:
push eax push eax
@ -550,8 +554,5 @@ mouse_acceleration:
;push edx ;push edx
imul eax, [mouse_speed_factor] imul eax, [mouse_speed_factor]
;pop edx ;pop edx
;-------------------------------------- @@:
align 4
@@:
ret ret
;-----------------------------------------------------------------------------

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2013. All rights reserved. ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved.
;; PROGRAMMING: ;; PROGRAMMING:
;; Ivan Poddubny ;; Ivan Poddubny
;; Marat Zakiyanov (Mario79) ;; Marat Zakiyanov (Mario79)
@ -434,7 +434,7 @@ high_code:
mov al, [BOOT_VARS+BOOT_DMA] ; DMA access mov al, [BOOT_VARS+BOOT_DMA] ; DMA access
mov [allow_dma_access], al mov [allow_dma_access], al
movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp movzx eax, byte [BOOT_VARS+BOOT_BPP] ; bpp
mov [_display.bpp], eax mov [_display.bits_per_pixel], eax
mov [_display.vrefresh], 60 mov [_display.vrefresh], 60
mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen mov al, [BOOT_VARS+BOOT_DEBUG_PRINT] ; If nonzero, duplicates debug output to the screen
mov [debug_direct_print], al mov [debug_direct_print], al
@ -480,34 +480,56 @@ high_code:
mov edi, BiosDisksData mov edi, BiosDisksData
rep movsd rep movsd
; GRAPHICS ADDRESSES setvideomode:
mov eax, [BOOT_VARS+BOOT_LFB] mov eax, [BOOT_VARS+BOOT_LFB]
mov [LFBAddress], eax mov [LFBAddress], eax
cmp [SCR_MODE], word 0100000000000000b cmp word [SCR_MODE], 0x0012 ; VGA (640x480 16 colors)
jge setvesa20 je .vga
cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors cmp word [SCR_MODE], 0x0013 ; MCGA (320*200 256 colors)
je v20ga32 je .32bpp
jmp v20ga24 cmp byte [_display.bits_per_pixel], 32
je .32bpp
cmp byte [_display.bits_per_pixel], 24
je .24bpp
cmp byte [_display.bits_per_pixel], 16
je .16bpp
; cmp byte [_display.bits_per_pixel], 15
; je .15bpp
setvesa20: .vga:
mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0 mov [PUTPIXEL], VGA_putpixel
mov [GETPIXEL], dword Vesa20_getpixel24 mov [GETPIXEL], Vesa20_getpixel32 ; Conversion buffer is 32 bpp
cmp byte [_display.bpp], 24 mov [_display.bytes_per_pixel], 4 ; Conversion buffer is 32 bpp
jz v20ga24 jmp .finish
v20ga32:
mov [PUTPIXEL], dword Vesa20_putpixel32
mov [GETPIXEL], dword Vesa20_getpixel32
jmp no_mode_0x12
v20ga24:
cmp [SCR_MODE], word 0x12 ; 16 C VGA 640x480
jne no_mode_0x12
mov [PUTPIXEL], dword VGA_putpixel
mov [GETPIXEL], dword Vesa20_getpixel32
no_mode_0x12:
mov [MOUSE_PICTURE], dword mousepointer ; .15bpp:
; mov [PUTPIXEL], Vesa20_putpixel15
; mov [GETPIXEL], Vesa20_getpixel15
; mov [_display.bytes_per_pixel], 2
; jmp .finish
.16bpp:
mov [PUTPIXEL], Vesa20_putpixel16
mov [GETPIXEL], Vesa20_getpixel16
mov [_display.bytes_per_pixel], 2
jmp .finish
.24bpp:
mov [PUTPIXEL], Vesa20_putpixel24
mov [GETPIXEL], Vesa20_getpixel24
mov [_display.bytes_per_pixel], 3
jmp .finish
.32bpp:
mov [PUTPIXEL], Vesa20_putpixel32
mov [GETPIXEL], Vesa20_getpixel32
mov [_display.bytes_per_pixel], 4
; jmp .finish
.finish:
mov [MOUSE_PICTURE], mousepointer
mov [_display.check_mouse], check_mouse_area_for_putpixel mov [_display.check_mouse], check_mouse_area_for_putpixel
mov [_display.check_m_pixel], check_mouse_area_for_getpixel mov [_display.check_m_pixel], check_mouse_area_for_getpixel
@ -4997,7 +5019,7 @@ sys_gs: ; direct screen access
mov [esp+32], eax mov [esp+32], eax
ret ret
.2: ; bits per pixel .2: ; bits per pixel
mov eax, [_display.bpp] mov eax, [_display.bits_per_pixel]
mov [esp+32], eax mov [esp+32], eax
ret ret
.3: ; bytes per scanline .3: ; bytes per scanline

View File

@ -308,7 +308,7 @@ end virtual
test edx, edx test edx, edx
jz .L57 jz .L57
cmp [_display.bpp], 32 cmp [_display.bits_per_pixel], 32
jne .core_24 jne .core_24
lea edi, [edi+ebx*4] lea edi, [edi+ebx*4]

View File

@ -1,6 +1,6 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;; ;; ;;
;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) KolibriOS team 2004-2014. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;; ;; Distributed under terms of the GNU General Public License ;;
;; ;; ;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -580,6 +580,40 @@ align 4
endp endp
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
proc restore_16 stdcall, x:dword, y:dword
push ebx
mov ebx, [cur_saved_base]
mov edx, [cur.h]
test edx, edx
jz .ret
push esi
push edi
mov esi, cur_saved_data
;--------------------------------------
align 4
@@:
mov edi, ebx
add ebx, [_display.pitch]
mov ecx, [cur.w]
rep movsw
dec edx
jnz @B
pop edi
;--------------------------------------
align 4
.ret:
pop esi
pop ebx
ret
endp
;------------------------------------------------------------------------------
align 4
proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword
locals locals
h dd ? h dd ?
@ -815,6 +849,129 @@ align 4
endp endp
;------------------------------------------------------------------------------ ;------------------------------------------------------------------------------
align 4 align 4
proc move_cursor_16 stdcall, hcursor:dword, x:dword, y:dword
locals
h dd ?
_dx dd ?
_dy dd ?
endl
mov esi, [hcursor]
mov ecx, [x]
mov eax, [y]
xor edx, edx
sub ecx, [esi+CURSOR.hot_x]
lea ebx, [ecx+32-1]
mov [x], ecx
sets dl
dec edx
and ecx, edx ;clip x to 0<=x
mov [cur.left], ecx
mov edi, ecx
sub edi, [x]
mov [_dx], edi
xor edx, edx
sub eax, [esi+CURSOR.hot_y]
lea edi, [eax+32-1]
mov [y], eax
sets dl
dec edx
and eax, edx ;clip y to 0<=y
mov [cur.top], eax
mov edx, eax
sub edx, [y]
mov [_dy], edx
; mul dword [BytesPerScanLine]
mov eax, [BPSLine_calc_area+eax*4]
lea edx, [LFB_BASE+eax+ecx*2]
mov [cur_saved_base], edx
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
;--------------------------------------
align 4
@@:
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
;--------------------------------------
align 4
@@:
mov [cur.right], ebx
mov [cur.bottom], edi
sub ebx, [x]
sub edi, [y]
inc ebx
inc edi
sub ebx, [_dx]
sub edi, [_dy]
mov [cur.w], ebx
mov [cur.h], edi
mov [h], edi
mov eax, edi
mov edi, cur_saved_data
;--------------------------------------
align 4
@@:
mov esi, edx
add edx, [_display.pitch]
mov ecx, [cur.w]
rep movsw
dec eax
jnz @B
;draw cursor
mov ebx, [cur_saved_base]
mov eax, [_dy]
shl eax, 5
add eax, [_dx]
mov esi, [hcursor]
mov esi, [esi+CURSOR.base]
lea edx, [esi+eax*4]
;--------------------------------------
align 4
.row:
mov ecx, [cur.w]
mov esi, edx
mov edi, ebx
add edx, 32*4
add ebx, [_display.pitch]
;--------------------------------------
align 4
.pix:
lodsd
test eax, 0xFF000000
jz @F
; convert to 16 bpp and store to real LFB
and eax, 00000000111110001111110011111000b
shr ah, 2
shr ax, 3
ror eax, 8
add al, ah
rol eax, 8
mov [edi], ax
;--------------------------------------
align 4
@@:
add edi, 2
dec ecx
jnz .pix
dec [h]
jnz .row
ret
endp
;------------------------------------------------------------------------------
align 4
check_mouse_area_for_getpixel_new: check_mouse_area_for_getpixel_new:
; in: ; in:
; eax = x ; eax = x
@ -850,7 +1007,10 @@ check_mouse_area_for_getpixel_new:
add eax, ebx add eax, ebx
mov ebx, eax mov ebx, eax
shl eax, 2 shl eax, 2
cmp byte [_display.bpp], 32 cmp byte [_display.bits_per_pixel], 32
je @f
sub eax, ebx
cmp byte [_display.bits_per_pixel], 24
je @f je @f
sub eax, ebx sub eax, ebx
;-------------------------------------- ;--------------------------------------
@ -925,13 +1085,29 @@ align 4
add ecx, ebx add ecx, ebx
mov ebx, ecx mov ebx, ecx
shl ecx, 2 shl ecx, 2
cmp byte [_display.bpp], 24 cmp byte [_display.bits_per_pixel], 16
je .16
cmp byte [_display.bits_per_pixel], 24
je .24 je .24
and eax, 0xFFFFFF and eax, 0xFFFFFF
mov [ecx + cur_saved_data], eax ;store new color to mov [ecx + cur_saved_data], eax ;store new color to
jmp @f jmp @f
;-------------------------------------- ;--------------------------------------
align 4 align 4
.16:
sub ecx, ebx
sub ecx, ebx
; convert to 16 bpp and store to real LFB
and eax, 00000000111110001111110011111000b
shr ah, 2
shr ax, 3
ror eax, 8
add al, ah
rol eax, 8
mov [ecx + cur_saved_data], ax ;store new color to
jmp @f
;--------------------------------------
align 4
.24: .24:
sub ecx, ebx sub ecx, ebx
mov [ecx + cur_saved_data], ax ;store new color to mov [ecx + cur_saved_data], ax ;store new color to
@ -999,9 +1175,9 @@ init_display:
mov ebx, restore_32 mov ebx, restore_32
mov ecx, move_cursor_32 mov ecx, move_cursor_32
mov edx, Vesa20_putpixel32_new mov edx, Vesa20_putpixel32_new
mov eax, [_display.bpp] mov eax, [_display.bits_per_pixel]
cmp al, 32 cmp al, 32
jne .24 jne .not_32bpp
.set: .set:
mov [_display.select_cursor], select_cursor mov [_display.select_cursor], select_cursor
@ -1020,12 +1196,30 @@ init_display:
mov [def_cursor], eax mov [def_cursor], eax
ret ret
.24: .not_32bpp:
cmp al, 24
jne .not_24bpp
mov ebx, restore_24 mov ebx, restore_24
mov ecx, move_cursor_24 mov ecx, move_cursor_24
mov edx, Vesa20_putpixel24_new mov edx, Vesa20_putpixel24_new
cmp al, 24 jmp .set
je .set
.not_24bpp:
cmp al, 16
jne .not_16bpp
mov ebx, restore_16
mov ecx, move_cursor_16
mov edx, Vesa20_putpixel16_new
jmp .set
.not_16bpp:
; cmp al, 15
; jne .fail
; mov ebx, restore_15
; mov ecx, move_cursor_15
; mov edx, Vesa20_putpixel15_new
; jmp .set
.fail: .fail:
xor eax, eax xor eax, eax

File diff suppressed because it is too large Load Diff