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,16 +24,12 @@ $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
@ -44,9 +40,12 @@ 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,14 +56,12 @@ 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]
@ -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
@ -177,7 +176,9 @@ drm:
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
@ -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:
@ -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:
@ -367,7 +373,7 @@ check_mouse_area_for_putpixel:
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
@ -379,7 +385,7 @@ check_mouse_area_for_putpixel:
; 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
@ -411,17 +417,15 @@ check_mouse_area_for_putpixel:
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,16 +472,14 @@ 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
;--------------------------------------
align 4
nodmp: 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
@ -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