From f7e7dc15e229830e0cd7762f067e9ac49436df6f Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Sat, 17 Jan 2009 16:04:50 +0000 Subject: [PATCH] remove fixed memory variables git-svn-id: svn://kolibrios.org@996 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/branches/kolibri_pe/blkdev/cd_drv.inc | 17 +- kernel/branches/kolibri_pe/blkdev/hd_drv.inc | 12 +- kernel/branches/kolibri_pe/const.inc | 73 +--- kernel/branches/kolibri_pe/core/dll.c | 15 +- kernel/branches/kolibri_pe/core/init.asm | 19 -- kernel/branches/kolibri_pe/core/sys32.inc | 30 +- kernel/branches/kolibri_pe/core/taskman.inc | 3 +- kernel/branches/kolibri_pe/core/v86.inc | 6 +- kernel/branches/kolibri_pe/data32.inc | 71 +++- .../kolibri_pe/drivers/sb16/CONFIG.INC | 6 +- kernel/branches/kolibri_pe/gui/button.inc | 2 - kernel/branches/kolibri_pe/gui/skincode.inc | 20 +- kernel/branches/kolibri_pe/gui/skindata.inc | 2 + kernel/branches/kolibri_pe/gui/window.inc | 189 ++++------ kernel/branches/kolibri_pe/hid/mousedrv.inc | 323 ++++++------------ kernel/branches/kolibri_pe/include/core.h | 51 +++ kernel/branches/kolibri_pe/include/types.h | 2 +- kernel/branches/kolibri_pe/kernel.asm | 137 ++++---- kernel/branches/kolibri_pe/kernel32.inc | 7 - kernel/branches/kolibri_pe/makefile | 7 +- kernel/branches/kolibri_pe/video/cursors.inc | 210 +++++------- kernel/branches/kolibri_pe/video/vesa12.inc | 18 +- kernel/branches/kolibri_pe/video/vesa20.inc | 1 + 23 files changed, 524 insertions(+), 697 deletions(-) diff --git a/kernel/branches/kolibri_pe/blkdev/cd_drv.inc b/kernel/branches/kolibri_pe/blkdev/cd_drv.inc index 5516e0b5ab..1747b045d0 100644 --- a/kernel/branches/kolibri_pe/blkdev/cd_drv.inc +++ b/kernel/branches/kolibri_pe/blkdev/cd_drv.inc @@ -14,7 +14,7 @@ $Revision$ ; Автор части исходного текста Кулаков Владимир Геннадьевич ; Адаптация, доработка и разработка Mario79 -; Максимальное количество повторений операции чтения +; Максимальное количество повторений операции чтени MaxRetr equ 10 ; Предельное время ожидания готовности к приему команды ; (в тиках) @@ -38,7 +38,7 @@ ReadCD: mov [CDBlockSize],2048 ;2352 ; Очистить буфер пакетной команды call clear_packet_buffer -; Сформировать пакетную команду для считывания +; Сформировать пакетную команду для считывани ; сектора данных ; Задать код команды Read CD mov [PacketCommand],byte 0x28 ;0xBE @@ -168,7 +168,6 @@ MaxCDWaitTime equ 1000 ;200 ;10 ; Область памяти для формирования пакетной команды PacketCommand: rb 12 ;DB 12 DUP (?) ; Область памяти для приема данных от дисковода -;CDDataBuf DB 4096 DUP (0) ; Размер принимаемого блока данных в байтах CDBlockSize DW ? ; Адрес считываемого сектора данных @@ -177,7 +176,7 @@ CDSectorAddress: DD ? TickCounter_1 DD 0 ; Время начала ожидания готовности устройства WURStartTime DD 0 -; указатель буфера для считывания +; указатель буфера для считывани CDDataBuf_pointer dd 0 ;**************************************************** @@ -342,7 +341,7 @@ SendPacketNoDatCommand: add DX,7 ;порт 1х7h @@WaitDevice0_1: call change_task - ; Проверить время ожидания + ; Проверить время ожидани mov EAX,[timer_ticks] sub EAX,[TickCounter_1] cmp EAX,BSYWaitTime @@ -464,12 +463,12 @@ SendCommandToHDD_1: jmp .test @@: call change_task - ; Проверить время ожидания + ; Проверить время ожидани mov eax,[timer_ticks] sub eax,[TickCounter_1] cmp eax,BSYWaitTime ;300 ;ожидать 3 сек. ja @@Err1_4 ;ошибка тайм-аута - ; Прочитать регистр состояния + ; Прочитать регистр состояни .test: in AL,DX ; Проверить состояние сигнала BSY @@ -645,7 +644,7 @@ LoadMedium: ; Сформировать команду START/STOP UNIT ; Задать код команды mov [PacketCommand],word 1Bh - ; Задать операцию загрузки носителя + ; Задать операцию загрузки носител mov [PacketCommand+4],word 00000011b ; Подать команду call SendPacketNoDatCommand @@ -666,7 +665,7 @@ EjectMedium: ; Сформировать команду START/STOP UNIT ; Задать код команды mov [PacketCommand],word 1Bh - ; Задать операцию извлечения носителя + ; Задать операцию извлечения носител mov [PacketCommand+4],word 00000010b ; Подать команду call SendPacketNoDatCommand diff --git a/kernel/branches/kolibri_pe/blkdev/hd_drv.inc b/kernel/branches/kolibri_pe/blkdev/hd_drv.inc index 9ad6aa6030..f211899ad8 100644 --- a/kernel/branches/kolibri_pe/blkdev/hd_drv.inc +++ b/kernel/branches/kolibri_pe/blkdev/hd_drv.inc @@ -478,10 +478,10 @@ wait_for_sector_dma_ide1: ret iglobal -align 4 +align 8 ; note that IDE descriptor table must be 4-byte aligned and do not cross 4K boundary IDE_descriptor_table: - dd IDE_DMA + dd IDE_DMA+(0x100000000-OS_BASE) dw 0x2000 dw 0x8000 @@ -579,7 +579,7 @@ hd_read_dma: mov eax, [esp+4] sub eax, [dma_cur_sector] shl eax, 9 - add eax, (OS_BASE+IDE_DMA) + add eax, IDE_DMA push ecx esi edi mov esi, eax shl edi, 9 @@ -598,7 +598,7 @@ hd_read_dma: ret .notread: mov eax, IDE_descriptor_table - mov dword [eax], IDE_DMA + mov dword [eax], IDE_DMA+(0x100000000-OS_BASE) mov word [eax+4], 0x2000 sub eax, OS_BASE mov dx, [IDEContrRegsBaseAddr] @@ -694,8 +694,8 @@ write_cache_chain: shl esi, 9 call calculate_cache_2 add esi,eax - mov edi, (OS_BASE+IDE_DMA) - mov dword [edx], IDE_DMA + mov edi, IDE_DMA + mov dword [edx], IDE_DMA+(0x100000000-OS_BASE) movzx ecx, [cache_chain_size] shl ecx, 9 mov word [edx+4], cx diff --git a/kernel/branches/kolibri_pe/const.inc b/kernel/branches/kolibri_pe/const.inc index 99e329df0c..79fcc3dbaa 100644 --- a/kernel/branches/kolibri_pe/const.inc +++ b/kernel/branches/kolibri_pe/const.inc @@ -208,68 +208,35 @@ LOAD_BASE equ 0x00100000 OS_BASE equ 0xE0000000 IMAGE_BASE equ (OS_BASE+LOAD_BASE) -window_data equ OS_BASE +BOOT_VAR equ OS_BASE -CURRENT_TASK equ (OS_BASE+0x0003000) -TASK_COUNT equ (OS_BASE+0x0003004) -TASK_BASE equ (OS_BASE+0x0003010) -TASK_DATA equ (OS_BASE+0x0003020) -TASK_EVENT equ (OS_BASE+0x0003020) +SB16Buffer equ (OS_BASE+0x10000) -mouseunder equ (OS_BASE+0x0006900) -CDDataBuf equ (OS_BASE+0x0007000) -FLOPPY_BUFF equ (OS_BASE+0x0008000) -ACTIVE_PROC_STACK equ (OS_BASE+0x000A400) ;unused +TASK_COUNT equ (CURRENT_TASK+0x04) +TASK_BASE equ (CURRENT_TASK+0x10) +TASK_DATA equ (CURRENT_TASK+0x20) +TASK_EVENT equ (CURRENT_TASK+0x20) -WIN_STACK equ (OS_BASE+0x000C000) -WIN_POS equ (OS_BASE+0x000C400) FDD_BUFF equ (OS_BASE+0x000D000) -DRIVE_DATA equ (OS_BASE+0x0070000) - -SLOT_BASE equ (OS_BASE+0x0080000) - VGABasePtr equ (OS_BASE+0x00A0000) -RAMDISK_FAT equ (OS_BASE+0x0180000) -FLOPPY_FAT equ (OS_BASE+0x0182000) +IRQ_SAVE equ (OS_BASE+0x0190000) -IDE_DMA equ 0x184000 +stack_data_start equ (OS_BASE+0x01A0000) +eth_data_start equ (OS_BASE+0x01A0000) +stack_data equ (OS_BASE+0x01A4000) +stack_data_end equ (OS_BASE+0x01Bffff) +resendQ equ (OS_BASE+0x01C0000) -BgrAuxTable equ (OS_BASE+0x0198000) -; unused? -SB16Buffer equ (OS_BASE+0x01A0000) -SB16_Status equ (OS_BASE+0x01B0000) - -BUTTON_INFO equ (OS_BASE+0x01C0000) -RESERVED_PORTS equ (OS_BASE+0x01D0000) -IRQ_SAVE equ (OS_BASE+0x01E0000) -BOOT_VAR equ (OS_BASE+0x01f0000) - -stack_data_start equ (OS_BASE+0x0200000) -eth_data_start equ (OS_BASE+0x0200000) -stack_data equ (OS_BASE+0x0204000) -stack_data_end equ (OS_BASE+0x021ffff) -resendQ equ (OS_BASE+0x0220000) -VMODE_BASE equ (OS_BASE+0x0228000) -skin_data equ (OS_BASE+0x0230000) -draw_data equ (OS_BASE+0x0238000); - -BgrDrawMode equ (OS_BASE+0x023BFF4) -BgrDataWidth equ (OS_BASE+0x023BFF8) -BgrDataHeight equ (OS_BASE+0x023BFFC) - -virtual at (OS_BASE+0x023CF80) +virtual at (OS_BASE+0x01C8F80) tss TSS end virtual -LAST_PAGE equ 0x0240000 +LAST_PAGE equ 0x01CB000 -;sys_pgmap equ (OS_BASE+LAST_PAGE) +twdw equ (CURRENT_TASK-window_data) -twdw equ 0x3000 ;(CURRENT_TASK-window_data) - -std_application_base_address equ new_app_base RING0_STACK_SIZE equ (0x2000 - 512) ;512 байт для контекста FPU REG_SS equ (RING0_STACK_SIZE-4) @@ -303,6 +270,8 @@ PG_NOCACHE equ 0x018 PG_LARGE equ 0x080 PG_GLOBAL equ 0x100 +PG_SHARED equ 0x200 + ;;;;;;;;;;;boot time variables ;BOOT_BPP equ 0x9000 ;byte bits per pixel @@ -487,14 +456,6 @@ struc PG_DATA .pg_mutex dd ? } -;struc LIB -;{ .lib_name rb 16 -; .lib_base dd ? -; .lib_start dd ? -; .export dd ? -; .import dd ? -;} - struc SRV { .srv_name rb 16 ;ASCIIZ string .magic dd ? ;+0x10 ;'SRV ' diff --git a/kernel/branches/kolibri_pe/core/dll.c b/kernel/branches/kolibri_pe/core/dll.c index 3e123b7c71..17398e9333 100644 --- a/kernel/branches/kolibri_pe/core/dll.c +++ b/kernel/branches/kolibri_pe/core/dll.c @@ -454,10 +454,10 @@ void sys_app_entry(addr_t raw, thr_stack_t *thr_stack, exec_stack_t *ex_stack) thr_stack->ecx = 0; thr_stack->eax = 0; thr_stack->eip = entry; - thr_stack->cs = 0x1b; + thr_stack->cs = sel_app_code; thr_stack->eflags = EFL_IOPL3 | EFL_IF; thr_stack->pe_sp = 0x7FFFF000 + ((u32_t)ex_stack & 0xFFF); - thr_stack->pe_ss = 0x23; + thr_stack->pe_ss = sel_app_data; }; @@ -585,12 +585,11 @@ bool link_pe(addr_t img_base) DBG("import from %s\n",libname); - exp_dll = find_dll(¤t_slot->dll_list, libname); - if(exp_dll != NULL) + exp_dll = find_dll(&core_dll.link, libname); + if(exp_dll == NULL) { - DBG("find %s\n", exp_dll->img_name); - } - else + exp_dll = find_dll(¤t_slot->dll_list, libname); + if(exp_dll == NULL) { int len = strlen(libname)+1; @@ -604,6 +603,8 @@ bool link_pe(addr_t img_base) return false; }; } + }; + DBG("find %s\n", exp_dll->img_name); exp = exp_dll->img_exp; diff --git a/kernel/branches/kolibri_pe/core/init.asm b/kernel/branches/kolibri_pe/core/init.asm index 56f2038012..da46371814 100644 --- a/kernel/branches/kolibri_pe/core/init.asm +++ b/kernel/branches/kolibri_pe/core/init.asm @@ -218,26 +218,9 @@ core_init: ; SAVE & CLEAR 0-0xffff - cld - xor esi, esi - mov edi,BOOT_VAR - mov ecx,0x10000 / 4 - rep movsd - - xor edi, edi - xor eax, eax - mov ecx,0x10000 / 4 - rep stosd - - mov edi, 0x40000 - mov ecx, (0x90000-0x40000)/4 - rep stosd - mov dword [_sys_pdbr], eax mov dword [_sys_pdbr+4], eax - xchg bx, bx - movzx eax,word [BOOT_VAR+0x9008] ; screen mode mov [scr_mode],eax @@ -256,8 +239,6 @@ if 0 mov [_current_thread], eax - xchg bx, bx - mov ebx, [eax+THR.pdir] mov ecx, cr3 cmp ebx, ecx diff --git a/kernel/branches/kolibri_pe/core/sys32.inc b/kernel/branches/kolibri_pe/core/sys32.inc index 95e25de363..a54cef4411 100644 --- a/kernel/branches/kolibri_pe/core/sys32.inc +++ b/kernel/branches/kolibri_pe/core/sys32.inc @@ -592,26 +592,25 @@ term9: pusha ; save window coordinates for window restoring cld shl esi,5 - add esi,window_data - mov eax,[esi+WDATA.box.left] + mov eax,[window_data+esi+WDATA.box.left] mov [dlx],eax - add eax,[esi+WDATA.box.width] + add eax,[window_data+esi+WDATA.box.width] mov [dlxe],eax - mov eax,[esi+WDATA.box.top] + mov eax,[window_data+esi+WDATA.box.top] mov [dly],eax - add eax,[esi+WDATA.box.height] + add eax,[window_data+esi+WDATA.box.height] mov [dlye],eax xor eax, eax - mov [esi+WDATA.box.left],eax - mov [esi+WDATA.box.width],eax - mov [esi+WDATA.box.top],eax - mov [esi+WDATA.box.height],eax - mov [esi+WDATA.cl_workarea],eax - mov [esi+WDATA.cl_titlebar],eax - mov [esi+WDATA.cl_frames],eax - mov dword [esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn - lea edi, [esi-window_data+draw_data] + mov [window_data+esi+WDATA.box.left],eax + mov [window_data+esi+WDATA.box.width],eax + mov [window_data+esi+WDATA.box.top],eax + mov [window_data+esi+WDATA.box.height],eax + mov [window_data+esi+WDATA.cl_workarea],eax + mov [window_data+esi+WDATA.cl_titlebar],eax + mov [window_data+esi+WDATA.cl_frames],eax + mov dword [window_data+esi+WDATA.reserved],eax ; clear all flags: wstate, redraw, wdrawn + lea edi, [esi+draw_data] mov ecx,32/4 rep stosd popa @@ -812,9 +811,6 @@ term9: xor esi, esi call redrawscreen - mov [mouse_background], 0 ; no mouse background - mov [dont_draw_mouse], 0 ; draw mouse - mov [application_table_status],0 ;mov esi,process_terminated ;call sys_msg_board_str diff --git a/kernel/branches/kolibri_pe/core/taskman.inc b/kernel/branches/kolibri_pe/core/taskman.inc index 1584786ff2..386d45fac2 100644 --- a/kernel/branches/kolibri_pe/core/taskman.inc +++ b/kernel/branches/kolibri_pe/core/taskman.inc @@ -432,7 +432,7 @@ proc pe_app_param stdcall path:dword, raw:dword, ex_pg_dir:dword, ex_stack:dword mov [ecx*8+SLOT_BASE+APPDATA.saved_esp], ebx mov [CURRENT_TASK+ecx+TASKDATA.state], 0 - DEBUGF 1,"%s",new_process_running + ; DEBUGF 1,"%s",new_process_running .err: mov eax,[process_number] ;set result mov [application_table_status], 0 ;unlock application_table_status mutex @@ -446,7 +446,6 @@ endp align 4 _pe_restart: - xchg bx, bx add esp, 12 popad iretd diff --git a/kernel/branches/kolibri_pe/core/v86.inc b/kernel/branches/kolibri_pe/core/v86.inc index fa0574b824..64e4d9f470 100644 --- a/kernel/branches/kolibri_pe/core/v86.inc +++ b/kernel/branches/kolibri_pe/core/v86.inc @@ -94,9 +94,9 @@ v86_create: pop eax ; first page - BIOS data (shared between all machines!) ; physical address = 0x1f0000 -; linear address = BOOT_VAR = OS_BASE + 0x1f0000 - mov dword [eax], (BOOT_VAR - OS_BASE) or 111b - mov dword [eax+800h], BOOT_VAR +; linear address = 0 + mov dword [eax], 111b + mov dword [eax+800h], OS_BASE ; page before 0xA0000 - Extended BIOS Data Area (shared between all machines!) ; physical address = 0x9C000 ; linear address = 0x8009C000 diff --git a/kernel/branches/kolibri_pe/data32.inc b/kernel/branches/kolibri_pe/data32.inc index 8a8881bd3a..46ac99067b 100644 --- a/kernel/branches/kolibri_pe/data32.inc +++ b/kernel/branches/kolibri_pe/data32.inc @@ -282,14 +282,50 @@ section '.bss' data writeable align 4096 align 4096 -_sys_pdbr rd 1024 +SLOT_BASE: + rb 64*1024 +DRIVE_DATA: + rb 64*1024 +RESERVED_PORTS: + rb 64*1024 +FLOPPY_BUFF: + rb 16*1024 +BUTTON_INFO: + rb 16*1024 +BgrAuxTable: + rb 32*1024 +skin_data: + rb 32*1024 + +IDE_DMA: rb 32*1024 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +window_data: + rb 8192 + +CURRENT_TASK: +_current_task: + rb 8192 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +draw_data: + rb 4096 +CDDataBuf: + rb 4096 cur_saved_data rb 4096 -fpu_data: rb 512 +_sys_pdbr rd 1024 -idts rq 0x42 + +fpu_data: + rb 512 + +WIN_STACK: + rb 0x400 +WIN_POS: + rb 0x800 + +idts rq 0x42 ; device irq owners irq_owner rd 16 ; process id @@ -318,6 +354,9 @@ irq_tab rd 16 FONT_I rb 2304 ;16*144 FONT_II rb 2560 ;16*160 +RAMDISK_FAT: rb 2856*2 +16 ;16*357 +FLOPPY_FAT: rb 2856*2 +16 + _z_core rd 52 mem_block_map rb 512 @@ -357,9 +396,6 @@ sys_page_map rd 1 srv.fd rd 1 srv.bk rd 1 -scr_width rd 1 -scr_height rd 1 - _HwCursorCreate: create_cursor rd 1 @@ -375,11 +411,15 @@ hw_restore rd 1 def_cursor rd 1 current_cursor rd 1 hw_cursor rd 1 -cur_def_interl rd 1 cur_saved_base rd 1 -cur_saved_interl rd 1 -cur_saved_w rd 1 -cur_saved_h rd 1 + +cur.lock rd 1 ;1 - lock update, 2- hide +cur.left rd 1 ;cursor clip box +cur.top rd 1 +cur.right rd 1 +cur.bottom rd 1 +cur.w rd 1 +cur.h rd 1 ipc_tmp rd 1 ipc_pdir rd 1 @@ -417,14 +457,18 @@ BytesPerScanLine rd 1 put_pixel rd 1 get_pixel rd 1 +_screen_width rd 1 +_screen_height rd 1 + Screen_Max_X rd 1 Screen_Max_Y rd 1 btn_addr rd 1 redraw_background rd 1 -mouse_background rd 1 -dont_draw_mouse rd 1 +BgrDrawMode rd 1 +BgrDataWidth rd 1 +BgrDataHeight rd 1 MOUSE_VISIBLE rd 1 WIN_TEMP_XY rd 1 @@ -439,9 +483,6 @@ BTN_BUFF rd 1 KEY_COUNT rd 1 KEY_BUFF rb 128 - -mouse_color_mem rd 1 -color_temp rd 1 btn_down rd 1 x_under rd 1 y_under rd 1 diff --git a/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC b/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC index 327cc0f55f..f3aec7ac88 100644 --- a/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC +++ b/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC @@ -6,10 +6,8 @@ use_cli_sti equ 1 ;driver become more stable (theoretically) API_VERSION equ 0 ;debug OS_BASE equ 0xE0000000 -new_app_base equ 0x0 -PROC_BASE equ (OS_BASE+0x080000) -SB16Buffer equ (OS_BASE+0x1A0000) -SB16_Status equ (OS_BASE+0x1B0000) +;PROC_BASE equ (OS_BASE+0x080000) +SB16Buffer equ (OS_BASE+0x10000) DMAPage equ ((SB16Buffer-OS_BASE) shr 16) SB16Buffer0 equ SB16Buffer diff --git a/kernel/branches/kolibri_pe/gui/button.inc b/kernel/branches/kolibri_pe/gui/button.inc index d04584dd13..c3d42ef3e7 100644 --- a/kernel/branches/kolibri_pe/gui/button.inc +++ b/kernel/branches/kolibri_pe/gui/button.inc @@ -584,8 +584,6 @@ checkbuttons: popad call negativebutton - mov [mouse_background], 0 ; no mouse background - mov [dont_draw_mouse], 0 ; draw mouse ;..................................... start 5/5 : modified by vhanla ............................. ; check coordinates iglobal diff --git a/kernel/branches/kolibri_pe/gui/skincode.inc b/kernel/branches/kolibri_pe/gui/skincode.inc index 6685d3c751..8c92f747b8 100644 --- a/kernel/branches/kolibri_pe/gui/skincode.inc +++ b/kernel/branches/kolibri_pe/gui/skincode.inc @@ -10,8 +10,6 @@ $Revision$ include "skindata.inc" -;skin_data = 0x00778000 - read_skin_file: stdcall load_file, ebx test eax, eax @@ -213,7 +211,7 @@ parse_skin_data: ret sys_putimage_with_check: - or ebx,ebx + test ebx,ebx jz @f call sys_putimage.forced @@: ret @@ -257,7 +255,7 @@ drawwindow_IV_caption: mov edx,[ebp+SKIN_DATA.base.left] sub edx,[ebp+SKIN_DATA.base.width] shl edx,16 - .baseskinloop: +.baseskinloop: shr edx,16 add edx,[ebp+SKIN_DATA.base.width] shl edx,16 @@ -268,7 +266,7 @@ drawwindow_IV_caption: dec eax jnz .baseskinloop - .non_base: +.non_base: mov esi,[esp+4] mov edx,[esi+WDATA.box.width] @@ -317,7 +315,7 @@ drawwindow_IV: or [edi+WDATA.fl_wdrawn], 4 call draw_rectangle mov ecx,3 - _dw3l: +_dw3l: add eax,1*65536-1 add ebx,1*65536-1 test ax,ax @@ -353,7 +351,7 @@ drawwindow_IV: mov al,[esp+32+4+4] call drawwindow_IV_caption - draw_clientbar: +draw_clientbar: mov esi,[esp] @@ -373,7 +371,7 @@ drawwindow_IV: test edi,0x40000000 jnz _noinside2 call [drawbar] - _noinside2: +_noinside2: cmp dword[skin_data],'SKIN' jne no_skin_add_button @@ -402,7 +400,7 @@ drawwindow_IV: mov ebx,[esp] mov ebx,[ebx+WDATA.box.width] inc ebx - _bCx_at_right: +_bCx_at_right: add ebx,[skin_btn_close.left] mov [eax],bx add eax,2 ; x size @@ -441,7 +439,7 @@ drawwindow_IV: mov ebx,[esp] mov ebx,[ebx+WDATA.box.width] inc ebx - _bMx_at_right: +_bMx_at_right: add ebx,[skin_btn_minimize.left] mov [eax],bx add eax,2 ; x size @@ -456,7 +454,7 @@ drawwindow_IV: dec ebx mov [eax],bx - no_skin_add_button: +no_skin_add_button: pop edi and [edi+WDATA.fl_wdrawn], not 4 test [edi+WDATA.fl_wdrawn], 2 diff --git a/kernel/branches/kolibri_pe/gui/skindata.inc b/kernel/branches/kolibri_pe/gui/skindata.inc index b2e3c12447..255a252411 100644 --- a/kernel/branches/kolibri_pe/gui/skindata.inc +++ b/kernel/branches/kolibri_pe/gui/skindata.inc @@ -54,6 +54,8 @@ skin_udata: skin_btn_close SKIN_BUTTON skin_btn_minimize SKIN_BUTTON +public _skin_active +_skin_active: skin_active SKIN_DATA skin_inactive SKIN_DATA diff --git a/kernel/branches/kolibri_pe/gui/window.inc b/kernel/branches/kolibri_pe/gui/window.inc index 259c5e7d2c..4b8adf5dd0 100644 --- a/kernel/branches/kolibri_pe/gui/window.inc +++ b/kernel/branches/kolibri_pe/gui/window.inc @@ -73,8 +73,8 @@ calculatescreen: mov ebp, [TASK_COUNT] ; number of processes cmp ebp, 1 jbe .finish - align 4 - .new_wnd: +align 4 +.new_wnd: movzx edi, word [WIN_POS + esi * 2] shl edi, 5 @@ -103,37 +103,37 @@ calculatescreen: cmp eax, [esp+RECT.left] jae @f mov eax, [esp+RECT.left] - @@: +@@: cmp ebx, [esp+RECT.top] jae @f mov ebx, [esp+RECT.top] - @@: +@@: cmp ecx, [esp+RECT.right] jbe @f mov ecx, [esp+RECT.right] - @@: +@@: cmp edx, [esp+RECT.bottom] jbe @f mov edx, [esp+RECT.bottom] - @@: +@@: push esi movzx esi, word [WIN_POS + esi * 2] call setscreen pop esi - .not_wnd: - .out_of_bounds: +.not_wnd: +.out_of_bounds: inc esi dec ebp jnz .new_wnd - .finish: +.finish: pop eax ebx ecx edx popfd popad -ret + ret @@ -185,13 +185,13 @@ pushad add edi, eax add edi, [_display_data] - .new_y: +.new_y: push ecx ; sx push edx mov edx, esi align 4 - .new_x: +.new_x: mov byte [edi], dl inc edi dec ecx @@ -498,7 +498,7 @@ display_settings: repos_windows: mov ecx,[TASK_COUNT] - mov edi, OS_BASE+0x20*2 + mov edi, window_data+0x20*2 call force_redraw_background dec ecx jge @f @@ -616,33 +616,6 @@ check_window_position: ret -uglobal - new_window_starting dd 0 -endg - - -sys_window_mouse: - - push eax - - mov eax,[timer_ticks] - cmp [new_window_starting],eax - jb swml1 - - mov [mouse_background], 0 ; no mouse background - mov [dont_draw_mouse], 0 ; draw mouse - - mov [new_window_starting],eax - - swml1: - - pop eax - - ret - - - - drawwindow_I_caption: mov ecx,[edx+WDATA.cl_titlebar] ; grab bar @@ -657,9 +630,9 @@ drawwindow_I_caption: cmp ebx,eax jb .wdsizeok mov ebx,eax - .wdsizeok: +.wdsizeok: push ebx - .drwi: +.drwi: mov ebx,edx shl ebx,16 add ebx,edx @@ -680,10 +653,10 @@ drawwindow_I_caption: mov [esi+WDATA.cl_titlebar],ecx and ecx,0x00ffffff jmp .faj - .nofa: +.nofa: mov ecx,[esi+WDATA.cl_titlebar] and ecx,0x00ffffff - .faj: +.faj: pop edx mov edi,0 call [draw_line] @@ -735,7 +708,7 @@ drawwindow_I: test edi,0x40000000 jnz noinside call [drawbar] - noinside: +noinside: popad @@ -799,9 +772,9 @@ drawwindow_III_caption: cmp ebx,eax jb .wdsizeok mov ebx,eax - .wdsizeok: +.wdsizeok: push ebx - .drwi: +.drwi: mov ebx,edx shl ebx,16 add ebx,edx @@ -814,11 +787,11 @@ drawwindow_III_caption: test ecx,0x40000000 jz .nofa add ecx,0x040404 - .nofa: +.nofa: test ecx,0x80000000 jz .nofa2 sub ecx,0x040404 - .nofa2: +.nofa2: mov [esi+WDATA.cl_titlebar],ecx and ecx,0xffffff xor edi, edi @@ -858,7 +831,7 @@ drawwindow_III: call drawwindowframes2 @@: mov ecx,3 - dw3l: +dw3l: add eax,1*65536-1 add ebx,1*65536-1 mov esi,[edi+WDATA.cl_frames] @@ -888,7 +861,7 @@ drawwindow_III: test edi,0x40000000 jnz noinside2 call [drawbar] - noinside2: +noinside2: popad @@ -989,7 +962,7 @@ checkwindowdraw: push esi - .new_check: +.new_check: pop esi add esi, 2 @@ -1045,8 +1018,6 @@ checkwindowdraw: ret - - waredraw: ; if redraw necessary at activate pushad @@ -1083,14 +1054,12 @@ waredraw: ; if redraw necessary at activate ret - .do_not_draw: +.do_not_draw: popad call windowactivate - mov [mouse_background], 0 ; no mouse background - mov [dont_draw_mouse], 0 ; draw mouse - ret + ret ; eax = window number on screen @@ -1156,7 +1125,6 @@ restore_minimized_window: add edx, [edi+WDATA.box.height] call calculatescreen .done: - mov [mouse_background], 0 ; no mouse under .skip_redrawings: popfd ret @@ -1167,6 +1135,8 @@ iglobal window_moved db 'K : Window - done',13,10,0 endg +bPressedMouseXY_W db 0x0 + ; check window touch align 4 checkwindows: @@ -1181,10 +1151,10 @@ checkwindows: jne .restore call minimize_window jmp .continue - .restore: +.restore: call restore_minimized_window - .continue: - .no_minimizing: +.continue: +.no_minimizing: cmp byte [btn_down], 0 ; mouse buttons pressed ? jne .mouse_buttons_pressed @@ -1193,59 +1163,34 @@ checkwindows: ;..................................... end 1/4 : modified by vhanla ................... popad ret - .mouse_buttons_pressed: -;..................................... start 2/4 : modified by vhanla ................. - jmp @f - bPressedMouseXY_W db 0x0 - @@: -;..................................... end 2/4 : modified by vhanla ................... +.mouse_buttons_pressed: mov esi,[TASK_COUNT] inc esi ;..................................... start 3/4 : modified by vhanla ................. - push eax cmp [bPressedMouseXY_W],0 jnz @f mov [bPressedMouseXY_W],1 - mov ax,[MOUSE_X] - mov [mx],ax - mov ax,[MOUSE_Y] - mov [my],ax - @@: - pop eax +@@: ;..................................... end 3/4 : modified by vhanla ................... - cwloop: - cmp esi,2 - jb .exit + movzx eax,word [MOUSE_Y] + movzx ebx,word [MOUSE_X] + mov ecx, [Screen_Max_X] + add ebx, [_display_data] + inc ecx + mul ecx + movzx edi, byte [ebx+eax] + +cwloop: + + movzx esi, word [WIN_STACK + edi * 2] - dec esi - movzx edi, word [WIN_POS + esi * 2] ; ebx shl edi, 5 add edi, window_data -; mov edi, ebx - mov ecx, [edi + WDATA.box.left] - mov edx, [edi + WDATA.box.top] - mov eax,ecx - mov ebx,edx - test [edi+WDATA.fl_wstate],WSTATE_MINIMIZED - jnz cwloop - -;..................................... start 4/4 : modified by vhanla ................. - movzx eax, word [mx]; movzx eax,word[mouse_x] - movzx ebx, word [my]; movzx ebx,word[MOUSE_Y] -;..................................... endt 4/4 : modified by vhanla .................. - cmp ecx, eax - jae cwloop - cmp edx, ebx - jae cwloop - add ecx, [edi + WDATA.box.width] - add edx, [edi + WDATA.box.height] - cmp eax, ecx - jae cwloop - cmp ebx, edx - jae cwloop + movzx eax,word [MOUSE_X] + movzx ebx,word [MOUSE_Y] pushad mov eax, esi @@ -1259,11 +1204,11 @@ checkwindows: call waredraw add esp, 32 - .exit: +.exit: popad ret - .move_resize_window: ; MOVE OR RESIZE WINDOW +.move_resize_window: ; MOVE OR RESIZE WINDOW popad ; Check for user enabled fixed window @@ -1273,7 +1218,7 @@ checkwindows: jne .window_move_enabled_for_user popad ret - .window_move_enabled_for_user: +.window_move_enabled_for_user: test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP jnz .no_resize_2 @@ -1369,15 +1314,12 @@ checkwindows: ; move window - newchm: - - mov [dont_draw_mouse], 1 +newchm: call checkidle call checkVga_N13 - mov [mouse_background], 0 call [draw_pointer] @@ -1433,8 +1375,8 @@ checkwindows: je norepos_size pushad - mov edx,edi - sub edx,window_data + mov edx, edi + sub edx, window_data ;shr edx,5 ;shl edx,8 ;add edx,0x80000 ; process base at 0x80000+ @@ -1467,7 +1409,7 @@ checkwindows: mov [reposition],1 popad - norepos_size: +norepos_size: pop bx pop ax @@ -1480,8 +1422,7 @@ checkwindows: cmp byte [btn_down], 0 jne newchm ; new position done - mov [dont_draw_mouse], 1 - mov cl,0 + mov cl,0 test [edi+WDATA.fl_wstate],WSTATE_MAXIMIZED jnz @f mov cl,[reposition] @@ -1507,7 +1448,8 @@ checkwindows: test [edi+WDATA.fl_wstate],WSTATE_ROLLEDUP or WSTATE_MAXIMIZED jnz @f add ecx,2 - @@: sub edi,window_data +@@: + sub edi,window_data shr edi,5 shl edi,8 add edi,SLOT_BASE+APPDATA.saved_box @@ -1561,7 +1503,7 @@ checkwindows: @@: call check_window_position call set_window_clientbox - no_window_shade: +no_window_shade: push edx mov edx, [edi + WDATA.cl_workarea] @@ -1626,16 +1568,13 @@ checkwindows: sub eax,[edi+WDATA.box.height] mov [edi+WDATA.box.top],eax call set_window_clientbox - no_window_sizing: +no_window_sizing: popad cmp [reposition],0 je retwm - mov [dont_draw_mouse], 1 ; no mouse - - push eax ebx ecx edx mov eax,[edi+WDATA.box.left] mov ebx,[edi+WDATA.box.top] @@ -1661,17 +1600,13 @@ checkwindows: mov [edi+WDATA.fl_redraw],1 mov ecx,100 ; wait to avoid mouse residuals - waitre2: - mov [dont_draw_mouse], 1 - call checkidle +waitre2: + call checkidle cmp [edi+WDATA.fl_redraw],0 jz retwm loop waitre2 - retwm: - - mov [dont_draw_mouse], 0 ; mouse pointer - mov [mouse_background], 0 ; no mouse under +retwm: mov esi,window_moved call sys_msg_board_str diff --git a/kernel/branches/kolibri_pe/hid/mousedrv.inc b/kernel/branches/kolibri_pe/hid/mousedrv.inc index 2ed1d6f1fd..b82ec1b0e3 100644 --- a/kernel/branches/kolibri_pe/hid/mousedrv.inc +++ b/kernel/branches/kolibri_pe/hid/mousedrv.inc @@ -33,225 +33,49 @@ align 4 draw_mouse_under: ; return old picture - cmp [set_hw_cursor], 0 - jz @F - pushad - mov eax, [x_under] - mov ebx, [y_under] - stdcall [hw_restore], eax, ebx - popad - ret -@@: - pushad - xor ecx,ecx - xor edx,edx - align 4 -mres: - mov eax, [x_under] - mov ebx, [y_under] - add eax,ecx - add ebx,edx - push ecx - push edx - push eax - push ebx - mov eax,edx - shl eax,6 - shl ecx,2 - add eax,ecx - add eax,mouseunder - mov ecx,[eax] - pop ebx - pop eax - mov edi, 1 ;force - call [putpixel] - pop edx - pop ecx - inc ecx - cmp ecx, 16 - jnz mres - xor ecx, ecx - inc edx - cmp edx, 24 - jnz mres - popad - ret + cmp [set_hw_cursor], 0 + jz .exit + pushad + mov eax, [x_under] + mov ebx, [y_under] + stdcall [hw_restore], eax, ebx + popad +.exit: + ret save_draw_mouse: - cmp [set_hw_cursor], 0 - je .no_hw_cursor - pushad + cmp [set_hw_cursor], 0 + je .exit - mov [x_under], eax - mov [y_under], ebx - movzx eax,word [MOUSE_Y] - movzx ebx,word [MOUSE_X] - push eax - push ebx + pushad - mov ecx, [Screen_Max_X] - inc ecx - mul ecx - add eax, [_display_data] - movzx edx, byte [ebx+eax] - shl edx, 8 - mov esi, [edx+SLOT_BASE+APPDATA.cursor] + mov [x_under], eax + mov [y_under], ebx + movzx eax,word [MOUSE_Y] + movzx ebx,word [MOUSE_X] + push eax + push ebx - cmp esi, [current_cursor] - je .draw + mov ecx, [Screen_Max_X] + inc ecx + mul ecx + add eax, [_display_data] + movzx edx, byte [ebx+eax] + shl edx, 8 + mov esi, [edx+SLOT_BASE+APPDATA.cursor] - ; cmp [esi+CURSOR.magic], 'CURS' - ; jne .fail + cmp esi, [current_cursor] + je .draw - push esi - call [select_hw_cursor] - mov [current_cursor], esi + push esi + call [select_hw_cursor] + mov [current_cursor], esi .draw: - stdcall [set_hw_cursor], esi - popad - ret -.fail: - mov ecx, [def_cursor] - mov [edx+SLOT_BASE+APPDATA.cursor], ecx - stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax - popad - ret - -.no_hw_cursor: - pushad - ; save & draw - mov [x_under], eax - mov [y_under], ebx - push eax - push ebx - mov ecx,0 - mov edx,0 - align 4 -drm: - push eax - push ebx - push ecx - push edx - ; helloworld - push ecx - add eax,ecx ; save picture under mouse - add ebx,edx - push ecx - call getpixel - mov [color_temp],ecx - pop ecx - mov eax,edx - shl eax,6 - shl ecx,2 - add eax,ecx - add eax,mouseunder - mov ebx,[color_temp] - mov [eax],ebx - pop ecx - mov edi,edx ; y cycle - shl edi,4 ; *16 bytes per row - add edi,ecx ; x cycle - lea edi, [mousepointer+edi+edi*2] ; we have our str address - mov esi, edi - add esi, 16*24*3 - push ecx - mov ecx, [color_temp] - call combine_colors - mov [mouse_color_mem], ecx - pop ecx - pop edx - pop ecx - pop ebx - pop eax - add eax,ecx ; we have x coord+cycle - add ebx,edx ; and y coord+cycle - push ecx - mov ecx, [mouse_color_mem] - mov edi, 1 - call [putpixel] - pop ecx - mov ebx,[esp+0] ; pure y coord again - mov eax,[esp+4] ; and x - inc ecx ; +1 cycle - cmp ecx,16 ; if more than 16 - jnz drm - xor ecx, ecx - inc edx - cmp edx,24 - jnz drm - add esp,8 - popad - ret - - -combine_colors: - ; in - ; ecx - color ( 00 RR GG BB ) - ; edi - ref to new color byte - ; esi - ref to alpha byte - ; - ; out - ; ecx - new color ( roughly (ecx*[esi]>>8)+([edi]*[esi]>>8) ) - push eax - push ebx - push edx - push ecx - xor ecx, ecx - ; byte 2 - mov eax, 0xff - sub al, [esi+0] - mov ebx, [esp] - shr ebx, 16 - and ebx, 0xff - mul ebx - shr eax, 8 - add ecx, eax - xor eax, eax - xor ebx, ebx - mov al, [edi+0] - mov bl, [esi+0] - mul ebx - shr eax, 8 - add ecx, eax - shl ecx, 8 - ; byte 1 - mov eax, 0xff - sub al, [esi+1] - mov ebx, [esp] - shr ebx, 8 - and ebx, 0xff - mul ebx - shr eax, 8 - add ecx, eax - xor eax, eax - xor ebx, ebx - mov al, [edi+1] - mov bl, [esi+1] - mul ebx - shr eax, 8 - add ecx, eax - shl ecx, 8 - ; byte 2 - mov eax, 0xff - sub al, [esi+2] - mov ebx, [esp] - and ebx, 0xff - mul ebx - shr eax, 8 - add ecx, eax - xor eax, eax - xor ebx, ebx - mov al, [edi+2] - mov bl, [esi+2] - mul ebx - shr eax, 8 - add ecx, eax - pop eax - pop edx - pop ebx - pop eax - ret + stdcall [set_hw_cursor], esi + popad +.exit: + ret __sys_disable_mouse: @@ -276,7 +100,7 @@ __sys_disable_mouse: movzx ebx, byte [ecx] cmp eax,ebx je yes_mouse_disable - movzx ebx, byte [ecx+16] + movzx ebx, byte [ecx+32] cmp eax,ebx je yes_mouse_disable mov ebx,[Screen_Max_X] @@ -286,7 +110,7 @@ __sys_disable_mouse: movzx ebx, byte [ecx] cmp eax,ebx je yes_mouse_disable - movzx ebx, byte [ecx+16] + movzx ebx, byte [ecx+32] cmp eax,ebx je yes_mouse_disable jmp no_mouse_disable @@ -435,3 +259,78 @@ mouse_acceleration: @@: ret + +;[ecx] x +;[ecx+4] y +;[ecx+8] w +;[ecx+12] h + +align 4 +lock_cursor: + + pushfd + cli + + xor eax, eax + mov edx, [ecx] + mov ebx, [ecx+4] + cmp edx, [cur.right] + jg .done + + cmp ebx, [cur.bottom] + jg .done + + add edx, [ecx+8] + add ebx, [ecx+12] + cmp edx, [cur.left] + jle .done + + cmp ebx, [cur.top] + jle .done + + mov ecx, [CURRENT_TASK] + + mov ebx, [cur.left] + mov eax, [cur.top] + add ebx, [_display_data] + mul [_screen_width] + add ebx, eax + + cmp cl, [ebx] + je .disable + + cmp cl, [ebx+31] + je .disable + + mov eax, [_screen_width] + shl eax, 5 + sub eax, [_screen_width] + + cmp cl, [ebx+eax] + je .disable + + cmp cl, [ebx+eax+31] + jne .done + +.disable: + call draw_mouse_under + + mov eax, 1 +.done: + inc eax + mov [cur.lock], eax + popfd + ret + +align 4 +unlock_cursor: + pushfd + cli + cmp [cur.lock], 2 + jne .done + + call save_draw_mouse +.done: + mov [cur.lock], 1 + popfd + ret diff --git a/kernel/branches/kolibri_pe/include/core.h b/kernel/branches/kolibri_pe/include/core.h index d3ca794c1e..53e61187fd 100644 --- a/kernel/branches/kolibri_pe/include/core.h +++ b/kernel/branches/kolibri_pe/include/core.h @@ -189,3 +189,54 @@ typedef struct #define EFL_IOPL1 0x1000 #define EFL_IOPL2 0x2000 #define EFL_IOPL3 0x3000 + +typedef struct +{ + u32_t handle; + u32_t io_code; + void *input; + int inp_size; + void *output; + int out_size; +}ioctl_t; + + +typedef struct +{ + u32_t code; + union + { + struct /* window event */ + { + u32_t win; /* window handle */ + u32_t val1; + u32_t val2; + u16_t x; /* cursor x */ + u16_t y; /* cursor y */ + u32_t unused; + }__attribute__ ((packed)); + + struct /* realtime io */ + { + u32_t sender; /* service handler */ + u32_t stream; /* io stream id, if present */ + addr_t offset; + size_t size; + }; + + struct /* ipc event */ + { + u32_t sender; + u32_t io_code; + addr_t *input; + size_t inp_size; + addr_t *output; + size_t out_size; + }; + }; +}event_t; + + + + + diff --git a/kernel/branches/kolibri_pe/include/types.h b/kernel/branches/kolibri_pe/include/types.h index c4e4154ff0..7345011e7e 100644 --- a/kernel/branches/kolibri_pe/include/types.h +++ b/kernel/branches/kolibri_pe/include/types.h @@ -14,7 +14,7 @@ typedef u32_t count_t; typedef u32_t size_t; typedef u32_t index_t; typedef u32_t eflags_t; - +typedef u32_t color_t; typedef int bool; diff --git a/kernel/branches/kolibri_pe/kernel.asm b/kernel/branches/kolibri_pe/kernel.asm index 210c860e06..413a369e59 100644 --- a/kernel/branches/kolibri_pe/kernel.asm +++ b/kernel/branches/kolibri_pe/kernel.asm @@ -134,6 +134,7 @@ public _rd_fat_end public _rd_root public _rd_root_end +public _current_task public _current_slot public _current_thread public _k_reenter @@ -196,6 +197,11 @@ public scr_mode public LFBAddress public LFBSize +public _screen_width +public _screen_height + +public _vesa20_drawbar + extrn __edata @@ -294,12 +300,12 @@ include 'printf.inc' align 4 init_apm: ; init selectors - mov ebx, [BOOT_VAR +0x9040] ; offset of APM entry point - movzx eax, word [BOOT_VAR+0x9050] ; real-mode segment base address of + mov ebx, [OS_BASE +0x9040] ; offset of APM entry point + movzx eax, word [OS_BASE+0x9050] ; real-mode segment base address of ; protected-mode 32-bit code segment - movzx ecx, word [BOOT_VAR+0x9052] ; real-mode segment base address of + movzx ecx, word [OS_BASE+0x9052] ; real-mode segment base address of ; protected-mode 16-bit code segment - movzx edx, word [BOOT_VAR+0x9054] ; real-mode segment base address of + movzx edx, word [OS_BASE+0x9054] ; real-mode segment base address of ; protected-mode 16-bit data segment shl eax, 4 @@ -320,7 +326,7 @@ init_apm: mov dword[apm_entry], ebx mov word [apm_entry + 4], apm_code_32 - _gdts - mov eax, [BOOT_VAR + 0x9044] ; version & flags + mov eax, [OS_BASE + 0x9044] ; version & flags mov [apm_vf], eax ret @@ -332,33 +338,35 @@ system_init: call init_apm ; SAVE REAL MODE VARIABLES - mov ax, [BOOT_VAR + 0x9031] + mov ax, [OS_BASE + 0x9031] mov [IDEContrRegsBaseAddr], ax - mov al, [BOOT_VAR+0x901F] ; DMA access + mov al, [OS_BASE+0x901F] ; DMA access mov [allow_dma_access], al - movzx eax, byte [BOOT_VAR+0x9000] ; bpp + movzx eax, byte [OS_BASE+0x9000] ; bpp mov [ScreenBPP], eax - movzx eax,word [BOOT_VAR+0x900A] ; X max + movzx eax,word [OS_BASE+0x900A] ; X max + movzx ebx,word [OS_BASE+0x900C] ; Y max + mov [_screen_width], eax + mov [_screen_height], ebx dec eax + dec ebx mov [Screen_Max_X],eax mov [screen_workarea.right],eax - movzx eax,word [BOOT_VAR+0x900C] ; Y max - dec eax - mov [Screen_Max_Y],eax - mov [screen_workarea.bottom],eax + mov [Screen_Max_Y],ebx + mov [screen_workarea.bottom],ebx mov [BytesPerScanLine], 640*4 cmp [scr_mode], 0x13 ; 320x200 je @f cmp [scr_mode], 0x12 ; VGA 640x480 je @f - movzx eax, word [BOOT_VAR+0x9001] ; for other modes + movzx eax, word [OS_BASE+0x9001] ; for other modes mov [BytesPerScanLine], eax @@: - mov esi, BOOT_VAR+0x9080 + mov esi, OS_BASE+0x9080 movzx ecx, byte [esi-1] mov [NumBiosDisks], ecx mov edi, BiosDisksData @@ -366,7 +374,7 @@ system_init: ; GRAPHICS ADDRESSES - mov byte [BOOT_VAR+0x901e],0x0 + mov byte [OS_BASE+0x901e],0x0 cmp [scr_mode], 0100000000000000b jge setvesa20 @@ -987,10 +995,10 @@ set_variables: mov [BTN_COUNT], 0 ; button buffer push eax - mov ax,[BOOT_VAR+0x900c] + mov ax,[OS_BASE+0x900c] shr ax,1 shl eax,16 - mov ax,[BOOT_VAR+0x900A] + mov ax,[OS_BASE+0x900A] shr ax,1 mov dword [MOUSE_X], eax pop eax @@ -1446,10 +1454,6 @@ no_set_lba_read: ret no_set_pci_access: -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -include 'vmodeint.inc' -;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - sys_setup_err: mov [esp+36],dword -1 ret @@ -1799,7 +1803,7 @@ sysfn_shutdown: ; 18.9 = system shutdown jl exit_for_anyone cmp ecx,4 jg exit_for_anyone - mov [BOOT_VAR+0x9030],cl + mov [OS_BASE+0x9030],cl mov eax,[TASK_COUNT] mov [sys_shutdown], eax @@ -1925,17 +1929,17 @@ sysfn_minimize: ; 18.10 = minimize window sysfn_getdiskinfo: ; 18.11 = get disk info table cmp ecx,1 jnz full_table - small_table: +small_table: call for_all_tables mov ecx,10 cld rep movsb ret - for_all_tables: +for_all_tables: mov edi,edx mov esi,DRIVE_DATA ret - full_table: +full_table: cmp ecx,2 jnz exit_for_anyone call for_all_tables @@ -2317,7 +2321,7 @@ sys_getbackground: jnz nogb1 mov eax,[BgrDataWidth] shl eax,16 - mov ax,[BgrDataHeight] + mov ax, word [BgrDataHeight] mov [esp+36],eax ret @@ -2593,14 +2597,14 @@ sys_redrawstat: jne no_widgets_away ; buttons away mov ecx,[CURRENT_TASK] - sys_newba2: +sys_newba2: mov edi,[btn_addr] cmp [edi], dword 0 ; empty button list ? je end_of_buttons_away movzx ebx, word [edi] inc ebx mov eax,edi - sys_newba: +sys_newba: dec ebx jz end_of_buttons_away @@ -2630,17 +2634,16 @@ sys_redrawstat: jnz srl1 mov edx, [TASK_BASE] ; return whole screen draw area for this app - add edx, draw_data - CURRENT_TASK - mov [edx + RECT.left], 0 - mov [edx + RECT.top], 0 + sub edx, CURRENT_TASK + mov [edx +draw_data + RECT.left], 0 + mov [edx +draw_data+ RECT.top], 0 mov eax, [Screen_Max_X] - mov [edx + RECT.right], eax + mov [edx +draw_data+ RECT.right], eax mov eax, [Screen_Max_Y] - mov [edx + RECT.bottom], eax + mov [edx +draw_data+ RECT.bottom], eax mov edi, [TASK_BASE] or [edi - twdw + WDATA.fl_wdrawn], 1 ; no new position & buttons from app - call sys_window_mouse ret srl1: @@ -2664,7 +2667,7 @@ sys_drawwindow: ;call [draw_pointer] ;ret jmp draw_window_caption.2 - nosyswI: +nosyswI: cmp al,1 ; type II - only reserve area, no draw jne nosyswII @@ -2672,7 +2675,6 @@ sys_drawwindow: call [disable_mouse] call sys_set_window call [disable_mouse] - call sys_window_mouse dec [mouse_pause] call [draw_pointer] ret @@ -2695,7 +2697,7 @@ sys_drawwindow: je draw_skin_window cmp al,4 ; type V - skinned window not sized! {not_sized_skin_window} jne nosyswV - draw_skin_window: +draw_skin_window: inc [mouse_pause] call [disable_mouse] @@ -2910,10 +2912,6 @@ sys_set_window: test [edi+WDATA.fl_wdrawn],1 jnz newd - mov eax,[timer_ticks] ;[0xfdf0] - add eax,100 - mov [new_window_starting],eax - movsx eax,bx mov [edi+WDATA.box.width],eax movsx eax,cx @@ -2945,7 +2943,7 @@ sys_set_window: je set_APPDATA_wnd_caption jmp @f - set_APPDATA_wnd_caption: +set_APPDATA_wnd_caption: mov [edi+APPDATA.wnd_caption],eax @@: mov esi,[esp+0] @@ -2974,7 +2972,7 @@ sys_set_window: mov [KEY_COUNT], 0 ; empty keyboard buffer mov [BTN_COUNT], 0 ; empty button buffer - newd: +newd: mov [edi+WDATA.fl_redraw],byte 0 ; no redraw mov edx,edi @@ -3100,14 +3098,11 @@ sys_window_move: xor esi,esi call redrawscreen - mov [dont_draw_mouse], 0 ; mouse pointer - mov [mouse_background], 0 ; no mouse under - call [draw_pointer] mov [window_move_pr],0 - .window_move_return: +.window_move_return: ret @@ -3425,41 +3420,41 @@ redrawscreen: cmp ecx,eax jb ricino - bgli: +bgli: cmp ecx,1 - jnz .az + jnz .az mov al, byte [redraw_background] cmp al,2 jz newdw8 test al,al jz .az - lea eax,[edi+draw_data-window_data] + lea eax,[edi+draw_data+(0x100000000-OS_BASE)] mov ebx,[dlx] cmp ebx,[eax+RECT.left] jae @f mov [eax+RECT.left],ebx - @@: +@@: mov ebx,[dly] cmp ebx,[eax+RECT.top] jae @f mov [eax+RECT.top],ebx - @@: +@@: mov ebx,[dlxe] cmp ebx,[eax+RECT.right] jbe @f mov [eax+RECT.right],ebx - @@: +@@: mov ebx,[dlye] cmp ebx,[eax+RECT.bottom] jbe @f mov [eax+RECT.bottom],ebx - @@: +@@: jmp newdw8 - .az: +.az: mov eax,edi - add eax,draw_data-window_data + add eax, draw_data+(0x100000000-OS_BASE) mov ebx,[dlx] ; set limits mov [eax + RECT.left], ebx @@ -3470,20 +3465,20 @@ redrawscreen: mov ebx,[dlye] mov [eax + RECT.bottom], ebx - sub eax,draw_data-window_data + sub eax,draw_data+(0x100000000-OS_BASE) cmp dword [esp],1 jne nobgrd mov [redraw_background], 1 - newdw8: - nobgrd: +newdw8: +nobgrd: mov [eax + WDATA.fl_redraw],byte 1 ; mark as redraw - ricino: +ricino: - not_this_task: +not_this_task: pop ecx @@ -3710,7 +3705,7 @@ get_irq_data: dec edx jmp gid1 - gidril1: +gidril1: shl ebx, 12 lea eax, [ebx + IRQ_SAVE] ; calculate address of the beginning of buffer + 0x0 - data size @@ -4046,15 +4041,15 @@ sys_putimage: jz .exit test ecx,0xFFFF0000 jnz @f - .exit: +.exit: ret - @@: +@@: mov edi,[current_slot] add dx,word[edi+APPDATA.wnd_clientbox.top] rol edx,16 add dx,word[edi+APPDATA.wnd_clientbox.left] rol edx,16 - .forced: +.forced: push ebp esi 0 mov ebp, putimage_get24bpp mov esi, putimage_init24bpp @@ -5094,7 +5089,7 @@ undefined_syscall: ; Undefined system call align 4 system_shutdown: ; shut down the system - cmp byte [BOOT_VAR+0x9030], 1 + cmp byte [OS_BASE+0x9030], 1 jne @F ret @@: @@ -5107,10 +5102,10 @@ yes_shutdown_param: cli - cmp byte [BOOT_VAR+0x9030], 3 + cmp byte [OS_BASE+0x9030], 3 je _sys_reboot - cmp byte [BOOT_VAR+0x9030], 4 + cmp byte [OS_BASE+0x9030], 4 je _sys_restart cld @@ -5148,10 +5143,6 @@ _sys_restart: call restorefatchain cld - mov esi, BOOT_VAR ; restore 0x0 - 0xffff - mov edi, OS_BASE - mov ecx,0x10000/4 - rep movsd ; mov eax, [_copy_pg_balloc] mov [_pg_balloc], eax diff --git a/kernel/branches/kolibri_pe/kernel32.inc b/kernel/branches/kolibri_pe/kernel32.inc index 1d1123af66..0ec2dce509 100644 --- a/kernel/branches/kolibri_pe/kernel32.inc +++ b/kernel/branches/kolibri_pe/kernel32.inc @@ -219,13 +219,6 @@ include "video/cursors.inc" ; cursors functions include "network/stack.inc" -;include "drivers/uart.inc" - - -; Mouse pointer - -include "gui/mouse.inc" - ; Window skinning include "gui/skincode.inc" diff --git a/kernel/branches/kolibri_pe/makefile b/kernel/branches/kolibri_pe/makefile index 18635c58c9..15aadfe000 100644 --- a/kernel/branches/kolibri_pe/makefile +++ b/kernel/branches/kolibri_pe/makefile @@ -6,11 +6,12 @@ INCLUDE = include/ DEFS = -DUSE_SMP -DCONFIG_DEBUG -CFLAGS = -c -O2 -I $(INCLUDE) -fomit-frame-pointer -fno-builtin +CFLAGS = -c -O2 -DCONFIG_DEBUG -I $(INCLUDE) -fomit-frame-pointer -fno-builtin LDFLAGS = -shared -s -Map kernel.map --image-base 0x100000 --file-alignment 32 KERNEL_SRC:= \ kernel.asm \ + const.inc \ data32.inc \ core/memory.inc \ core/heap.inc \ @@ -18,13 +19,15 @@ KERNEL_SRC:= \ core/taskman.inc \ core/v86.inc \ core/sys32.inc \ + core/syscall.inc \ core/dll.inc \ core/exports.inc \ fs/ntfs.inc \ gui/window.inc \ gui/event.inc \ video/vesa20.inc \ - video/cursors.inc + video/cursors.inc \ + hid/mousedrv.inc PE_SRC:= \ diff --git a/kernel/branches/kolibri_pe/video/cursors.inc b/kernel/branches/kolibri_pe/video/cursors.inc index f530e2197b..9176a21ef3 100644 --- a/kernel/branches/kolibri_pe/video/cursors.inc +++ b/kernel/branches/kolibri_pe/video/cursors.inc @@ -470,7 +470,6 @@ proc init_cursors jne .fail sub ebx, 96 .init: - mov [cur_def_interl], ebx ; stdcall load_driver, szHwMouse ; mov [hw_cursor], eax @@ -486,13 +485,6 @@ proc init_cursors stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM mov [def_cursor], eax - mov ecx, [Screen_Max_X] - mov edx, [Screen_Max_Y] - inc ecx - inc edx - mov [scr_width], ecx - mov [scr_height], edx - mov ebx, [ScreenBPP] cmp ebx, 32 jne @F @@ -517,22 +509,20 @@ endp align 4 proc restore_24 stdcall, x:dword, y:dword - locals - w dd ? - endl - mov edi, [cur_saved_base] - mov edx, [cur_saved_h] - mov ebx, [cur_saved_interl] + mov ebx, [cur_saved_base] + mov edx, [cur.h] test edx, edx jz .ret mov esi, cur_saved_data @@: - mov ecx, [cur_saved_w] + mov edi, ebx + add ebx, [BytesPerScanLine] + + mov ecx, [cur.w] lea ecx, [ecx+ecx*2] rep movsb - add edi, ebx dec edx jnz @B .ret: @@ -541,21 +531,19 @@ endp align 4 proc restore_32 stdcall, x:dword, y:dword - locals - w dd ? - endl - mov edi, [cur_saved_base] - mov edx, [cur_saved_h] - mov ebx, [cur_saved_interl] + mov ebx, [cur_saved_base] + mov edx, [cur.h] test edx, edx jz .ret mov esi, cur_saved_data @@: - mov ecx, [cur_saved_w] + mov edi, ebx + add ebx, [BytesPerScanLine] + + mov ecx, [cur.w] rep movsd - add edi, ebx dec edx jnz @B .ret: @@ -565,9 +553,7 @@ endp align 4 proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword locals - w dd ? h dd ? - st dd ? _dx dd ? _dy dd ? endl @@ -579,95 +565,92 @@ proc cursor_24 stdcall, hcursor:dword, x:dword, y:dword 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 edi, eax - sub edi, [y] - mov [_dy], edi - - mul ebx - lea esi, [LFB_BASE+ecx+ecx*2] - add esi, eax - mov [cur_saved_base],esi - - mov edi, [scr_width] - mov edx, [scr_height] - mov eax, 32 - - sub edi, ecx - cmp edi, eax - jng @F - mov edi, eax -@@: - sub edi, [_dx] - - sub edx, [y] - cmp edx, eax - jng @F + mov [cur.top], eax mov edx, eax + sub edx, [y] + mov [_dy], edx + + mul [BytesPerScanLine] + lea edx, [LFB_BASE+ecx*3] + add edx, eax + mov [cur_saved_base],edx + + cmp ebx, [Screen_Max_X] + jbe @F + mov ebx, [Screen_Max_X] @@: - sub edx, [_dy] + cmp edi, [Screen_Max_Y] + jbe @F + mov edi, [Screen_Max_Y] +@@: + mov [cur.right], ebx + mov [cur.bottom], edi - mov [w], edi - mov [h], edx - mov [cur_saved_w], edi - mov [cur_saved_h], edx + sub ebx, [x] + sub edi, [y] + inc ebx + inc edi - sub eax, edi - shl eax, 2 ;lea eax, [eax+eax*2] - lea edi, [edi+edi*2] - sub ebx, edi - mov [cur_saved_interl], ebx + mov [cur.w], ebx + mov [cur.h], edi + mov [h], edi + mov eax, edi mov edi, cur_saved_data @@: - mov ecx, [w] + mov esi, edx + add edx, [BytesPerScanLine] + mov ecx, [cur.w] lea ecx, [ecx+ecx*2] rep movsb - add esi, ebx - dec edx + dec eax jnz @B ;draw cursor - mov edx, eax - mov edi, [cur_saved_base] + mov ebx, [cur_saved_base] mov eax, [_dy] shl eax, 5 add eax, [_dx] - shl eax, 2 mov esi, [hcursor] mov esi, [esi+CURSOR.base] - add esi, eax + lea edx, [esi+eax*4] .row: - mov ecx, [w] + mov ecx, [cur.w] + mov esi, edx + mov edi, ebx + add edx, 32*4 + add ebx, [BytesPerScanLine] .pix: lodsd test eax, 0xFF000000 jz @F - mov word [edi], ax + mov [edi], ax shr eax, 16 - mov [edi+2],al + mov [edi+2], al @@: add edi, 3 dec ecx jnz .pix - add esi, edx - add edi, ebx dec [h] jnz .row ret @@ -676,9 +659,7 @@ endp align 4 proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword locals - w dd ? h dd ? - st dd ? _dx dd ? _dy dd ? endl @@ -686,82 +667,80 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword mov esi, [hcursor] mov ecx, [x] mov eax, [y] - mov ebx, [BytesPerScanLine] 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 edi, eax - sub edi, [y] - mov [_dy], edi - - mul ebx - lea esi, [LFB_BASE+eax+ecx*4] - mov [cur_saved_base],esi - - mov edi, [scr_width] - mov edx, [scr_height] - mov eax, 32 - - sub edi, ecx - cmp edi, eax - jng @F - mov edi, eax -@@: - sub edi, [_dx] - - sub edx, [y] - cmp edx, eax - jng @F + mov [cur.top], eax mov edx, eax + sub edx, [y] + mov [_dy], edx + + mul [BytesPerScanLine] + lea edx, [LFB_BASE+eax+ecx*4] + mov [cur_saved_base],edx + + cmp ebx, [Screen_Max_X] + jbe @F + mov ebx, [Screen_Max_X] @@: - sub edx, [_dy] + cmp edi, [Screen_Max_Y] + jbe @F + mov edi, [Screen_Max_Y] +@@: + mov [cur.right], ebx + mov [cur.bottom], edi - mov [w], edi - mov [h], edx - mov [cur_saved_w], edi - mov [cur_saved_h], edx + sub ebx, [x] + sub edi, [y] + inc ebx + inc edi - sub eax, edi - shl eax, 2 - shl edi, 2 - sub ebx, edi - mov [cur_saved_interl], ebx + mov [cur.w], ebx + mov [cur.h], edi + mov [h], edi + mov eax, edi mov edi, cur_saved_data @@: - mov ecx, [w] + mov esi, edx + add edx, [BytesPerScanLine] + mov ecx, [cur.w] rep movsd - add esi, ebx - dec edx + dec eax jnz @B ;draw cursor - mov edx, eax - mov edi, [cur_saved_base] + mov ebx, [cur_saved_base] mov eax, [_dy] shl eax, 5 add eax, [_dx] - shl eax, 2 mov esi, [hcursor] mov esi, [esi+CURSOR.base] - add esi, eax + lea edx, [esi+eax*4] .row: - mov ecx, [w] + mov ecx, [cur.w] + mov esi, edx + mov edi, ebx + add edx, 32*4 + add ebx, [BytesPerScanLine] .pix: lodsd test eax, 0xFF000000 @@ -771,8 +750,7 @@ proc cursor_32 stdcall, hcursor:dword, x:dword, y:dword add edi, 4 dec ecx jnz .pix - add esi, edx - add edi, ebx + dec [h] jnz .row ret diff --git a/kernel/branches/kolibri_pe/video/vesa12.inc b/kernel/branches/kolibri_pe/video/vesa12.inc index ee2bcb95e7..0904f7458f 100644 --- a/kernel/branches/kolibri_pe/video/vesa12.inc +++ b/kernel/branches/kolibri_pe/video/vesa12.inc @@ -438,16 +438,17 @@ vesa12_drawbar: push eax push ecx mov eax,[TASK_BASE] - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.left] + sub eax, CURRENT_TASK + mov ecx,[eax+draw_data+RECT.left] cmp ecx,0 jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.top] + mov ecx,[eax+draw_data+RECT.top] cmp ecx,0 jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] + mov ecx,[eax+draw_data+RECT.right] cmp ecx,[Screen_Max_X] jnz dbcblimitlset12 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] + mov ecx,[eax+draw_data+RECT.bottom] cmp ecx,[Screen_Max_Y] jnz dbcblimitlset12 pop ecx @@ -796,14 +797,15 @@ vesa12_putimage: push ecx mov eax,[TASK_BASE] - cmp dword [eax+draw_data-CURRENT_TASK+RECT.left], 0 + sub eax, CURRENT_TASK + cmp dword [eax+draw_data+RECT.left], 0 jnz dbcblimitlset212 - cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0 + cmp dword [eax+draw_data+RECT.top], 0 jnz dbcblimitlset212 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right] + mov ecx,[eax+draw_data+RECT.right] cmp ecx,[Screen_Max_X] jnz dbcblimitlset212 - mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom] + mov ecx,[eax+draw_data+RECT.bottom] cmp ecx,[Screen_Max_Y] jnz dbcblimitlset212 pop ecx diff --git a/kernel/branches/kolibri_pe/video/vesa20.inc b/kernel/branches/kolibri_pe/video/vesa20.inc index cea271151a..43a9b37f83 100644 --- a/kernel/branches/kolibri_pe/video/vesa20.inc +++ b/kernel/branches/kolibri_pe/video/vesa20.inc @@ -574,6 +574,7 @@ align 4 ; ecx xe ; edx ye ; edi color +_vesa20_drawbar: vesa20_drawbar: pushad call [disable_mouse]