From 8119f00711e0783ebe51a660c087eece5ff09a96 Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Mon, 27 May 2013 19:09:54 +0000 Subject: [PATCH] kernel: remove ScreenBPP variable git-svn-id: svn://kolibrios.org@3537 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 1 - kernel/trunk/kernel.asm | 6 ++--- kernel/trunk/video/cursors.inc | 41 +++++++++++++--------------------- kernel/trunk/video/vesa20.inc | 18 +++++++-------- 4 files changed, 27 insertions(+), 39 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 414e171595..a54426e37a 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -237,7 +237,6 @@ BTN_DOWN equ (OS_BASE+0x000FB40) MOUSE_DOWN equ (OS_BASE+0x000FB44) X_UNDER equ (OS_BASE+0x000FB4A) Y_UNDER equ (OS_BASE+0x000FB4C) -ScreenBPP equ (OS_BASE+0x000FBF1) ;unused ? only one reference MOUSE_BUFF_COUNT equ (OS_BASE+0x000FCFF) diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 8827217417..14320598db 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -389,8 +389,6 @@ high_code: mov al, [BOOT_VAR+BOOT_DMA] ; DMA access mov [allow_dma_access], al movzx eax, byte [BOOT_VAR+BOOT_BPP] ; bpp - mov [ScreenBPP], al - mov [_display.bpp], eax mov [_display.vrefresh], 60 @@ -449,7 +447,7 @@ high_code: setvesa20: mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0 mov [GETPIXEL], dword Vesa20_getpixel24 - cmp [ScreenBPP], byte 24 + cmp byte [_display.bpp], 24 jz v20ga24 v20ga32: mov [PUTPIXEL], dword Vesa20_putpixel32 @@ -4980,7 +4978,7 @@ sys_gs: ; direct screen access mov [esp+32], eax ret .2: ; bits per pixel - movzx eax, byte [ScreenBPP] + mov eax, [_display.bpp] mov [esp+32], eax ret .3: ; bytes per scanline diff --git a/kernel/trunk/video/cursors.inc b/kernel/trunk/video/cursors.inc index fa29fd9998..c9b4e86280 100644 --- a/kernel/trunk/video/cursors.inc +++ b/kernel/trunk/video/cursors.inc @@ -846,7 +846,7 @@ check_mouse_area_for_getpixel_new: add eax, ebx mov ebx, eax shl eax, 2 - cmp [ScreenBPP], byte 32 + cmp byte [_display.bpp], 32 je @f sub eax, ebx ;-------------------------------------- @@ -921,7 +921,7 @@ align 4 add ecx, ebx mov ebx, ecx shl ecx, 2 - cmp [ScreenBPP], byte 24 + cmp byte [_display.bpp], 24 je .24 and eax, 0xFFFFFF mov [ecx + cur_saved_data], eax ;store new color to @@ -991,21 +991,15 @@ init_display: test word [SCR_MODE], 0x4000 jz .fail -; jmp .fail mov ebx, restore_32 mov ecx, move_cursor_32 - movzx eax, byte [ScreenBPP] - cmp eax, 32 - je @F + mov edx, Vesa20_putpixel32_new + mov eax, [_display.bpp] + cmp al, 32 + jne .24 - mov ebx, restore_24 - mov ecx, move_cursor_24 - cmp eax, 24 - jne .fail -;-------------------------------------- -align 4 -@@: +.set: mov [_display.select_cursor], select_cursor mov [_display.move_cursor], ecx mov [_display.restore_cursor], ebx @@ -1014,24 +1008,21 @@ align 4 cmp [PUTPIXEL], dword VGA_putpixel je @f - cmp [ScreenBPP], byte 32 - je .32 - mov [PUTPIXEL], dword Vesa20_putpixel24_new - jmp @f -;-------------------------------------- -align 4 -.32: - mov [PUTPIXEL], dword Vesa20_putpixel32_new -;-------------------------------------- -align 4 + mov [PUTPIXEL], edx @@: stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM mov [def_cursor_clock], eax stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM mov [def_cursor], eax ret -;-------------------------------------- -align 4 + +.24: + mov ebx, restore_24 + mov ecx, move_cursor_24 + mov edx, Vesa20_putpixel24_new + cmp al, 24 + je .set + .fail: xor eax, eax mov [_display.select_cursor], eax diff --git a/kernel/trunk/video/vesa20.inc b/kernel/trunk/video/vesa20.inc index 02a0580734..a5b98b1630 100644 --- a/kernel/trunk/video/vesa20.inc +++ b/kernel/trunk/video/vesa20.inc @@ -231,7 +231,7 @@ align 4 mov [putimg.winmap_newline], eax ; screen new line increment mov eax, [BytesPerScanLine] - movzx ebx, byte [ScreenBPP] + mov ebx, [_display.bpp] shr ebx, 3 imul ecx, ebx sub eax, ecx @@ -266,7 +266,7 @@ align 4 ;-------------------------------------- ; get process number mov ebx, [CURRENT_TASK] - cmp byte [ScreenBPP], 32 + cmp byte [_display.bpp], 32 je put_image_end_32 ;-------------------------------------- put_image_end_24: @@ -1229,7 +1229,7 @@ align 4 mov [drbar.line_inc_map], eax ; line_inc_scr mov eax, [drbar.real_sx] - movzx ebx, byte [ScreenBPP] + mov ebx, [_display.bpp] shr ebx, 3 imul eax, ebx neg eax @@ -1268,7 +1268,7 @@ align 4 rol eax, 8 mov bh, al ; 0x80 drawing gradient bars ror eax, 8 - cmp byte [ScreenBPP], 24 + cmp byte [_display.bpp], 24 jne draw_bar_end_32 ;-------------------------------------- align 4 @@ -1653,7 +1653,7 @@ dp2: add ebp, eax add ebp, eax add ebp, eax - cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size + cmp byte [_display.bpp], 24 ; 24 or 32 bpp ? - x size jz @f add ebp, eax ;-------------------------------------- @@ -1733,7 +1733,7 @@ nbgp: ;-------------------------------------- align 4 @@: - cmp [ScreenBPP], byte 25 ; 24 or 32 bpp? + cmp byte [_display.bpp], 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 @@ -1799,7 +1799,7 @@ vesa20_drawbackground_stretch: add ebp, eax add ebp, eax add ebp, eax - cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size + cmp byte [_display.bpp], 24 ; 24 or 32 bpp ? - x size jz @f add ebp, eax ;-------------------------------------- @@ -1918,7 +1918,7 @@ align 4 ;-------------------------------------- align 4 snbgp: - cmp [ScreenBPP], byte 25 + cmp byte [_display.bpp], 25 sbb edi, -4 add ebp, 1 mov eax, [esp+20] @@ -1944,7 +1944,7 @@ sdp4: sub edi, eax sub edi, eax sub edi, eax - cmp [ScreenBPP], byte 24 + cmp byte [_display.bpp], 24 jz @f sub edi, eax ;--------------------------------------