From 01431c16e7bcb7b220ff7ac83c0e64870d15a73c Mon Sep 17 00:00:00 2001 From: "Marat Zakiyanov (Mario79)" Date: Mon, 30 Apr 2012 22:07:24 +0000 Subject: [PATCH] Function 18.24 - set limits of screen. git-svn-id: svn://kolibrios.org@2654 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/docs/sysfuncr.txt | 16 +++++++++++ kernel/trunk/docs/sysfuncs.txt | 20 ++++++++++++- kernel/trunk/kernel.asm | 51 ++++++++++++++++++++++++++++++++++ 3 files changed, 86 insertions(+), 1 deletion(-) diff --git a/kernel/trunk/docs/sysfuncr.txt b/kernel/trunk/docs/sysfuncr.txt index c3ca4f5c84..e3647cceea 100644 --- a/kernel/trunk/docs/sysfuncr.txt +++ b/kernel/trunk/docs/sysfuncr.txt @@ -1120,6 +1120,22 @@ dd 1675 Замечания: * Окна спец. потоков (имя начинается с символа @) не сворачиваются. +====================================================================== +===== Функция 18, подфункция 24 - установить пределы отрисовки. ====== +====================================================================== +Параметры: + * eax = 18 - номер функции + * ebx = 24 - номер подфункции + * ecx = новый размер по X + * edx = новый размер по Y +Возвращаемое значение: + * функция не возвращает значения +Замечания: + * Функция не меняет физический размер видеорежима. Она предназначена + для нестандартных дисплеев, отображающих изображение частично. + * Размеры указываемые в функции не должны превышать размеры текущего + видеорежима, иначе функция ничего не изменит. + ====================================================================== ==================== Функция 20 - интерфейс MIDI. ==================== ====================================================================== diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 804a2a6012..047c036f6f 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -1119,7 +1119,25 @@ Returned value: * eax = N - number of windows minimized from function Remarks: * Window of special thread (name begin to symbol @) is not minimize. - + +====================================================================== +======= Function 18, subfunction 24 - set limits of screen. ========== +====================================================================== +Parameters: + * eax = 18 - function number + * ebx = 24 - subfunction number + * ecx = new X size + * edx = new Y size +Returned value: + * function does not return value +Remarks: + * The function does not change the physical size of the video mode. + It is designed for non-standard displays which display the image + partially. + * The sizes specified in the function should not exceed the sizes + of the current video mode, otherwise the function will not change + anything. + ====================================================================== ==================== Function 20 - MIDI interface. =================== ====================================================================== diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 5af852a9de..35fe6db00d 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -383,11 +383,13 @@ high_code: movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max mov [_display.width], eax + mov [display_width_standard], eax dec eax mov [Screen_Max_X], eax mov [screen_workarea.right], eax movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max mov [_display.height], eax + mov [display_height_standard], eax dec eax mov [Screen_Max_Y], eax mov [screen_workarea.bottom], eax @@ -2055,6 +2057,7 @@ sys_system_table: dd sysfn_pid_to_slot ; 21 = get slot number for pid dd sysfn_min_rest_window ; 22 = minimize and restore any window dd sysfn_min_windows ; 23 = minimize all windows + dd sysfn_set_screen_sizes ; 24 = set screen sizes for Vesa sysfn_num = ($ - sys_system_table)/4 endg ;------------------------------------------------------------------------------ @@ -2410,10 +2413,45 @@ sysfn_min_windows: call change_task ret ;------------------------------------------------------------------------------ +sysfn_set_screen_sizes: + cmp [SCR_MODE], word 0x13 + jbe .exit + + cmp [_display.select_cursor], select_cursor + jne .exit + + cmp ecx, [display_width_standard] + ja .exit + + cmp edx, [display_height_standard] + ja .exit + + pushfd + cli + mov eax, ecx + mov ecx, [BytesPerScanLine] + mov [_display.width], eax + dec eax + mov [_display.height], edx + dec edx +; eax - new Screen_Max_X +; edx - new Screen_Max_Y + mov [do_not_touch_winmap], 1 + call set_screen + mov [do_not_touch_winmap], 0 + popfd + call change_task +.exit: + ret +;------------------------------------------------------------------------------ uglobal screen_workarea RECT +display_width_standard dd 0 +display_height_standard dd 0 +do_not_touch_winmap db 0 window_minimize db 0 sound_flag db 0 + endg UID_NONE=0 @@ -5158,6 +5196,10 @@ calculate_fast_getting_offset_for_LFB: ;------------------------------------------------------------------------------ align 4 set_screen: +; in: +; eax - new Screen_Max_X +; ecx - new BytesPerScanLine +; edx - new Screen_Max_Y cmp eax, [Screen_Max_X] jne .set @@ -5181,6 +5223,9 @@ set_screen: pushad + cmp [do_not_touch_winmap], 1 + je @f + stdcall kernel_free, [_WinMapAddress] mov eax, [_display.width] @@ -5191,7 +5236,13 @@ set_screen: mov [_WinMapAddress], eax test eax, eax jz .epic_fail +; store for f.18.24 + mov eax, [_display.width] + mov [display_width_standard], eax + mov eax, [_display.height] + mov [display_height_standard], eax +@@: call calculate_fast_getting_offset_for_WinMapAddress ; for Qemu or non standart video cards ; Unfortunately [BytesPerScanLine] does not always