Subversion Repositories Kolibri OS

Compare Revisions

Ignore whitespace Rev 995 → Rev 996

/kernel/branches/kolibri_pe/blkdev/cd_drv.inc
14,7 → 14,7
; Àâòîð ÷àñòè èñõîäíîãî òåêñòà Êóëàêîâ Âëàäèìèð Ãåííàäüåâè÷
; Àäàïòàöèÿ, äîðàáîòêà è ðàçðàáîòêà Mario79
 
; Ìàêñèìàëüíîå êîëè÷åñòâî ïîâòîðåíèé îïåðàöèè ÷òåíèÿ
; Ìàêñèìàëüíîå êîëè÷åñòâî ïîâòîðåíèé îïåðàöèè ÷òåíè
MaxRetr equ 10
; Ïðåäåëüíîå âðåìÿ îæèäàíèÿ ãîòîâíîñòè ê ïðèåìó êîìàíäû
; (â òèêàõ)
38,7 → 38,7
mov [CDBlockSize],2048 ;2352
; Î÷èñòèòü áóôåð ïàêåòíîé êîìàíäû
call clear_packet_buffer
; Ñôîðìèðîâàòü ïàêåòíóþ êîìàíäó äëÿ ñ÷èòûâàíèÿ
; Ñôîðìèðîâàòü ïàêåòíóþ êîìàíäó äëÿ ñ÷èòûâàíè
; ñåêòîðà äàííûõ
; Çàäàòü êîä êîìàíäû Read CD
mov [PacketCommand],byte 0x28 ;0xBE
168,7 → 168,6
; Îáëàñòü ïàìÿòè äëÿ ôîðìèðîâàíèÿ ïàêåòíîé êîìàíäû
PacketCommand: rb 12 ;DB 12 DUP (?)
; Îáëàñòü ïàìÿòè äëÿ ïðèåìà äàííûõ îò äèñêîâîäà
;CDDataBuf DB 4096 DUP (0)
; Ðàçìåð ïðèíèìàåìîãî áëîêà äàííûõ â áàéòàõ
CDBlockSize DW ?
; Àäðåñ ñ÷èòûâàåìîãî ñåêòîðà äàííûõ
177,7 → 176,7
TickCounter_1 DD 0
; Âðåìÿ íà÷àëà îæèäàíèÿ ãîòîâíîñòè óñòðîéñòâà
WURStartTime DD 0
; óêàçàòåëü áóôåðà äëÿ ñ÷èòûâàíèÿ
; óêàçàòåëü áóôåðà äëÿ ñ÷èòûâàíè
CDDataBuf_pointer dd 0
 
;****************************************************
342,7 → 341,7
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
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
; Ñôîðìèðîâàòü êîìàíäó START/STOP UNIT
; Çàäàòü êîä êîìàíäû
mov [PacketCommand],word 1Bh
; Çàäàòü îïåðàöèþ çàãðóçêè íîñèòåëÿ
; Çàäàòü îïåðàöèþ çàãðóçêè íîñèòåë
mov [PacketCommand+4],word 00000011b
; Ïîäàòü êîìàíäó
call SendPacketNoDatCommand
666,7 → 665,7
; Ñôîðìèðîâàòü êîìàíäó START/STOP UNIT
; Çàäàòü êîä êîìàíäû
mov [PacketCommand],word 1Bh
; Çàäàòü îïåðàöèþ èçâëå÷åíèÿ íîñèòåëÿ
; Çàäàòü îïåðàöèþ èçâëå÷åíèÿ íîñèòåë
mov [PacketCommand+4],word 00000010b
; Ïîäàòü êîìàíäó
call SendPacketNoDatCommand
/kernel/branches/kolibri_pe/blkdev/hd_drv.inc
478,10 → 478,10
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
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
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
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
/kernel/branches/kolibri_pe/const.inc
208,68 → 208,35
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_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
.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 '
/kernel/branches/kolibri_pe/core/dll.c
454,10 → 454,10
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,13 → 585,12
 
DBG("import from %s\n",libname);
 
exp_dll = find_dll(&core_dll.link, libname);
if(exp_dll == NULL)
{
exp_dll = find_dll(&current_slot->dll_list, libname);
if(exp_dll != NULL)
if(exp_dll == NULL)
{
DBG("find %s\n", exp_dll->img_name);
}
else
{
int len = strlen(libname)+1;
 
memcpy(path, "/sys/lib/",9);
604,6 → 603,8
return false;
};
}
};
DBG("find %s\n", exp_dll->img_name);
 
exp = exp_dll->img_exp;
 
/kernel/branches/kolibri_pe/core/init.asm
218,26 → 218,9
 
; 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
 
mov [_current_thread], eax
 
xchg bx, bx
 
mov ebx, [eax+THR.pdir]
mov ecx, cr3
cmp ebx, ecx
/kernel/branches/kolibri_pe/core/sys32.inc
592,26 → 592,25
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
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
/kernel/branches/kolibri_pe/core/taskman.inc
432,7 → 432,7
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
 
align 4
_pe_restart:
xchg bx, bx
add esp, 12
popad
iretd
/kernel/branches/kolibri_pe/core/v86.inc
94,9 → 94,9
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
/kernel/branches/kolibri_pe/data32.inc
282,15 → 282,51
 
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
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
srv.fd rd 1
srv.bk rd 1
 
scr_width rd 1
scr_height rd 1
 
_HwCursorCreate:
create_cursor rd 1
 
375,12 → 411,16
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
ipc_ptab rd 1
417,6 → 457,9
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
 
423,8 → 466,9
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
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
/kernel/branches/kolibri_pe/drivers/sb16/CONFIG.INC
6,10 → 6,8
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
/kernel/branches/kolibri_pe/gui/button.inc
584,8 → 584,6
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
/kernel/branches/kolibri_pe/gui/skincode.inc
10,8 → 10,6
 
include "skindata.inc"
 
;skin_data = 0x00778000
 
read_skin_file:
stdcall load_file, ebx
test eax, eax
213,7 → 211,7
ret
 
sys_putimage_with_check:
or ebx,ebx
test ebx,ebx
jz @f
call sys_putimage.forced
@@: ret
257,7 → 255,7
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
 
dec eax
jnz .baseskinloop
.non_base:
.non_base:
 
mov esi,[esp+4]
mov edx,[esi+WDATA.box.width]
317,7 → 315,7
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
mov al,[esp+32+4+4]
call drawwindow_IV_caption
 
draw_clientbar:
draw_clientbar:
 
mov esi,[esp]
 
373,7 → 371,7
test edi,0x40000000
jnz _noinside2
call [drawbar]
_noinside2:
_noinside2:
 
cmp dword[skin_data],'SKIN'
jne no_skin_add_button
402,7 → 400,7
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
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
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
/kernel/branches/kolibri_pe/gui/skindata.inc
54,6 → 54,8
skin_btn_close SKIN_BUTTON
skin_btn_minimize SKIN_BUTTON
 
public _skin_active
_skin_active:
skin_active SKIN_DATA
skin_inactive SKIN_DATA
 
/kernel/branches/kolibri_pe/gui/window.inc
73,8 → 73,8
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,19 → 103,19
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]
122,18 → 122,18
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
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
 
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
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
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
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
test edi,0x40000000
jnz noinside
call [drawbar]
noinside:
noinside:
 
popad
 
799,9 → 772,9
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
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
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
test edi,0x40000000
jnz noinside2
call [drawbar]
noinside2:
noinside2:
 
popad
 
989,7 → 962,7
 
push esi
 
.new_check:
.new_check:
 
pop esi
add esi, 2
1045,8 → 1018,6
ret
 
 
 
 
waredraw: ; if redraw necessary at activate
 
pushad
1083,14 → 1054,12
 
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
add edx, [edi+WDATA.box.height]
call calculatescreen
.done:
mov [mouse_background], 0 ; no mouse under
.skip_redrawings:
popfd
ret
1167,6 → 1135,8
window_moved db 'K : Window - done',13,10,0
endg
 
bPressedMouseXY_W db 0x0
 
; check window touch
align 4
checkwindows:
1181,10 → 1151,10
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,60 → 1163,35
;..................................... 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]
 
dec esi
movzx edi, word [WIN_POS + esi * 2] ; ebx
cwloop:
 
movzx esi, word [WIN_STACK + edi * 2]
 
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
movzx eax,word [MOUSE_X]
movzx ebx,word [MOUSE_Y]
 
;..................................... 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
 
pushad
mov eax, esi
mov ebx, [TASK_COUNT]
1259,11 → 1204,11
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
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
 
; move window
 
newchm:
newchm:
 
mov [dont_draw_mouse], 1
 
call checkidle
 
call checkVga_N13
 
mov [mouse_background], 0
 
call [draw_pointer]
 
1433,8 → 1375,8
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
mov [reposition],1
 
popad
norepos_size:
norepos_size:
 
pop bx
pop ax
1480,8 → 1422,7
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
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
@@: call check_window_position
call set_window_clientbox
 
no_window_shade:
no_window_shade:
 
push edx
mov edx, [edi + WDATA.cl_workarea]
1626,7 → 1568,7
sub eax,[edi+WDATA.box.height]
mov [edi+WDATA.box.top],eax
call set_window_clientbox
no_window_sizing:
no_window_sizing:
 
popad
 
1633,9 → 1575,6
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,18 → 1600,14
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:
retwm:
 
mov [dont_draw_mouse], 0 ; mouse pointer
mov [mouse_background], 0 ; no mouse under
 
mov esi,window_moved
call sys_msg_board_str
 
/kernel/branches/kolibri_pe/hid/mousedrv.inc
33,227 → 33,51
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
stdcall [set_hw_cursor], esi
popad
.exit:
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
 
 
__sys_disable_mouse:
cmp [MOUSE_VISIBLE], 0
je @f
276,7 → 100,7
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
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
@@:
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
/kernel/branches/kolibri_pe/include/core.h
189,3 → 189,54
#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;
 
 
 
 
 
/kernel/branches/kolibri_pe/include/types.h
14,8 → 14,8
typedef u32_t size_t;
typedef u32_t index_t;
typedef u32_t eflags_t;
typedef u32_t color_t;
 
 
typedef int bool;
 
#define true (bool)1
/kernel/branches/kolibri_pe/kernel.asm
134,6 → 134,7
public _rd_root
public _rd_root_end
 
public _current_task
public _current_slot
public _current_thread
public _k_reenter
196,7 → 197,12
public LFBAddress
public LFBSize
 
public _screen_width
public _screen_height
 
public _vesa20_drawbar
 
 
extrn __edata
 
extrn __os_stack
294,12 → 300,12
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
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,23 → 338,25
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
355,10 → 363,10
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
 
; GRAPHICS ADDRESSES
 
mov byte [BOOT_VAR+0x901e],0x0
mov byte [OS_BASE+0x901e],0x0
 
cmp [scr_mode], 0100000000000000b
jge setvesa20
987,10 → 995,10
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
ret
no_set_pci_access:
 
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
include 'vmodeint.inc'
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
 
sys_setup_err:
mov [esp+36],dword -1
ret
1799,7 → 1803,7
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_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
jnz nogb1
mov eax,[BgrDataWidth]
shl eax,16
mov ax,[BgrDataHeight]
mov ax, word [BgrDataHeight]
mov [esp+36],eax
ret
 
2593,7 → 2597,7
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
2600,7 → 2604,7
movzx ebx, word [edi]
inc ebx
mov eax,edi
sys_newba:
sys_newba:
dec ebx
jz end_of_buttons_away
 
2630,17 → 2634,16
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
;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
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
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
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
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
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
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
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
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
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
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
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
 
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
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
/kernel/branches/kolibri_pe/kernel32.inc
219,13 → 219,6
 
include "network/stack.inc"
 
;include "drivers/uart.inc"
 
 
; Mouse pointer
 
include "gui/mouse.inc"
 
; Window skinning
 
include "gui/skincode.inc"
/kernel/branches/kolibri_pe/makefile
6,11 → 6,12
 
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,6 → 19,7
core/taskman.inc \
core/v86.inc \
core/sys32.inc \
core/syscall.inc \
core/dll.inc \
core/exports.inc \
fs/ntfs.inc \
24,7 → 26,8
gui/window.inc \
gui/event.inc \
video/vesa20.inc \
video/cursors.inc
video/cursors.inc \
hid/mousedrv.inc
 
 
PE_SRC:= \
/kernel/branches/kolibri_pe/video/cursors.inc
470,7 → 470,6
jne .fail
sub ebx, 96
.init:
mov [cur_def_interl], ebx
 
; stdcall load_driver, szHwMouse
; mov [hw_cursor], eax
486,13 → 485,6
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
 
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
 
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
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,10 → 565,12
 
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
589,85 → 577,80
 
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
mov [cur.top], eax
mov edx, eax
sub edx, [y]
mov [_dy], edx
 
mul ebx
lea esi, [LFB_BASE+ecx+ecx*2]
add esi, eax
mov [cur_saved_base],esi
mul [BytesPerScanLine]
lea edx, [LFB_BASE+ecx*3]
add edx, eax
mov [cur_saved_base],edx
 
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
 
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@:
sub edi, [_dx]
 
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
sub edx, [_dy]
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
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,14 → 667,15
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
700,68 → 682,65
 
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
mov [cur.top], eax
mov edx, eax
sub edx, [y]
mov [_dy], edx
 
mul ebx
lea esi, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base],esi
mul [BytesPerScanLine]
lea edx, [LFB_BASE+eax+ecx*4]
mov [cur_saved_base],edx
 
mov edi, [scr_width]
mov edx, [scr_height]
mov eax, 32
 
sub edi, ecx
cmp edi, eax
jng @F
mov edi, eax
cmp ebx, [Screen_Max_X]
jbe @F
mov ebx, [Screen_Max_X]
@@:
sub edi, [_dx]
 
sub edx, [y]
cmp edx, eax
jng @F
mov edx, eax
cmp edi, [Screen_Max_Y]
jbe @F
mov edi, [Screen_Max_Y]
@@:
sub edx, [_dy]
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
add edi, 4
dec ecx
jnz .pix
add esi, edx
add edi, ebx
 
dec [h]
jnz .row
ret
/kernel/branches/kolibri_pe/video/vesa12.inc
438,16 → 438,17
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
 
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
/kernel/branches/kolibri_pe/video/vesa20.inc
574,6 → 574,7
; ecx xe
; edx ye
; edi color
_vesa20_drawbar:
vesa20_drawbar:
pushad
call [disable_mouse]