diff --git a/kernel/branches/net/blkdev/cd_drv.inc b/kernel/branches/net/blkdev/cd_drv.inc index 258ece6155..3f54b43765 100644 --- a/kernel/branches/net/blkdev/cd_drv.inc +++ b/kernel/branches/net/blkdev/cd_drv.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;********************************************************** diff --git a/kernel/branches/net/blkdev/cdrom.inc b/kernel/branches/net/blkdev/cdrom.inc index d364cdd1b2..5a3d3f8d42 100644 --- a/kernel/branches/net/blkdev/cdrom.inc +++ b/kernel/branches/net/blkdev/cdrom.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ sys_cd_audio: diff --git a/kernel/branches/net/blkdev/disk.inc b/kernel/branches/net/blkdev/disk.inc index 011351e872..3ff11425f0 100644 --- a/kernel/branches/net/blkdev/disk.inc +++ b/kernel/branches/net/blkdev/disk.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision: 2381 $ diff --git a/kernel/branches/net/blkdev/disk_cache.inc b/kernel/branches/net/blkdev/disk_cache.inc index 5277fe4502..795c991b0e 100644 --- a/kernel/branches/net/blkdev/disk_cache.inc +++ b/kernel/branches/net/blkdev/disk_cache.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision: 2381 $ diff --git a/kernel/branches/net/blkdev/fdc.inc b/kernel/branches/net/blkdev/fdc.inc index 1cc1be31d4..163e1eeb84 100644 --- a/kernel/branches/net/blkdev/fdc.inc +++ b/kernel/branches/net/blkdev/fdc.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ iglobal diff --git a/kernel/branches/net/blkdev/flp_drv.inc b/kernel/branches/net/blkdev/flp_drv.inc index 45a60d5056..a882250bdb 100644 --- a/kernel/branches/net/blkdev/flp_drv.inc +++ b/kernel/branches/net/blkdev/flp_drv.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;********************************************************** diff --git a/kernel/branches/net/blkdev/hd_drv.inc b/kernel/branches/net/blkdev/hd_drv.inc index fb768c1ce8..aa5f7c679d 100644 --- a/kernel/branches/net/blkdev/hd_drv.inc +++ b/kernel/branches/net/blkdev/hd_drv.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Low-level driver for HDD access @@ -888,14 +888,14 @@ bd_write_cache_chain: .writeerr: popa mov [hd_error], 1 - jmp hd_write_error - -uglobal -int13_regs_in rb sizeof.v86_regs -int13_regs_out rb sizeof.v86_regs -endg - -int13_call: + jmp hd_write_error + +uglobal +int13_regs_in rb sizeof.v86_regs +int13_regs_out rb sizeof.v86_regs +endg + +int13_call: ; Because this code uses fixed addresses, ; it can not be run simultaniously by many threads. ; In current implementation it is protected by common mutex 'hd1_status' @@ -904,13 +904,13 @@ int13_call: mov dword [OS_BASE + 514h], 9A000000h ; buffer 9A00:0000 mov dword [OS_BASE + 518h], eax and dword [OS_BASE + 51Ch], 0 - push ebx ecx esi edi - mov ebx, int13_regs_in - mov edi, ebx - mov ecx, sizeof.v86_regs/4 - xor eax, eax - rep stosd - mov byte [ebx+v86_regs.eax+1], dl + push ebx ecx esi edi + mov ebx, int13_regs_in + mov edi, ebx + mov ecx, sizeof.v86_regs/4 + xor eax, eax + rep stosd + mov byte [ebx+v86_regs.eax+1], dl mov eax, [hdpos] lea eax, [BiosDisksData+(eax-80h)*4] mov dl, [eax] diff --git a/kernel/branches/net/blkdev/ide_cache.inc b/kernel/branches/net/blkdev/ide_cache.inc index de576c4c29..38e2098805 100644 --- a/kernel/branches/net/blkdev/ide_cache.inc +++ b/kernel/branches/net/blkdev/ide_cache.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -21,7 +21,7 @@ ; ;************************************************************************** -$Revision$ +$Revision $ align 4 diff --git a/kernel/branches/net/blkdev/rd.inc b/kernel/branches/net/blkdev/rd.inc index 209f1aa3e2..be88350e37 100644 --- a/kernel/branches/net/blkdev/rd.inc +++ b/kernel/branches/net/blkdev/rd.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; RAMDISK functions ;; @@ -9,7 +9,7 @@ ;; LFN support by diamond ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; calculate fat chain diff --git a/kernel/branches/net/blkdev/rdsave.inc b/kernel/branches/net/blkdev/rdsave.inc index 97cadab4da..a79171cd42 100644 --- a/kernel/branches/net/blkdev/rdsave.inc +++ b/kernel/branches/net/blkdev/rdsave.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ iglobal diff --git a/kernel/branches/net/boot/bootcode.inc b/kernel/branches/net/boot/bootcode.inc index 847208af58..5deb6695cb 100644 --- a/kernel/branches/net/boot/bootcode.inc +++ b/kernel/branches/net/boot/bootcode.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; @@ -11,7 +11,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;========================================================================== @@ -274,7 +274,7 @@ sayerr: push 0 pop es - and word [es:0x9031], 0 + and word [es:BOOT_IDE_BASE_ADDR], 0 ; \begin{Mario79} ; find HDD IDE DMA PCI device ; check for PCI BIOS @@ -311,7 +311,7 @@ sayerr: int 0x1A jc .nopci and cx, 0xFFF0 ; clear address decode type - mov [es:0x9031], cx + mov [es:BOOT_IDE_BASE_ADDR], cx .nopci: ; \end{Mario79} @@ -343,15 +343,15 @@ wait_loop: ; variant 2 loopnz @b ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; --------------- APM --------------------- - and word [es:0x9044], 0 ; ver = 0.0 (APM not found) + and word [es:BOOT_APM_VERSION], 0 ; ver = 0.0 (APM not found) mov ax, 0x5300 xor bx, bx int 0x15 jc apm_end ; APM not found test cx, 2 jz apm_end ; APM 32-bit protected-mode interface not supported - mov [es:0x9044], ax ; Save APM Version - mov [es:0x9046], cx ; Save APM flags + mov [es:BOOT_APM_VERSION], ax ; Save APM Version + mov [es:BOOT_APM_FLAGS], cx ; Save APM flags ; Write APM ver ---- and ax, 0xf0f @@ -370,10 +370,10 @@ wait_loop: ; variant 2 xor bx, bx int 0x15 - mov [es:0x9040], ebx - mov [es:0x9050], ax - mov [es:0x9052], cx - mov [es:0x9054], dx + mov [es:BOOT_APM_ENTRY], ebx + mov [es:BOOT_APM_CODE_32], ax + mov [es:BOOT_APM_CODE_16], cx + mov [es:BOOT_APM_DATA_16], dx apm_end: _setcursor d80x25_top_num, 0 @@ -1151,7 +1151,7 @@ no_sys_on_floppy: xor ax, ax mov es, ax - mov ax, [es:0x9008] ; vga & 320x200 + mov ax, [es:BOOT_VESA_MODE] ; vga & 320x200 mov bx, ax cmp ax, 0x13 je setgr diff --git a/kernel/branches/net/boot/booteng.inc b/kernel/branches/net/boot/booteng.inc index 4c14a2d2e3..4a4ab96afc 100644 --- a/kernel/branches/net/boot/booteng.inc +++ b/kernel/branches/net/boot/booteng.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -11,7 +11,7 @@ ; ;====================================================================== -$Revision$ +$Revision $ d80x25_bottom: diff --git a/kernel/branches/net/boot/bootet.inc b/kernel/branches/net/boot/bootet.inc index 414efdf381..0371b144db 100644 --- a/kernel/branches/net/boot/bootet.inc +++ b/kernel/branches/net/boot/bootet.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;====================================================================== ; diff --git a/kernel/branches/net/boot/bootge.inc b/kernel/branches/net/boot/bootge.inc index 2ea4959f19..3ed18b0e31 100644 --- a/kernel/branches/net/boot/bootge.inc +++ b/kernel/branches/net/boot/bootge.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;====================================================================== ; diff --git a/kernel/branches/net/boot/bootru.inc b/kernel/branches/net/boot/bootru.inc index 4e85269a6a..79c6964ec4 100644 --- a/kernel/branches/net/boot/bootru.inc +++ b/kernel/branches/net/boot/bootru.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;================================================================= ; diff --git a/kernel/branches/net/boot/bootstr.inc b/kernel/branches/net/boot/bootstr.inc index bf71fb7a9e..c32af80700 100644 --- a/kernel/branches/net/boot/bootstr.inc +++ b/kernel/branches/net/boot/bootstr.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; boot data: common strings (for all languages) @@ -30,7 +30,7 @@ macro line_space { db 186 } d80x25_top: - line_full_top + line_full_top cur_line_pos = 75 store byte ' ' at d80x25_top+cur_line_pos+1 rev_var = __REV__ @@ -42,21 +42,21 @@ end while store byte ' ' at d80x25_top+cur_line_pos store dword ' SVN' at d80x25_top+cur_line_pos-4 -space_msg: line_space +space_msg: line_space verstr: -; line_space +; line_space ; version string - db 186,32 - repeat 78 - load a byte from version+%-1 - if a = 13 - break - end if - db a - end repeat - repeat 78 - ($-verstr) - db ' ' - end repeat - db 32,186 - line_half + db 186,32 + repeat 78 + load a byte from version+%-1 + if a = 13 + break + end if + db a + end repeat + repeat 78 - ($-verstr) + db ' ' + end repeat + db 32,186 + line_half d80x25_top_num = 4 diff --git a/kernel/branches/net/boot/bootvesa.inc b/kernel/branches/net/boot/bootvesa.inc index aaef71888b..a7f762f2e8 100644 --- a/kernel/branches/net/boot/bootvesa.inc +++ b/kernel/branches/net/boot/bootvesa.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ struc VBE_VGAInfo { .VESASignature dd ? ; char @@ -215,7 +215,7 @@ calc_vmodes_table: test [es:mi.ModeAttributes],10000000b ;LFB ? jz @f - cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp + cmp [es:mi.BitsPerPixel], 24 ;It show only videomodes to have support 24 and 32 bpp jb @f ; cmp [es:mi.BitsPerPixel],16 @@ -240,11 +240,12 @@ calc_vmodes_table: mov ax,[es:mi.ModeAttributes] mov [es:bx+4],ax ; +4[2] : attributes - cmp [s_vesa.ver],'2' - jb .lp1 + cmp [s_vesa.ver], '2' +; jb .lp1 + jb @f ; We do not use Vesa 1.2 mode is now - or cx,0x4000 ; use LFB -.lp1: mov [es:bx+6],cx ; +6 : mode number + or cx, 0x4000 ; use LFB +.lp1: mov [es:bx+6],cx ; +6 : mode number movzx ax,byte [es:mi.BitsPerPixel] mov word [es:bx+8],ax ; +8 : bits per pixel add bx,size_of_step ; size of record @@ -379,7 +380,7 @@ check_first_parm: .no_zero: - mov bp,word [number_vm] + mov bp,word [number_vm] cmp bp,word [es:si+6] jz .ok_found_mode mov ax,word [x_save] @@ -389,7 +390,7 @@ check_first_parm: test ax,ax jz .ok_found_mode - mov si,modes_table + mov si,modes_table ; cmp ax,modes_table ; jb .zerro ;check on correct if bellow ; cmp ax,word [end_cursor] @@ -415,7 +416,7 @@ check_first_parm: @@: mov word [home_cursor],ax - mov si,[preboot_graph] + mov si,[preboot_graph] mov word [cursor_pos],si push word [es:si] @@ -441,9 +442,9 @@ check_first_parm: je .exit jmp .loops .ok: xor ax,ax - ret -.exit: or ax,-1 - ret + ret +.exit: or ax,-1 + ret ;----------------------------------------------------------------------------- @@ -542,7 +543,7 @@ draw_vmodes_table: mov bp,long_v_table ;show rows .@@_next_bit: ;clear cursor - mov ax,' ' + mov ax,' ' mov word[ds:_r1+21],ax mov word[ds:_r1+50],ax @@ -662,7 +663,7 @@ clear_vmodes_table: mov cx,70 add di,20 dec bp - jns .loop_start + jns .loop_start pop es popa ret @@ -678,21 +679,21 @@ set_vmode: mov ax,word [es:si+0] ; resolution X - mov bx,word [es:si+2] ; resolution Y + mov bx, word [es:si+2] ; resolution Y - mov word [es:0x900A],ax ; resolution X - mov word [es:0x900C],bx ; resolution Y - mov word [es:0x9008],cx ; number of mode + mov word [es:BOOT_X_RES], ax ; resolution X + mov word [es:BOOT_Y_RES], bx ; resolution Y + mov word [es:BOOT_VESA_MODE], cx ; number of mode - cmp cx,0x12 + cmp cx, 0x12 je .mode0x12_0x13 cmp cx,0x13 je .mode0x12_0x13 - cmp byte [s_vesa.ver],'2' - jb .vesa12 +; cmp byte [s_vesa.ver], '2' +; jb .vesa12 ; VESA 2 and Vesa 3 @@ -701,54 +702,48 @@ set_vmode: mov di,mi;0xa000 int 0x10 ; LFB - mov eax,[es:mi.PhysBasePtr];di+0x28] - mov [es:0x9018],eax + mov eax, [es:mi.PhysBasePtr];di+0x28] + mov [es:BOOT_LFB], eax ; ---- vbe voodoo BytesPerLine equ 0x10 mov ax, [es:di+BytesPerLine] - mov [es:0x9001], ax + mov [es:BOOT_PITCH], ax ; BPP - cmp [es:mi.BitsPerPixel],16 + cmp [es:mi.BitsPerPixel], 16 jne .l0 cmp [es:mi.GreenMaskSize],5 jne .l0 - mov [es:mi.BitsPerPixel],15 + mov [es:mi.BitsPerPixel], 15 .l0: mov al, byte [es:di+0x19] - mov [es:0x9000], al + mov [es:BOOT_BPP], al jmp .exit .mode0x12_0x13: - mov byte [es:0x9000], 32 - or dword [es:0x9018], 0xFFFFFFFF; 0x800000 + mov byte [es:BOOT_BPP], 32 + or dword [es:BOOT_LFB], 0xFFFFFFFF; 0x800000 ; VESA 1.2 PM BANK SWITCH ADDRESS -.vesa12: - - - mov ax,0x4f0A - xor bx,bx - int 0x10 - xor eax,eax - xor ebx,ebx - mov ax,es - shl eax,4 - mov bx,di - add eax,ebx - movzx ebx,word[es:di] - add eax,ebx - push 0x0000 - pop es - mov [es:0x9014],eax +;.vesa12: +; mov ax, 0x4f0A +; xor bx, bx +; int 0x10 +; xor eax, eax +; xor ebx, ebx +; mov ax, es +; shl eax, 4 +; mov bx, di +; add eax, ebx +; movzx ebx, word[es:di] +; add eax, ebx +; push 0x0000 +; pop es +; mov [es:0x9014], eax .exit: ret - -; mov dword[es:0x9018],0x000A0000 -; ret - ;============================================================================= ;============================================================================= ;============================================================================= diff --git a/kernel/branches/net/boot/et.inc b/kernel/branches/net/boot/et.inc index 83fc44f2b6..95398010ae 100644 --- a/kernel/branches/net/boot/et.inc +++ b/kernel/branches/net/boot/et.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision$ diff --git a/kernel/branches/net/boot/preboot.inc b/kernel/branches/net/boot/preboot.inc index 036ba51c18..dd048debba 100644 --- a/kernel/branches/net/boot/preboot.inc +++ b/kernel/branches/net/boot/preboot.inc @@ -1,38 +1,38 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ -display_modechg db 0 ; display mode change for text, yes/no (0 or 2) - ; - ; !! Important note !! - ; - ; Must be set to 2, to avoid two screenmode - ; changes within a very short period of time. +display_modechg db 0 ; display mode change for text, yes/no (0 or 2) + ; + ; !! Important note !! + ; + ; Must be set to 2, to avoid two screenmode + ; changes within a very short period of time. -display_atboot db 0 ; show boot screen messages ( 2-no ) +display_atboot db 0 ; show boot screen messages ( 2-no ) -preboot_graph dw 0 ; graph mode -x_save dw 0 ; x -y_save dw 0 ; y -number_vm dw 0 ; +preboot_graph dw 0 ; graph mode +x_save dw 0 ; x +y_save dw 0 ; y +number_vm dw 0 ; ;pixel_save dw 0 ; per to pixel -preboot_gprobe db 0 ; probe vesa3 videomodes (1-no, 2-yes) -preboot_vrrm db 0 ; use VRR_M (1-yes, 2- no) -preboot_dma db 0 ; use DMA for access to HDD (1-always, 2-only for read, 3-never) -preboot_device db 0 ; boot device - ; (1-floppy 2-harddisk 3-kernel restart 4-format ram disk) - ;!!!! 0 - autodetect !!!! +preboot_gprobe db 0 ; probe vesa3 videomodes (1-no, 2-yes) +preboot_vrrm db 0 ; use VRR_M (1-yes, 2- no) +preboot_dma db 0 ; use DMA for access to HDD (1-always, 2-only for read, 3-never) +preboot_device db 0 ; boot device + ; (1-floppy 2-harddisk 3-kernel restart 4-format ram disk) + ;!!!! 0 - autodetect !!!! preboot_blogesc = 0 ; start immediately after bootlog -preboot_biosdisk db 0 ; use V86 to access disks through BIOS (1-yes, 2-no) +preboot_biosdisk db 0 ; use V86 to access disks through BIOS (1-yes, 2-no) if $>0x200 ERROR: prebooting parameters must fit in first sector!!! end if -hdsysimage db 'KOLIBRI IMG' ; load from -image_save db 'KOLIBRI IMG' ; save to +hdsysimage db 'KOLIBRI IMG' ; load from +image_save db 'KOLIBRI IMG' ; save to diff --git a/kernel/branches/net/boot/rdload.inc b/kernel/branches/net/boot/rdload.inc index b9c9c96561..b86a13d734 100644 --- a/kernel/branches/net/boot/rdload.inc +++ b/kernel/branches/net/boot/rdload.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; READ RAMDISK IMAGE FROM HD @@ -108,17 +108,17 @@ no_sys_on_hd: mov edi, RAMDISK mov ecx, 0x1080 xor eax,eax -@@: - stosd +@@: + stosd loop @b mov ecx, 0x58F7F mov eax,0xF6F6F6F6 -@@: - stosd +@@: + stosd loop @b - mov [RAMDISK+0x200],dword 0xFFFFF0 ; fat table + mov [RAMDISK+0x200],dword 0xFFFFF0 ; fat table mov [RAMDISK+0x4200],dword 0xFFFFF0 not_format_ram_disk: diff --git a/kernel/branches/net/boot/ru.inc b/kernel/branches/net/boot/ru.inc index aa59d6f6a9..3da137fb47 100644 --- a/kernel/branches/net/boot/ru.inc +++ b/kernel/branches/net/boot/ru.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision$ diff --git a/kernel/branches/net/boot/shutdown.inc b/kernel/branches/net/boot/shutdown.inc index 3e3679cafd..aa0a8f693e 100644 --- a/kernel/branches/net/boot/shutdown.inc +++ b/kernel/branches/net/boot/shutdown.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Shutdown for Menuet ;; @@ -11,7 +11,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ align 4 diff --git a/kernel/branches/net/bus/pci/PCIe.inc b/kernel/branches/net/bus/pci/PCIe.inc index 7d0013bf39..c7b6d62d4e 100644 --- a/kernel/branches/net/bus/pci/PCIe.inc +++ b/kernel/branches/net/bus/pci/PCIe.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) 2010 KolibriOS team. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2010-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; ;; ;; PCIe.INC ;; ;; ;; ;; Extended PCI express services ;; diff --git a/kernel/branches/net/bus/pci/pci16.inc b/kernel/branches/net/bus/pci/pci16.inc index 9b6ed7a5af..b7f007eef1 100644 --- a/kernel/branches/net/bus/pci/pci16.inc +++ b/kernel/branches/net/bus/pci/pci16.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; PCI16.INC ;; @@ -15,7 +15,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ init_pci_16: diff --git a/kernel/branches/net/bus/pci/pci32.inc b/kernel/branches/net/bus/pci/pci32.inc index 235943d4aa..e9a187bb75 100644 --- a/kernel/branches/net/bus/pci/pci32.inc +++ b/kernel/branches/net/bus/pci/pci32.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ;; @@ -21,7 +21,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;*************************************************************************** ; Function diff --git a/kernel/branches/net/const.inc b/kernel/branches/net/const.inc index 5a53a07185..8da15d3db5 100644 --- a/kernel/branches/net/const.inc +++ b/kernel/branches/net/const.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ dpl0 equ 10010000b ; data read dpl0 @@ -176,12 +176,12 @@ struct TSS _io rw 1 rb 24 _io_map_0 rb 4096 - _io_map_1 rb 4096 -ends - -OS_BASE equ 0x80000000 - -window_data equ (OS_BASE+0x0001000) + _io_map_1 rb 4096 +ends + +OS_BASE equ 0x80000000 + +window_data equ (OS_BASE+0x0001000) CURRENT_TASK equ (OS_BASE+0x0003000) TASK_COUNT equ (OS_BASE+0x0003004) @@ -210,7 +210,7 @@ BANK_SWITCH equ (OS_BASE+0x000E030) ;unused ? store mousepointer MOUSE_PICTURE equ (OS_BASE+0x000F200) -MOUSE_VISIBLE equ (OS_BASE+0x000F204) +;MOUSE_VISIBLE equ (OS_BASE+0x000F204) WIN_TEMP_XY equ (OS_BASE+0x000F300) KEY_COUNT equ (OS_BASE+0x000F400) KEY_BUFF equ (OS_BASE+0x000F401) @@ -255,7 +255,7 @@ SYS_SHUTDOWN equ (OS_BASE+0x000FF00) TASK_ACTIVATE equ (OS_BASE+0x000FF01) REDRAW_BACKGROUND equ (OS_BASE+0x000FFF0) -BACKGROUND_CHANGED equ (OS_BASE+0x000FFF1) + BANK_RW equ (OS_BASE+0x000FFF2) MOUSE_BACKGROUND equ (OS_BASE+0x000FFF4) DONT_DRAW_MOUSE equ (OS_BASE+0x000FFF5) @@ -289,7 +289,11 @@ BgrAuxTable equ (OS_BASE+0x0298000) SB16Buffer equ (OS_BASE+0x02A0000) SB16_Status equ (OS_BASE+0x02B0000) -BUTTON_INFO equ (OS_BASE+0x02C0000) +BUTTON_INFO equ (OS_BASE+0x02B3FEE) + +BPSLine_calc_area equ (OS_BASE+0x02C4000) +d_width_calc_area equ (OS_BASE+0x02CA000) + RESERVED_PORTS equ (OS_BASE+0x02D0000) BOOT_VAR equ (OS_BASE+0x02E0000) @@ -362,22 +366,30 @@ PG_SHARED equ 0x200 ;;;;;;;;;;;boot time variables -;BOOT_BPP equ 0x9000 ;byte bits per pixel -BOOT_SCANLINE equ 0x9001 ;word scanline length +BOOT_BPP equ 0x9000 ;byte bits per pixel +BOOT_PITCH equ 0x9001 ;word scanline length BOOT_VESA_MODE equ 0x9008 ;word vesa video mode -;;BOOT_X_RES equ 0x900A ;word X res -;;BOOT_Y_RES equ 0x900C ;word Y res +BOOT_X_RES equ 0x900A ;word X res +BOOT_Y_RES equ 0x900C ;word Y res ;;BOOT_MOUSE_PORT equ 0x9010 ;byte mouse port - not used BOOT_BANK_SW equ 0x9014 ;dword Vesa 1.2 pm bank switch BOOT_LFB equ 0x9018 ;dword Vesa 2.0 LFB address BOOT_MTRR equ 0x901C ;byte 0 or 1 : enable MTRR graphics acceleration BOOT_LOG equ 0x901D ;byte not used anymore (0 or 1 : enable system log display) -BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled +;BOOT_DIRECT_LFB equ 0x901E ;byte 0 or 1 : enable direct lfb write, paging disabled +BOOT_DMA equ 0x901F ; BOOT_PCI_DATA equ 0x9020 ;8bytes pci data BOOT_VRR equ 0x9030 ;byte VRR start enabled 1, 2-no BOOT_IDE_BASE_ADDR equ 0x9031 ;word IDEContrRegsBaseAddr BOOT_MEM_AMOUNT equ 0x9034 ;dword memory amount +BOOT_APM_ENTRY equ 0x9040 +BOOT_APM_VERSION equ 0x9044 +BOOT_APM_FLAGS equ 0x9046 ;unused +BOOT_APM_CODE_32 equ 0x9050 +BOOT_APM_CODE_16 equ 0x9052 +BOOT_APM_DATA_16 equ 0x9054 + TMP_FILE_NAME equ 0 TMP_CMD_LINE equ 1024 TMP_ICON_OFFS equ 1280 @@ -392,259 +404,262 @@ EVENT_IPC equ 0x00000040 EVENT_NETWORK equ 0x00000080 EVENT_DEBUG equ 0x00000100 EVENT_EXTENDED equ 0x00000200 - -EV_INTR equ 1 - -struct THR_DATA - rb (8192-512) -; pl0_stack - fpu_state rb 512 - tls_page rb 4096 - pdbr rb 4096 -ends - -virtual at (OS_BASE-sizeof.THR_DATA) - thr_data THR_DATA -end virtual - -struct SYS_VARS - bpp dd ? - scanline dd ? - vesa_mode dd ? - x_res dd ? - y_res dd ? -ends - -struct APPOBJ ; common object header - magic dd ? ; - destroy dd ? ; internal destructor - fd dd ? ; next object in list - bk dd ? ; prev object in list - pid dd ? ; owner id -ends - -APP_OBJ_OFFSET equ 48 -APP_EV_OFFSET equ 40 - -struct CURSOR APPOBJ - base dd ? ;allocated memory - hot_x dd ? ;hotspot coords - hot_y dd ? - - list_next dd ? ;next cursor in cursor list - list_prev dd ? ;prev cursor in cursor list - dev_obj dd ? ;device depended data -ends - - -struct EVENT APPOBJ - id dd ? ;event uid - state dd ? ;internal flags - code dd ? - rd 5 -ends - - -struct SMEM - bk dd ? - fd dd ? ;+4 - base dd ? ;+8 - size dd ? ;+12 - access dd ? ;+16 - refcount dd ? ;+20 - name rb 32 ;+24 -ends - -struct SMAP APPOBJ - base dd ? ;mapped base - parent dd ? ;SMEM -ends - -struct DLLDESCR - bk dd ? - fd dd ? ;+4 - data dd ? ;+8 - size dd ? ;+12 - timestamp dq ? - refcount dd ? - defaultbase dd ? - coff_hdr dd ? - symbols_ptr dd ? - symbols_num dd ? - symbols_lim dd ? - exports dd ? ;export table - name rb 260 -ends - -struct HDLL - fd dd ? ;next object in list - bk dd ? ;prev object in list - pid dd ? ;owner id - - base dd ? ;mapped base - size dd ? ;mapped size - refcount dd ? ;reference counter for this process and this lib - parent dd ? ;DLLDESCR -ends - -struct display_t - x dd ? - y dd ? - width dd ? - height dd ? - bpp dd ? - vrefresh dd ? - pitch dd ? - lfb dd ? - - modes dd ? - ddev dd ? - connector dd ? - crtc dd ? - - cr_list.next dd ? - cr_list.prev dd ? - - cursor dd ? - - init_cursor dd ? - select_cursor dd ? - show_cursor dd ? - move_cursor dd ? - restore_cursor dd ? - disable_mouse dd ? -ends - -struct BOOT_DATA - bpp dd ? - scanline dd ? - vesa_mode dd ? - x_res dd ? - y_res dd ? - mouse_port dd ? - bank_switch dd ? - lfb dd ? - vesa_mem dd ? - log dd ? - direct_lfb dd ? - pci_data dd ? - dd ? - vrr dd ? - ide_base dd ? - mem_amount dd ? - pages_count dd ? - pagemap_size dd ? - kernel_max dd ? - kernel_pages dd ? - kernel_tables dd ? - - cpu_vendor dd ? - dd ? - dd ? - cpu_sign dd ? - cpu_info dd ? - cpu_caps dd ? - dd ? - dd ? -ends - -struct LHEAD - next dd ? ;next object in list - prev dd ? ;prev object in list -ends - -struct MUTEX - lhead LHEAD - count dd ? -ends - -struct MEM_STATE - mutex MUTEX - smallmap dd ? - treemap dd ? - topsize dd ? - top dd ? - smallbins rd 4*32 - treebins rd 32 -ends - -struct PG_DATA - mem_amount dd ? - vesa_mem dd ? - pages_count dd ? - pages_free dd ? - pages_faults dd ? - pagemap_size dd ? - kernel_pages dd ? - kernel_tables dd ? - sys_page_dir dd ? - mutex MUTEX -ends - -struct SRV - srv_name rb 16 ;ASCIIZ string - magic dd ? ;+0x10 ;'SRV ' - size dd ? ;+0x14 ;size of structure SRV - fd dd ? ;+0x18 ;next SRV descriptor - bk dd ? ;+0x1C ;prev SRV descriptor - base dd ? ;+0x20 ;service base address - entry dd ? ;+0x24 ;service START function - srv_proc dd ? ;+0x28 ;user mode service handler - srv_proc_ex dd ? ;+0x2C ;kernel mode service handler -ends - -DRV_ENTRY equ 1 -DRV_EXIT equ -1 - -struct COFF_HEADER - machine dw ? - nSections dw ? - DataTime dd ? - pSymTable dd ? - nSymbols dd ? - optHeader dw ? - flags dw ? -ends - -struct COFF_SECTION - Name rb 8 - VirtualSize dd ? - VirtualAddress dd ? - SizeOfRawData dd ? - PtrRawData dd ? - PtrReloc dd ? - PtrLinenumbers dd ? - NumReloc dw ? - NumLinenum dw ? - Characteristics dd ? -ends - -struct COFF_RELOC - VirtualAddress dd ? - SymIndex dd ? - Type dw ? -ends - -struct COFF_SYM - Name rb 8 - Value dd ? - SectionNumber dw ? - Type dw ? - StorageClass db ? - NumAuxSymbols db ? -ends - -struct IOCTL - handle dd ? - io_code dd ? - input dd ? - inp_size dd ? - output dd ? - out_size dd ? -ends - -struct IRQH - list LHEAD - handler dd ? ;handler roututine - data dd ? ;user-specific data -ends \ No newline at end of file + +EV_INTR equ 1 + +struct THR_DATA + rb (8192-512) +; pl0_stack + fpu_state rb 512 + tls_page rb 4096 + pdbr rb 4096 +ends + +virtual at (OS_BASE-sizeof.THR_DATA) + thr_data THR_DATA +end virtual + +struct SYS_VARS + bpp dd ? + scanline dd ? + vesa_mode dd ? + x_res dd ? + y_res dd ? +ends + +struct APPOBJ ; common object header + magic dd ? ; + destroy dd ? ; internal destructor + fd dd ? ; next object in list + bk dd ? ; prev object in list + pid dd ? ; owner id +ends + +APP_OBJ_OFFSET equ 48 +APP_EV_OFFSET equ 40 + +struct CURSOR APPOBJ + base dd ? ;allocated memory + hot_x dd ? ;hotspot coords + hot_y dd ? + + list_next dd ? ;next cursor in cursor list + list_prev dd ? ;prev cursor in cursor list + dev_obj dd ? ;device depended data +ends + + +struct EVENT APPOBJ + id dd ? ;event uid + state dd ? ;internal flags + code dd ? + rd 5 +ends + + +struct SMEM + bk dd ? + fd dd ? ;+4 + base dd ? ;+8 + size dd ? ;+12 + access dd ? ;+16 + refcount dd ? ;+20 + name rb 32 ;+24 +ends + +struct SMAP APPOBJ + base dd ? ;mapped base + parent dd ? ;SMEM +ends + +struct DLLDESCR + bk dd ? + fd dd ? ;+4 + data dd ? ;+8 + size dd ? ;+12 + timestamp dq ? + refcount dd ? + defaultbase dd ? + coff_hdr dd ? + symbols_ptr dd ? + symbols_num dd ? + symbols_lim dd ? + exports dd ? ;export table + name rb 260 +ends + +struct HDLL + fd dd ? ;next object in list + bk dd ? ;prev object in list + pid dd ? ;owner id + + base dd ? ;mapped base + size dd ? ;mapped size + refcount dd ? ;reference counter for this process and this lib + parent dd ? ;DLLDESCR +ends + +struct display_t + x dd ? + y dd ? + width dd ? + height dd ? + bpp dd ? + vrefresh dd ? + pitch dd ? + lfb dd ? + + modes dd ? + ddev dd ? + connector dd ? + crtc dd ? + + cr_list.next dd ? + cr_list.prev dd ? + + cursor dd ? + + init_cursor dd ? + select_cursor dd ? + show_cursor dd ? + move_cursor dd ? + restore_cursor dd ? + disable_mouse dd ? + mask_seqno dd ? + check_mouse dd ? + check_m_pixel dd ? +ends + +struct BOOT_DATA + bpp dd ? + scanline dd ? + vesa_mode dd ? + x_res dd ? + y_res dd ? + mouse_port dd ? + bank_switch dd ? + lfb dd ? + vesa_mem dd ? + log dd ? + direct_lfb dd ? + pci_data dd ? + dd ? + vrr dd ? + ide_base dd ? + mem_amount dd ? + pages_count dd ? + pagemap_size dd ? + kernel_max dd ? + kernel_pages dd ? + kernel_tables dd ? + + cpu_vendor dd ? + dd ? + dd ? + cpu_sign dd ? + cpu_info dd ? + cpu_caps dd ? + dd ? + dd ? +ends + +struct LHEAD + next dd ? ;next object in list + prev dd ? ;prev object in list +ends + +struct MUTEX + lhead LHEAD + count dd ? +ends + +struct MEM_STATE + mutex MUTEX + smallmap dd ? + treemap dd ? + topsize dd ? + top dd ? + smallbins rd 4*32 + treebins rd 32 +ends + +struct PG_DATA + mem_amount dd ? + vesa_mem dd ? + pages_count dd ? + pages_free dd ? + pages_faults dd ? + pagemap_size dd ? + kernel_pages dd ? + kernel_tables dd ? + sys_page_dir dd ? + mutex MUTEX +ends + +struct SRV + srv_name rb 16 ;ASCIIZ string + magic dd ? ;+0x10 ;'SRV ' + size dd ? ;+0x14 ;size of structure SRV + fd dd ? ;+0x18 ;next SRV descriptor + bk dd ? ;+0x1C ;prev SRV descriptor + base dd ? ;+0x20 ;service base address + entry dd ? ;+0x24 ;service START function + srv_proc dd ? ;+0x28 ;user mode service handler + srv_proc_ex dd ? ;+0x2C ;kernel mode service handler +ends + +DRV_ENTRY equ 1 +DRV_EXIT equ -1 + +struct COFF_HEADER + machine dw ? + nSections dw ? + DataTime dd ? + pSymTable dd ? + nSymbols dd ? + optHeader dw ? + flags dw ? +ends + +struct COFF_SECTION + Name rb 8 + VirtualSize dd ? + VirtualAddress dd ? + SizeOfRawData dd ? + PtrRawData dd ? + PtrReloc dd ? + PtrLinenumbers dd ? + NumReloc dw ? + NumLinenum dw ? + Characteristics dd ? +ends + +struct COFF_RELOC + VirtualAddress dd ? + SymIndex dd ? + Type dw ? +ends + +struct COFF_SYM + Name rb 8 + Value dd ? + SectionNumber dw ? + Type dw ? + StorageClass db ? + NumAuxSymbols db ? +ends + +struct IOCTL + handle dd ? + io_code dd ? + input dd ? + inp_size dd ? + output dd ? + out_size dd ? +ends + +struct IRQH + list LHEAD + handler dd ? ;handler roututine + data dd ? ;user-specific data +ends diff --git a/kernel/branches/net/core/apic.inc b/kernel/branches/net/core/apic.inc index 52d5620a5f..08ac43a837 100644 --- a/kernel/branches/net/core/apic.inc +++ b/kernel/branches/net/core/apic.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; iglobal @@ -58,13 +58,13 @@ APIC_init: mov [acpi_dev_data], eax mov [acpi_dev_size], ebx - call IRQ_mask_all - -; IOAPIC init - stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW - mov [IOAPIC_base], eax - - mov eax, IOAPIC_VER + call IRQ_mask_all + +; IOAPIC init + stdcall map_io_mem, [acpi_ioapic_base], 0x20, PG_SW+PG_NOCACHE + mov [IOAPIC_base], eax + + mov eax, IOAPIC_VER call IOAPIC_read shr eax, 16 inc al @@ -118,20 +118,17 @@ APIC_init: ret -;=========================================================== -align 4 -LAPIC_init: - ; Check MSR support - ;.... - ; Get LAPIC base address -; mov ecx, 0x1b -; rdmsr ; it may be replaced to -; and ax, 0xf000 ; mov eax, 0xfee00000 - - stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW - mov [LAPIC_BASE], eax - mov esi, eax - +;=========================================================== +align 4 +LAPIC_init: + + cmp [LAPIC_BASE], 0 + jne .done + + stdcall map_io_mem, [acpi_lapic_base], 0x1000, PG_SW+PG_NOCACHE + mov [LAPIC_BASE], eax + mov esi, eax + ; Program Destination Format Register for Flat mode. mov eax, [esi + APIC_DFR] or eax, 0xf0000000 @@ -197,12 +194,14 @@ LAPIC_init: xor eax, 0xffffffff ; eax = 0xffffffff - eax shr eax, 6 ; eax /= 64; APIC ticks per 0.01 sec - ; Start (every 0.01 sec) - mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20 - mov dword[esi + APIC_timer_init], eax - ret - -;=========================================================== + ; Start (every 0.01 sec) + mov dword[esi + APIC_LVT_timer], 0x30020; periodic int 0x20 + mov dword[esi + APIC_timer_init], eax + +.done: + ret + +;=========================================================== ; IOAPIC implementation align 4 IOAPIC_read: diff --git a/kernel/branches/net/core/conf_lib.inc b/kernel/branches/net/core/conf_lib.inc index c8a224ef19..4d9acb0972 100644 --- a/kernel/branches/net/core/conf_lib.inc +++ b/kernel/branches/net/core/conf_lib.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -10,7 +10,7 @@ ; {SPraid.simba} ;------------------------------------------------------------------------- -$Revision$ +$Revision $ iglobal conf_path_sect: diff --git a/kernel/branches/net/core/debug.inc b/kernel/branches/net/core/debug.inc index d9e26083d2..e93a64e532 100644 --- a/kernel/branches/net/core/debug.inc +++ b/kernel/branches/net/core/debug.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; diamond, 2006 diff --git a/kernel/branches/net/core/dll.inc b/kernel/branches/net/core/dll.inc index c7215f12cb..29e36beb8a 100644 --- a/kernel/branches/net/core/dll.inc +++ b/kernel/branches/net/core/dll.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ DRV_COMPAT equ 5 ;minimal required drivers version @@ -136,13 +136,13 @@ proc srv_handler stdcall, ioctl:dword jz .err mov edi, [esi+handle] - cmp [edi+SRV.magic], ' SRV' - jne .fail - - cmp [edi+SRV.size], sizeof.SRV - jne .fail - - stdcall [edi+SRV.srv_proc], esi + cmp [edi+SRV.magic], ' SRV' + jne .fail + + cmp [edi+SRV.size], sizeof.SRV + jne .fail + + stdcall [edi+SRV.srv_proc], esi ret .fail: xor eax, eax @@ -168,13 +168,13 @@ srv_handlerEx: jae .fail mov eax, [ecx+handle] - cmp [eax+SRV.magic], ' SRV' - jne .fail - - cmp [eax+SRV.size], sizeof.SRV - jne .fail - - stdcall [eax+SRV.srv_proc], ecx + cmp [eax+SRV.magic], ' SRV' + jne .fail + + cmp [eax+SRV.size], sizeof.SRV + jne .fail + + stdcall [eax+SRV.srv_proc], ecx ret .fail: or eax, -1 @@ -193,13 +193,13 @@ proc get_service stdcall, sz_name:dword test eax, eax jnz @F ret -@@: - mov edx, [srv.fd] -@@: - cmp edx, srv.fd-SRV.fd - je .not_load - - stdcall strncmp, edx, [sz_name], 16 +@@: + mov edx, [srv.fd] +@@: + cmp edx, srv.fd-SRV.fd + je .not_load + + stdcall strncmp, edx, [sz_name], 16 test eax, eax je .ok @@ -223,13 +223,13 @@ proc reg_service stdcall, name:dword, handler:dword cmp [name], eax je .fail - cmp [handler], eax - je .fail - - mov eax, sizeof.SRV - call malloc - test eax, eax - jz .fail + cmp [handler], eax + je .fail + + mov eax, sizeof.SRV + call malloc + test eax, eax + jz .fail push esi push edi @@ -240,15 +240,15 @@ proc reg_service stdcall, name:dword, handler:dword movsd movsd pop edi - pop esi - - mov [eax+SRV.magic], ' SRV' - mov [eax+SRV.size], sizeof.SRV - - mov ebx, srv.fd-SRV.fd - mov edx, [ebx+SRV.fd] - mov [eax+SRV.fd], edx - mov [eax+SRV.bk], ebx + pop esi + + mov [eax+SRV.magic], ' SRV' + mov [eax+SRV.size], sizeof.SRV + + mov ebx, srv.fd-SRV.fd + mov edx, [ebx+SRV.fd] + mov [eax+SRV.fd], edx + mov [eax+SRV.bk], ebx mov [ebx+SRV.fd], eax mov [edx+SRV.bk], eax @@ -437,10 +437,19 @@ proc load_file stdcall, file_name:dword jz .cleanup mov [file2], eax - pushfd - cli + + pushad + mov ecx, unpack_mutex + call mutex_lock + popad + stdcall unpack, [file], eax - popfd + + pushad + mov ecx, unpack_mutex + call mutex_unlock + popad + stdcall kernel_free, [file] mov eax, [file2] mov ebx, [file_size] @@ -470,6 +479,11 @@ proc load_file stdcall, file_name:dword ret endp +uglobal +align 4 +unpack_mutex MUTEX +endg + align 4 proc get_proc_ex stdcall, proc_name:dword, imports:dword @@ -511,16 +525,16 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ retval dd ? endl - mov edi, [symbols] - mov [retval], 1 -.fix: - movzx ebx, [edi+COFF_SYM.SectionNumber] - test ebx, ebx - jnz .internal - mov eax, dword [edi+COFF_SYM.Name] - test eax, eax - jnz @F - + mov edi, [symbols] + mov [retval], 1 +.fix: + movzx ebx, [edi+COFF_SYM.SectionNumber] + test ebx, ebx + jnz .internal + mov eax, dword [edi+COFF_SYM.Name] + test eax, eax + jnz @F + mov edi, [edi+4] add edi, [strings] @@: @@ -539,29 +553,29 @@ proc fix_coff_symbols stdcall uses ebx esi, sec:dword, symbols:dword,\ mov esi, msg_CR call sys_msg_board_str - mov [retval], 0 -@@: - mov edi, [symbols] - mov [edi+COFF_SYM.Value], eax - jmp .next -.internal: - cmp bx, -1 + mov [retval], 0 +@@: + mov edi, [symbols] + mov [edi+COFF_SYM.Value], eax + jmp .next +.internal: + cmp bx, -1 je .next cmp bx, -2 je .next dec ebx shl ebx, 3 - lea ebx, [ebx+ebx*4] - add ebx, [sec] - - mov eax, [ebx+COFF_SECTION.VirtualAddress] - add [edi+COFF_SYM.Value], eax -.next: - add edi, sizeof.COFF_SYM - mov [symbols], edi - dec [sym_count] - jnz .fix + lea ebx, [ebx+ebx*4] + add ebx, [sec] + + mov eax, [ebx+COFF_SECTION.VirtualAddress] + add [edi+COFF_SYM.Value], eax +.next: + add edi, sizeof.COFF_SYM + mov [symbols], edi + dec [sym_count] + jnz .fix mov eax, [retval] ret endp @@ -571,53 +585,53 @@ proc fix_coff_relocs stdcall uses ebx esi, coff:dword, sym:dword, \ delta:dword locals n_sec dd ? - endl - - mov eax, [coff] - movzx ebx, [eax+COFF_HEADER.nSections] - mov [n_sec], ebx - lea esi, [eax+20] -.fix_sec: - mov edi, [esi+COFF_SECTION.PtrReloc] - add edi, [coff] - - movzx ecx, [esi+COFF_SECTION.NumReloc] - test ecx, ecx - jz .next -.reloc_loop: - mov ebx, [edi+COFF_RELOC.SymIndex] - add ebx, ebx - lea ebx, [ebx+ebx*8] - add ebx, [sym] - - mov edx, [ebx+COFF_SYM.Value] - - cmp [edi+COFF_RELOC.Type], 6 - je .dir_32 - - cmp [edi+COFF_RELOC.Type], 20 - jne .next_reloc -.rel_32: - mov eax, [edi+COFF_RELOC.VirtualAddress] - add eax, [esi+COFF_SECTION.VirtualAddress] - sub edx, eax - sub edx, 4 - jmp .fix -.dir_32: - mov eax, [edi+COFF_RELOC.VirtualAddress] - add eax, [esi+COFF_SECTION.VirtualAddress] -.fix: - add eax, [delta] - add [eax], edx + endl + + mov eax, [coff] + movzx ebx, [eax+COFF_HEADER.nSections] + mov [n_sec], ebx + lea esi, [eax+20] +.fix_sec: + mov edi, [esi+COFF_SECTION.PtrReloc] + add edi, [coff] + + movzx ecx, [esi+COFF_SECTION.NumReloc] + test ecx, ecx + jz .next +.reloc_loop: + mov ebx, [edi+COFF_RELOC.SymIndex] + add ebx, ebx + lea ebx, [ebx+ebx*8] + add ebx, [sym] + + mov edx, [ebx+COFF_SYM.Value] + + cmp [edi+COFF_RELOC.Type], 6 + je .dir_32 + + cmp [edi+COFF_RELOC.Type], 20 + jne .next_reloc +.rel_32: + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] + sub edx, eax + sub edx, 4 + jmp .fix +.dir_32: + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] +.fix: + add eax, [delta] + add [eax], edx .next_reloc: add edi, 10 - dec ecx - jnz .reloc_loop -.next: - add esi, sizeof.COFF_SECTION - dec [n_sec] - jnz .fix_sec -.exit: + dec ecx + jnz .reloc_loop +.next: + add esi, sizeof.COFF_SECTION + dec [n_sec] + jnz .fix_sec +.exit: ret endp @@ -626,36 +640,36 @@ proc rebase_coff stdcall uses ebx esi, coff:dword, sym:dword, \ delta:dword locals n_sec dd ? - endl - - mov eax, [coff] - movzx ebx, [eax+COFF_HEADER.nSections] - mov [n_sec], ebx - lea esi, [eax+20] - mov edx, [delta] -.fix_sec: - mov edi, [esi+COFF_SECTION.PtrReloc] - add edi, [coff] - - movzx ecx, [esi+COFF_SECTION.NumReloc] - test ecx, ecx - jz .next -.reloc_loop: - cmp [edi+COFF_RELOC.Type], 6 - jne .next_reloc -.dir_32: - mov eax, [edi+COFF_RELOC.VirtualAddress] - add eax, [esi+COFF_SECTION.VirtualAddress] - add [eax+edx], edx -.next_reloc: - add edi, 10 - dec ecx - jnz .reloc_loop -.next: - add esi, sizeof.COFF_SECTION - dec [n_sec] - jnz .fix_sec -.exit: + endl + + mov eax, [coff] + movzx ebx, [eax+COFF_HEADER.nSections] + mov [n_sec], ebx + lea esi, [eax+20] + mov edx, [delta] +.fix_sec: + mov edi, [esi+COFF_SECTION.PtrReloc] + add edi, [coff] + + movzx ecx, [esi+COFF_SECTION.NumReloc] + test ecx, ecx + jz .next +.reloc_loop: + cmp [edi+COFF_RELOC.Type], 6 + jne .next_reloc +.dir_32: + mov eax, [edi+COFF_RELOC.VirtualAddress] + add eax, [esi+COFF_SECTION.VirtualAddress] + add [eax+edx], edx +.next_reloc: + add edi, 10 + dec ecx + jnz .reloc_loop +.next: + add esi, sizeof.COFF_SECTION + dec [n_sec] + jnz .fix_sec +.exit: ret endp @@ -697,21 +711,21 @@ proc load_driver stdcall, driver_name:dword test eax, eax jz .exit - - mov [coff], eax - - movzx ecx, [eax+COFF_HEADER.nSections] - xor ebx, ebx - - lea edx, [eax+20] -@@: - add ebx, [edx+COFF_SECTION.SizeOfRawData] - add ebx, 15 - and ebx, not 15 - add edx, sizeof.COFF_SECTION - dec ecx - jnz @B - mov [img_size], ebx + + mov [coff], eax + + movzx ecx, [eax+COFF_HEADER.nSections] + xor ebx, ebx + + lea edx, [eax+20] +@@: + add ebx, [edx+COFF_SECTION.SizeOfRawData] + add ebx, 15 + and ebx, not 15 + add edx, sizeof.COFF_SECTION + dec ecx + jnz @B + mov [img_size], ebx stdcall kernel_alloc, ebx test eax, eax @@ -725,70 +739,70 @@ proc load_driver stdcall, driver_name:dword and ecx, not 4095 shr ecx, 2 cld - rep stosd - - mov edx, [coff] - movzx ebx, [edx+COFF_HEADER.nSections] - mov edi, [img_base] - lea eax, [edx+20] -@@: - mov [eax+COFF_SECTION.VirtualAddress], edi - mov esi, [eax+COFF_SECTION.PtrRawData] - test esi, esi - jnz .copy - add edi, [eax+COFF_SECTION.SizeOfRawData] - jmp .next -.copy: - add esi, edx - mov ecx, [eax+COFF_SECTION.SizeOfRawData] - cld - rep movsb -.next: - add edi, 15 - and edi, not 15 - add eax, sizeof.COFF_SECTION - dec ebx - jnz @B - - mov ebx, [edx+COFF_HEADER.pSymTable] - add ebx, edx - mov [sym], ebx - mov ecx, [edx+COFF_HEADER.nSymbols] - add ecx, ecx - lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE - add ecx, [sym] + rep stosd + + mov edx, [coff] + movzx ebx, [edx+COFF_HEADER.nSections] + mov edi, [img_base] + lea eax, [edx+20] +@@: + mov [eax+COFF_SECTION.VirtualAddress], edi + mov esi, [eax+COFF_SECTION.PtrRawData] + test esi, esi + jnz .copy + add edi, [eax+COFF_SECTION.SizeOfRawData] + jmp .next +.copy: + add esi, edx + mov ecx, [eax+COFF_SECTION.SizeOfRawData] + cld + rep movsb +.next: + add edi, 15 + and edi, not 15 + add eax, sizeof.COFF_SECTION + dec ebx + jnz @B + + mov ebx, [edx+COFF_HEADER.pSymTable] + add ebx, edx + mov [sym], ebx + mov ecx, [edx+COFF_HEADER.nSymbols] + add ecx, ecx + lea ecx, [ecx+ecx*8];ecx*=18 = nSymbols*CSYM_SIZE + add ecx, [sym] mov [strings], ecx lea ebx, [exports] mov dword [ebx], kernel_export - mov dword [ebx+4], 0 - lea eax, [edx+20] - - stdcall fix_coff_symbols, eax, [sym], [edx+COFF_HEADER.nSymbols], \ - [strings], ebx - test eax, eax - jz .link_fail + mov dword [ebx+4], 0 + lea eax, [edx+20] + + stdcall fix_coff_symbols, eax, [sym], [edx+COFF_HEADER.nSymbols], \ + [strings], ebx + test eax, eax + jz .link_fail + + mov ebx, [coff] + stdcall fix_coff_relocs, ebx, [sym], 0 + + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szVersion + test eax, eax + jz .link_fail - mov ebx, [coff] - stdcall fix_coff_relocs, ebx, [sym], 0 - - stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szVersion - test eax, eax - jz .link_fail - mov eax, [eax] shr eax, 16 cmp eax, DRV_COMPAT jb .ver_fail cmp eax, DRV_CURRENT - ja .ver_fail - - mov ebx, [coff] - stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szSTART - mov [start], eax - - stdcall kernel_free, [coff] + ja .ver_fail + + mov ebx, [coff] + stdcall get_coff_sym, [sym], [ebx+COFF_HEADER.nSymbols], szSTART + mov [start], eax + + stdcall kernel_free, [coff] mov ebx, [start] stdcall ebx, DRV_ENTRY @@ -802,7 +816,7 @@ proc load_driver stdcall, driver_name:dword jnz @f cmp word [file_name+21], 'j' jnz @f - mov esi, aSis + mov esi, aHDA jmp .redo @@: xor eax, eax @@ -848,13 +862,13 @@ endp coff_get_align: ; Rules: ; - if alignment is not given, use default = 4K; -; - if alignment is given and is no more than 4K, use it; -; - if alignment is more than 4K, revert to 4K. - push ecx - mov cl, byte [edx+COFF_SECTION.Characteristics+2] - mov eax, 1 - shr cl, 4 - dec cl +; - if alignment is given and is no more than 4K, use it; +; - if alignment is more than 4K, revert to 4K. + push ecx + mov cl, byte [edx+COFF_SECTION.Characteristics+2] + mov eax, 1 + shr cl, 4 + dec cl js .default cmp cl, 12 jbe @f @@ -952,13 +966,13 @@ proc load_library stdcall, file_name:dword ; allocate DLLDESCR struct; size is DLLDESCR.sizeof plus size of DLL name mov esi, edi mov ecx, -1 - xor eax, eax - repnz scasb - not ecx - lea eax, [ecx+sizeof.DLLDESCR] - push ecx - call malloc - pop ecx + xor eax, eax + repnz scasb + not ecx + lea eax, [ecx+sizeof.DLLDESCR] + push ecx + call malloc + pop ecx test eax, eax jz .fail_and_free_coff ; save timestamp @@ -976,23 +990,23 @@ proc load_library stdcall, file_name:dword mov [dll_list.bk], esi mov [esi+DLLDESCR.bk], eax mov [eax+DLLDESCR.fd], esi - -; calculate size of loaded DLL - mov edx, [coff] - movzx ecx, [edx+COFF_HEADER.nSections] - xor ebx, ebx - - add edx, 20 + +; calculate size of loaded DLL + mov edx, [coff] + movzx ecx, [edx+COFF_HEADER.nSections] + xor ebx, ebx + + add edx, 20 @@: call coff_get_align - add ebx, eax - not eax - and ebx, eax - add ebx, [edx+COFF_SECTION.SizeOfRawData] - add edx, sizeof.COFF_SECTION - dec ecx - jnz @B -; it must be nonzero and not too big + add ebx, eax + not eax + and ebx, eax + add ebx, [edx+COFF_SECTION.SizeOfRawData] + add edx, sizeof.COFF_SECTION + dec ecx + jnz @B +; it must be nonzero and not too big mov [esi+DLLDESCR.size], ebx test ebx, ebx jz .fail_and_free_dll @@ -1016,108 +1030,108 @@ proc load_library stdcall, file_name:dword mov [esi+DLLDESCR.defaultbase], ecx mov [dll_cur_addr], edx -; copy sections and set correct values for VirtualAddress'es in headers - push esi - mov edx, [coff] - movzx ebx, [edx+COFF_HEADER.nSections] - mov edi, eax - add edx, 20 - cld +; copy sections and set correct values for VirtualAddress'es in headers + push esi + mov edx, [coff] + movzx ebx, [edx+COFF_HEADER.nSections] + mov edi, eax + add edx, 20 + cld @@: call coff_get_align add ecx, eax add edi, eax - not eax - and ecx, eax - and edi, eax - mov [edx+COFF_SECTION.VirtualAddress], ecx - add ecx, [edx+COFF_SECTION.SizeOfRawData] - mov esi, [edx+COFF_SECTION.PtrRawData] - push ecx - mov ecx, [edx+COFF_SECTION.SizeOfRawData] - test esi, esi - jnz .copy - xor eax, eax + not eax + and ecx, eax + and edi, eax + mov [edx+COFF_SECTION.VirtualAddress], ecx + add ecx, [edx+COFF_SECTION.SizeOfRawData] + mov esi, [edx+COFF_SECTION.PtrRawData] + push ecx + mov ecx, [edx+COFF_SECTION.SizeOfRawData] + test esi, esi + jnz .copy + xor eax, eax rep stosb jmp .next .copy: add esi, [coff] - rep movsb -.next: - pop ecx - add edx, sizeof.COFF_SECTION - dec ebx - jnz @B - pop esi + rep movsb +.next: + pop ecx + add edx, sizeof.COFF_SECTION + dec ebx + jnz @B + pop esi ; save some additional data from COFF file -; later we will use COFF header, headers for sections and symbol table -; and also relocations table for all sections - mov edx, [coff] - mov ebx, [edx+COFF_HEADER.pSymTable] - mov edi, dword [fileinfo+32] - sub edi, ebx - jc .fail_and_free_data - mov [esi+DLLDESCR.symbols_lim], edi - add ebx, edx - movzx ecx, [edx+COFF_HEADER.nSections] - lea ecx, [ecx*5] - lea edi, [edi+ecx*8+20] - add edx, 20 -@@: - movzx eax, [edx+COFF_SECTION.NumReloc] - lea eax, [eax*5] - lea edi, [edi+eax*2] - add edx, sizeof.COFF_SECTION - sub ecx, 5 - jnz @b - stdcall kernel_alloc, edi - test eax, eax - jz .fail_and_free_data - mov edx, [coff] - movzx ecx, [edx+COFF_HEADER.nSections] - lea ecx, [ecx*5] - lea ecx, [ecx*2+5] - mov [esi+DLLDESCR.coff_hdr], eax +; later we will use COFF header, headers for sections and symbol table +; and also relocations table for all sections + mov edx, [coff] + mov ebx, [edx+COFF_HEADER.pSymTable] + mov edi, dword [fileinfo+32] + sub edi, ebx + jc .fail_and_free_data + mov [esi+DLLDESCR.symbols_lim], edi + add ebx, edx + movzx ecx, [edx+COFF_HEADER.nSections] + lea ecx, [ecx*5] + lea edi, [edi+ecx*8+20] + add edx, 20 +@@: + movzx eax, [edx+COFF_SECTION.NumReloc] + lea eax, [eax*5] + lea edi, [edi+eax*2] + add edx, sizeof.COFF_SECTION + sub ecx, 5 + jnz @b + stdcall kernel_alloc, edi + test eax, eax + jz .fail_and_free_data + mov edx, [coff] + movzx ecx, [edx+COFF_HEADER.nSections] + lea ecx, [ecx*5] + lea ecx, [ecx*2+5] + mov [esi+DLLDESCR.coff_hdr], eax push esi mov esi, edx mov edi, eax rep movsd - pop esi - mov [esi+DLLDESCR.symbols_ptr], edi - push esi - mov ecx, [edx+COFF_HEADER.nSymbols] - mov [esi+DLLDESCR.symbols_num], ecx - mov ecx, [esi+DLLDESCR.symbols_lim] - mov esi, ebx + pop esi + mov [esi+DLLDESCR.symbols_ptr], edi + push esi + mov ecx, [edx+COFF_HEADER.nSymbols] + mov [esi+DLLDESCR.symbols_num], ecx + mov ecx, [esi+DLLDESCR.symbols_lim] + mov esi, ebx rep movsb - pop esi - mov ebx, [esi+DLLDESCR.coff_hdr] - push esi - movzx eax, [edx+COFF_HEADER.nSections] - lea edx, [ebx+20] -@@: - movzx ecx, [edx+COFF_SECTION.NumReloc] - lea ecx, [ecx*5] - mov esi, [edx+COFF_SECTION.PtrReloc] - mov [edx+COFF_SECTION.PtrReloc], edi - sub [edx+COFF_SECTION.PtrReloc], ebx - add esi, [coff] - shr ecx, 1 - rep movsd - adc ecx, ecx - rep movsw - add edx, sizeof.COFF_SECTION - dec eax - jnz @b - pop esi - -; fixup symbols - mov edx, ebx - mov eax, [ebx+COFF_HEADER.nSymbols] - add edx, 20 - mov ecx, [esi+DLLDESCR.symbols_num] - lea ecx, [ecx*9] + pop esi + mov ebx, [esi+DLLDESCR.coff_hdr] + push esi + movzx eax, [edx+COFF_HEADER.nSections] + lea edx, [ebx+20] +@@: + movzx ecx, [edx+COFF_SECTION.NumReloc] + lea ecx, [ecx*5] + mov esi, [edx+COFF_SECTION.PtrReloc] + mov [edx+COFF_SECTION.PtrReloc], edi + sub [edx+COFF_SECTION.PtrReloc], ebx + add esi, [coff] + shr ecx, 1 + rep movsd + adc ecx, ecx + rep movsw + add edx, sizeof.COFF_SECTION + dec eax + jnz @b + pop esi + +; fixup symbols + mov edx, ebx + mov eax, [ebx+COFF_HEADER.nSymbols] + add edx, 20 + mov ecx, [esi+DLLDESCR.symbols_num] + lea ecx, [ecx*9] add ecx, ecx add ecx, [esi+DLLDESCR.symbols_ptr] @@ -1125,17 +1139,17 @@ proc load_library stdcall, file_name:dword ecx, 0 ; test eax, eax ; jnz @F -; -;@@: - - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], szEXPORTS - test eax, eax - jnz @F - - stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], sz_EXPORTS -@@: - mov [esi+DLLDESCR.exports], eax - +; +;@@: + + stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], szEXPORTS + test eax, eax + jnz @F + + stdcall get_coff_sym, [esi+DLLDESCR.symbols_ptr], [ebx+COFF_HEADER.nSymbols], sz_EXPORTS +@@: + mov [esi+DLLDESCR.exports], eax + ; fix relocs in the hidden copy in kernel memory to default address ; it is first fix; usually this will be enough, but second fix ; can be necessary if real load address will not equal assumption @@ -1157,13 +1171,13 @@ proc load_library stdcall, file_name:dword jnz @f stdcall user_alloc, edi test eax, eax - jz .fail_and_dereference -@@: - mov [img_base], eax - mov eax, sizeof.HDLL - call malloc - test eax, eax - jz .fail_and_free_user + jz .fail_and_dereference +@@: + mov [img_base], eax + mov eax, sizeof.HDLL + call malloc + test eax, eax + jz .fail_and_free_user mov ebx, [CURRENT_TASK] shl ebx, 5 mov edx, [CURRENT_TASK+ebx+TASKDATA.pid] @@ -1366,17 +1380,17 @@ destroy_all_hdlls: align 4 stop_all_services: - push ebp - mov edx, [srv.fd] -.next: - cmp edx, srv.fd-SRV.fd - je .done - cmp [edx+SRV.magic], ' SRV' - jne .next - cmp [edx+SRV.size], sizeof.SRV - jne .next - - mov ebx, [edx+SRV.entry] + push ebp + mov edx, [srv.fd] +.next: + cmp edx, srv.fd-SRV.fd + je .done + cmp [edx+SRV.magic], ' SRV' + jne .next + cmp [edx+SRV.size], sizeof.SRV + jne .next + + mov ebx, [edx+SRV.entry] mov edx, [edx+SRV.fd] test ebx, ebx jz .next diff --git a/kernel/branches/net/core/export.inc b/kernel/branches/net/core/export.inc index 17d371ea74..071f54fa3e 100644 --- a/kernel/branches/net/core/export.inc +++ b/kernel/branches/net/core/export.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Macroinstruction for making export section diff --git a/kernel/branches/net/core/exports.inc b/kernel/branches/net/core/exports.inc index 081f03947b..a6fe21640e 100644 --- a/kernel/branches/net/core/exports.inc +++ b/kernel/branches/net/core/exports.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ iglobal diff --git a/kernel/branches/net/core/ext_lib.inc b/kernel/branches/net/core/ext_lib.inc index 758f7cd2f3..158253616d 100644 --- a/kernel/branches/net/core/ext_lib.inc +++ b/kernel/branches/net/core/ext_lib.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -11,7 +11,7 @@ ; ;============================================================================ -$Revision$ +$Revision $ if 0 ; The code currently does not work. Kill "if 0/end if" only after correcting diff --git a/kernel/branches/net/core/fpu.inc b/kernel/branches/net/core/fpu.inc index 16ef48eb17..6c3f88fc5b 100644 --- a/kernel/branches/net/core/fpu.inc +++ b/kernel/branches/net/core/fpu.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ init_fpu: diff --git a/kernel/branches/net/core/heap.inc b/kernel/branches/net/core/heap.inc index 8f97e2a0bb..3f89c4560a 100644 --- a/kernel/branches/net/core/heap.inc +++ b/kernel/branches/net/core/heap.inc @@ -1,31 +1,31 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ - - -struct MEM_BLOCK - list LHEAD - next_block dd ? ;+8 - prev_block dd ? ;+4 - base dd ? ;+16 - size dd ? ;+20 - flags dd ? ;+24 - handle dd ? ;+28 -ends - -FREE_BLOCK equ 4 -USED_BLOCK equ 8 -DONT_FREE_BLOCK equ 10h - - -block_next equ MEM_BLOCK.next_block -block_prev equ MEM_BLOCK.prev_block -list_fd equ MEM_BLOCK.list.next +$Revision $ + + +struct MEM_BLOCK + list LHEAD + next_block dd ? ;+8 + prev_block dd ? ;+4 + base dd ? ;+16 + size dd ? ;+20 + flags dd ? ;+24 + handle dd ? ;+28 +ends + +FREE_BLOCK equ 4 +USED_BLOCK equ 8 +DONT_FREE_BLOCK equ 10h + + +block_next equ MEM_BLOCK.next_block +block_prev equ MEM_BLOCK.prev_block +list_fd equ MEM_BLOCK.list.next list_bk equ MEM_BLOCK.list.prev block_base equ MEM_BLOCK.base block_size equ MEM_BLOCK.size @@ -137,60 +137,60 @@ proc init_kernel_heap add edi, 0x1000 add edx, 0x1000 dec ecx - jnz .l1 - - mov edi, HEAP_BASE ;descriptors - mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space - mov ecx, HEAP_BASE+sizeof.MEM_BLOCK*2 ;terminator - - xor eax, eax - mov [edi+block_next], ebx + jnz .l1 + + mov edi, HEAP_BASE ;descriptors + mov ebx, HEAP_BASE+sizeof.MEM_BLOCK ;free space + mov ecx, HEAP_BASE+sizeof.MEM_BLOCK*2 ;terminator + + xor eax, eax + mov [edi+block_next], ebx mov [edi+block_prev], eax - mov [edi+list_fd], eax - mov [edi+list_bk], eax - mov [edi+block_base], HEAP_BASE - mov [edi+block_size], 4096*sizeof.MEM_BLOCK - mov [edi+block_flags], USED_BLOCK - - mov [ecx+block_next], eax + mov [edi+list_fd], eax + mov [edi+list_bk], eax + mov [edi+block_base], HEAP_BASE + mov [edi+block_size], 4096*sizeof.MEM_BLOCK + mov [edi+block_flags], USED_BLOCK + + mov [ecx+block_next], eax mov [ecx+block_prev], ebx mov [edi+list_fd], eax mov [edi+list_bk], eax mov [edi+block_base], eax mov [edi+block_size], eax mov [edi+block_flags], USED_BLOCK - - mov [ebx+block_next], ecx - mov [ebx+block_prev], edi - mov [ebx+block_base], HEAP_BASE+4096*sizeof.MEM_BLOCK - - mov ecx, [pg_data.kernel_pages] - shl ecx, 12 - sub ecx, HEAP_BASE-OS_BASE+4096*sizeof.MEM_BLOCK - mov [heap_size], ecx - mov [heap_free], ecx - mov [ebx+block_size], ecx + + mov [ebx+block_next], ecx + mov [ebx+block_prev], edi + mov [ebx+block_base], HEAP_BASE+4096*sizeof.MEM_BLOCK + + mov ecx, [pg_data.kernel_pages] + shl ecx, 12 + sub ecx, HEAP_BASE-OS_BASE+4096*sizeof.MEM_BLOCK + mov [heap_size], ecx + mov [heap_free], ecx + mov [ebx+block_size], ecx mov [ebx+block_flags], FREE_BLOCK mov [mem_block_mask], eax mov [mem_block_mask+4], 0x80000000 mov ecx, mem_block_list+63*8 - list_add ebx, ecx - - mov ecx, 4096-3-1 - mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4 - - mov [next_memblock], HEAP_BASE+sizeof.MEM_BLOCK *3 -@@: - mov [eax-sizeof.MEM_BLOCK], eax - add eax, sizeof.MEM_BLOCK - loop @B - - mov [eax-sizeof.MEM_BLOCK], dword 0 - - mov ecx, heap_mutex - call mutex_init + list_add ebx, ecx + + mov ecx, 4096-3-1 + mov eax, HEAP_BASE+sizeof.MEM_BLOCK*4 + + mov [next_memblock], HEAP_BASE+sizeof.MEM_BLOCK *3 +@@: + mov [eax-sizeof.MEM_BLOCK], eax + add eax, sizeof.MEM_BLOCK + loop @B + + mov [eax-sizeof.MEM_BLOCK], dword 0 + + mov ecx, heap_mutex + call mutex_init mov [heap_blocks], 4094 mov [free_blocks], 4093 ret @@ -578,7 +578,7 @@ restore block_flags ;;;;;;;;;;;;;; USER ;;;;;;;;;;;;;;;;; -HEAP_TOP equ 0x5FC00000 +HEAP_TOP equ 0x80000000 align 4 proc init_heap @@ -848,6 +848,71 @@ proc user_free stdcall, base:dword ret endp + +align 4 +proc user_unmap stdcall, base:dword, offset:dword, size:dword + + push ebx + + mov ebx, [base] ; must be valid pointer + test ebx, ebx + jz .error + + mov edx, [offset] ; check offset + add edx, ebx ; must be below 2Gb app limit + js .error + + shr ebx, 12 ; chek block attributes + lea ebx, [page_tabs+ebx*4] + mov eax, [ebx-4] ; block attributes + test al, USED_BLOCK + jz .error + test al, DONT_FREE_BLOCK + jnz .error + + shr edx, 12 + lea edx, [page_tabs+edx*4] ; unmap offset + + mov ecx, [size] + add ecx, 4095 + shr ecx, 12 ; unmap size in pages + + shr eax, 12 ; block size + 1 page + lea ebx, [ebx+eax*4-4] ; block end ptr + lea eax, [edx+ecx*4] ; unmap end ptr + + cmp eax, ebx ; check for overflow + ja .error + + mov ebx, [offset] + and ebx, not 4095 ; is it required ? + +.unmap: + mov eax, [edx] ; get page addres + test al, 1 ; page mapped ? + jz @F + test eax, PG_SHARED ; page shared ? + jnz @F + mov [page_tabs+edx*4], dword 2 + ; mark page as reserved + invlpg [ebx] ; when we start using + call free_page ; empty c-o-w page instead this ? +@@: + add ebx, 4096 + add edx, 4 + dec ecx + jnz .unmap + + pop ebx + or al, 1 ; return non zero on success + ret +.error: + pop ebx + xor eax, eax ; something wrong + ret +endp + +align 4 user_normalize: ; in: esi=heap_base, edi=heap_top ; out: eax=0 <=> OK @@ -1283,13 +1348,13 @@ align 4 jz .fail add ecx, 4095 - and ecx, -4096 - mov [size], ecx - - mov eax, sizeof.SMEM - call malloc - test eax, eax - mov esi, eax + and ecx, -4096 + mov [size], ecx + + mov eax, sizeof.SMEM + call malloc + test eax, eax + mov esi, eax mov edx, E_NOMEM jz .fail @@ -1345,13 +1410,13 @@ align 4 mov edx, E_ACCESS ja .fail - mov ebx, [CURRENT_TASK] - shl ebx, 5 - mov ebx, [CURRENT_TASK+ebx+4] - mov eax, sizeof.SMAP - - call create_kernel_object - test eax, eax + mov ebx, [CURRENT_TASK] + shl ebx, 5 + mov ebx, [CURRENT_TASK+ebx+4] + mov eax, sizeof.SMAP + + call create_kernel_object + test eax, eax mov edi, eax mov edx, E_NOMEM jz .fail diff --git a/kernel/branches/net/core/irq.inc b/kernel/branches/net/core/irq.inc index 86a3edb165..f1e8e279eb 100644 --- a/kernel/branches/net/core/irq.inc +++ b/kernel/branches/net/core/irq.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; IRQ_RESERVED equ 24 diff --git a/kernel/branches/net/core/malloc.inc b/kernel/branches/net/core/malloc.inc index 519f8cdf36..2e45257d52 100644 --- a/kernel/branches/net/core/malloc.inc +++ b/kernel/branches/net/core/malloc.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Small heap based on malloc/free/realloc written by Doug Lea diff --git a/kernel/branches/net/core/memory.inc b/kernel/branches/net/core/memory.inc index afdbd3e1e9..9220632335 100644 --- a/kernel/branches/net/core/memory.inc +++ b/kernel/branches/net/core/memory.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ align 4 @@ -166,6 +166,7 @@ proc free_page ret endp +align 4 proc map_io_mem stdcall, base:dword, size:dword, flags:dword push ebx @@ -357,8 +358,10 @@ proc init_LFB cmp dword [LFBAddress], -1 jne @f - mov [BOOT_VAR+0x901c], byte 2 - stdcall alloc_pages, (0x280000 / 4096) + mov [BOOT_VAR+BOOT_MTRR], byte 2 +; max VGA=640*480*4=1228800 bytes +; + 32*640*4=81920 bytes for mouse pointer + stdcall alloc_pages, ((1228800+81920)/4096) push eax call alloc_page @@ -366,14 +369,16 @@ proc init_LFB pop eax or eax, PG_UW mov ebx, LFB_BASE - mov ecx, 0x280000 / 4096 +; max VGA=640*480*4=1228800 bytes +; + 32*640*4=81920 bytes for mouse pointer + mov ecx, (1228800+81920)/4096 call commit_pages mov [LFBAddress], dword LFB_BASE ret @@: test [SCR_MODE], word 0100000000000000b jnz @f - mov [BOOT_VAR+0x901c], byte 2 + mov [BOOT_VAR+BOOT_MTRR], byte 2 ret @@: call init_mtrr @@ -1303,6 +1308,11 @@ f68: @@: ret +.26: + stdcall user_unmap, ecx, edx, esi + mov [esp+32], eax + ret + .fail: xor eax, eax mov [esp+32], eax @@ -1325,8 +1335,9 @@ f68call: ; keep this table closer to main code dd f68.21 ; load_driver dd f68.22 ; shmem_open dd f68.23 ; shmem_close - dd f68.24 - dd f68.25 + dd f68.24 ; set exception handler + dd f68.25 ; unmask exception + dd f68.26 ; user_unmap align 4 @@ -1353,7 +1364,7 @@ endp align 4 proc init_mtrr - cmp [BOOT_VAR+0x901c], byte 2 + cmp [BOOT_VAR+BOOT_MTRR], byte 2 je .exit bt [cpu_caps], CAPS_MTRR @@ -1543,3 +1554,27 @@ proc create_ring_buffer stdcall, size:dword, flags:dword .fail: ret endp + + +align 4 +proc print_mem + mov edi, BOOT_VAR + 0x9104 + mov ecx, [edi-4] + test ecx, ecx + jz .done + +@@: + mov eax, [edi] + mov edx, [edi+4] + add eax, [edi+8] + adc edx, [edi+12] + + DEBUGF 1, "K : E820 %x%x - %x%x type %d\n", \ + [edi+4], [edi],\ + edx, eax, [edi+16] + add edi, 20 + dec ecx + jnz @b +.done: + ret +endp diff --git a/kernel/branches/net/core/peload.inc b/kernel/branches/net/core/peload.inc index 002beb7c4b..65faa50baa 100644 --- a/kernel/branches/net/core/peload.inc +++ b/kernel/branches/net/core/peload.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ include 'export.inc' diff --git a/kernel/branches/net/core/sched.inc b/kernel/branches/net/core/sched.inc index f439516172..8d6a4fa5c7 100644 --- a/kernel/branches/net/core/sched.inc +++ b/kernel/branches/net/core/sched.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/kernel/branches/net/core/string.inc b/kernel/branches/net/core/string.inc index c430b37ab1..a811cf257b 100644 --- a/kernel/branches/net/core/string.inc +++ b/kernel/branches/net/core/string.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; Author: Kees J. Bot 1 Jan 1994 ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; size_t strncat(char *s1, const char *s2, size_t n) diff --git a/kernel/branches/net/core/sync.inc b/kernel/branches/net/core/sync.inc index 1aa16e42c7..58556b0fbb 100644 --- a/kernel/branches/net/core/sync.inc +++ b/kernel/branches/net/core/sync.inc @@ -1,13 +1,13 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; Synhronization for MenuetOS. ;; ;; Author: Halyavin Andrey, halyavin@land.ru ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ if ~defined sync_inc diff --git a/kernel/branches/net/core/sys32.inc b/kernel/branches/net/core/sys32.inc index 212b1cf9b3..67c539a721 100644 --- a/kernel/branches/net/core/sys32.inc +++ b/kernel/branches/net/core/sys32.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ;; @@ -11,7 +11,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ align 4 ;3A08 diff --git a/kernel/branches/net/core/syscall.inc b/kernel/branches/net/core/syscall.inc index 316d050ba1..32d1cc6372 100644 --- a/kernel/branches/net/core/syscall.inc +++ b/kernel/branches/net/core/syscall.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Old style system call converter align 16 @@ -145,7 +145,7 @@ iglobal dd sys_settime ; 22-setting date,time,clock and alarm-clock dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist - dd undefined_syscall ; 25-reserved + dd syscall_putarea_backgr ; 25-Put Area to background dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd undefined_syscall ; 27-reserved dd undefined_syscall ; 28-reserved @@ -154,7 +154,7 @@ iglobal dd undefined_syscall ; 31-reserved dd undefined_syscall ; 32-reserved dd undefined_syscall ; 33-reserved - dd undefined_syscall ; 34-reserved + dd syscall_getpixel_WinMap ; 34-GetPixel WinMap dd syscall_getpixel ; 35-GetPixel dd syscall_getarea ; 36-GetArea dd readmousepos ; 37-GetMousePosition_ScreenRelative,. diff --git a/kernel/branches/net/core/taskman.inc b/kernel/branches/net/core/taskman.inc index 7e0d0d7b79..4d0d63c430 100644 --- a/kernel/branches/net/core/taskman.inc +++ b/kernel/branches/net/core/taskman.inc @@ -1,46 +1,46 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ - -GREEDY_KERNEL equ 0 - -struct APP_HEADER_00_ - banner dq ? - version dd ? ;+8 - start dd ? ;+12 - i_end dd ? ;+16 - mem_size dd ? ;+20 - i_param dd ? ;+24 -ends - -struct APP_HEADER_01_ - banner dq ? - version dd ? ;+8 - start dd ? ;+12 - i_end dd ? ;+16 - mem_size dd ? ;+20 - stack_top dd ? ;+24 - i_param dd ? ;+28 - i_icon dd ? ;+32 -ends - - -struct APP_PARAMS - app_cmdline dd ? ;0x00 - app_path dd ? ;0x04 - app_eip dd ? ;0x08 - app_esp dd ? ;0x0C - app_mem dd ? ;0x10 -ends - -macro _clear_ op -{ mov ecx, op/4 + +GREEDY_KERNEL equ 0 + +struct APP_HEADER_00_ + banner dq ? + version dd ? ;+8 + start dd ? ;+12 + i_end dd ? ;+16 + mem_size dd ? ;+20 + i_param dd ? ;+24 +ends + +struct APP_HEADER_01_ + banner dq ? + version dd ? ;+8 + start dd ? ;+12 + i_end dd ? ;+16 + mem_size dd ? ;+20 + stack_top dd ? ;+24 + i_param dd ? ;+28 + i_icon dd ? ;+32 +ends + + +struct APP_PARAMS + app_cmdline dd ? ;0x00 + app_path dd ? ;0x04 + app_eip dd ? ;0x08 + app_esp dd ? ;0x0C + app_mem dd ? ;0x10 +ends + +macro _clear_ op +{ mov ecx, op/4 xor eax, eax cld rep stosd @@ -72,6 +72,7 @@ proc fs_execute slot_base dd ? file_base dd ? file_size dd ? + handle dd ? ;temp. for default cursor handle for curr. thread ;app header data hdr_cmdline dd ? ;0x00 hdr_path dd ? ;0x04 @@ -83,6 +84,13 @@ proc fs_execute pushad + pushad + stdcall set_cursor, [def_cursor_clock] + mov [handle], eax + mov [redrawmouse_unconditional], 1 + call __sys_draw_pointer + popad + mov [flags], edx ; [ebp] pointer to filename @@ -113,7 +121,8 @@ proc fs_execute .bigfilename: popad mov eax, -ERROR_FILE_NOT_FOUND - ret + + jmp .final .namecopied: @@ -127,6 +136,7 @@ proc fs_execute @@: lea eax, [filename] stdcall load_file, eax + mov esi, -ERROR_FILE_NOT_FOUND test eax, eax jz .err_file @@ -237,7 +247,9 @@ end if xor ebx, ebx mov [application_table_status], ebx;unlock application_table_status mutex mov eax, [process_number];set result - ret + + jmp .final + .failed: mov eax, [save_cr3] call set_cr3 @@ -248,19 +260,25 @@ end if xor eax, eax mov [application_table_status], eax mov eax, esi +.final: + pushad + stdcall set_cursor, [handle] + mov [redrawmouse_unconditional], 1 + call __sys_draw_pointer + popad ret endp -align 4 -test_app_header: - virtual at eax - APP_HEADER_00 APP_HEADER_00_ - end virtual - virtual at eax - APP_HEADER_01 APP_HEADER_01_ - end virtual - - cmp dword [eax], 'MENU' +align 4 +test_app_header: + virtual at eax + APP_HEADER_00 APP_HEADER_00_ + end virtual + virtual at eax + APP_HEADER_01 APP_HEADER_01_ + end virtual + + cmp dword [eax], 'MENU' jne .fail cmp word [eax+4], 'ET' jne .fail diff --git a/kernel/branches/net/core/test_malloc.asm b/kernel/branches/net/core/test_malloc.asm index 0d6d8a6250..e158474f88 100644 --- a/kernel/branches/net/core/test_malloc.asm +++ b/kernel/branches/net/core/test_malloc.asm @@ -1,6 +1,13 @@ -; Tests of malloc()/free() from the kernel heap. -; This file is not included in the kernel, it is just test application. -use32 +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2009-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +; Tests of malloc()/free() from the kernel heap. +; This file is not included in the kernel, it is just test application. +use32 db 'MENUET01' dd 1, start, i_end, mem, mem, 0, 0 diff --git a/kernel/branches/net/core/timers.inc b/kernel/branches/net/core/timers.inc index 2785f9c58f..d622ebe611 100644 --- a/kernel/branches/net/core/timers.inc +++ b/kernel/branches/net/core/timers.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2011. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision: 2381 $ diff --git a/kernel/branches/net/core/v86.inc b/kernel/branches/net/core/v86.inc index b05ce5a9c5..a15528699e 100644 --- a/kernel/branches/net/core/v86.inc +++ b/kernel/branches/net/core/v86.inc @@ -1,39 +1,39 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2007-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2007-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Virtual-8086 mode manager ; diamond, 2007, 2008 - -DEBUG_SHOW_IO = 0 - -struct V86_machine -; page directory - pagedir dd ? -; translation table: V86 address -> flat linear address - pages dd ? -; mutex to protect all data from writing by multiple threads at one time - mutex dd ? -; i/o permission map - iopm dd ? -ends - -; Create V86 machine -; in: nothing + +DEBUG_SHOW_IO = 0 + +struct V86_machine +; page directory + pagedir dd ? +; translation table: V86 address -> flat linear address + pages dd ? +; mutex to protect all data from writing by multiple threads at one time + mutex dd ? +; i/o permission map + iopm dd ? +ends + +; Create V86 machine +; in: nothing ; out: eax = handle (pointer to struc V86_machine) ; eax = NULL => failure -; destroys: ebx, ecx, edx (due to malloc) -v86_create: -; allocate V86_machine structure - mov eax, sizeof.V86_machine - call malloc - test eax, eax - jz .fail +; destroys: ebx, ecx, edx (due to malloc) +v86_create: +; allocate V86_machine structure + mov eax, sizeof.V86_machine + call malloc + test eax, eax + jz .fail ; initialize mutex and dword [eax+V86_machine.mutex], 0 ; allocate tables @@ -237,32 +237,32 @@ if ~DEBUG_SHOW_IO mov ecx, 10000h/8/4 rep stosd end if -.ret: - ret - -struct v86_regs -; don't change the order, it is important - edi dd ? - esi dd ? - ebp dd ? - dd ? ; ignored - ebx dd ? - edx dd ? - ecx dd ? - eax dd ? - eip dd ? - cs dd ? - eflags dd ? ; VM flag must be set! - esp dd ? - ss dd ? - es dd ? - ds dd ? - fs dd ? - gs dd ? -ends - -; Run V86 machine -; in: ebx -> registers for V86 (two structures: in and out) +.ret: + ret + +struct v86_regs +; don't change the order, it is important + edi dd ? + esi dd ? + ebp dd ? + dd ? ; ignored + ebx dd ? + edx dd ? + ecx dd ? + eax dd ? + eip dd ? + cs dd ? + eflags dd ? ; VM flag must be set! + esp dd ? + ss dd ? + es dd ? + ds dd ? + fs dd ? + gs dd ? +ends + +; Run V86 machine +; in: ebx -> registers for V86 (two structures: in and out) ; esi = handle ; ecx = expected end address (CS:IP) ; edx = IRQ to hook or -1 if not required @@ -306,16 +306,16 @@ v86_start: ; We do not enable interrupts, because V86 IRQ redirector assumes that ; machine is running ; They will be enabled by IRET. -; sti - - mov eax, esi - sub esp, sizeof.v86_regs - mov esi, ebx - mov edi, esp - mov ecx, sizeof.v86_regs/4 - rep movsd - - cmp edx, -1 +; sti + + mov eax, esi + sub esp, sizeof.v86_regs + mov esi, ebx + mov edi, esp + mov ecx, sizeof.v86_regs/4 + rep movsd + + cmp edx, -1 jz .noirqhook uglobal v86_irqhooks rd IRQ_RESERVED * 2 @@ -359,13 +359,13 @@ v86_exc_c: ; Did we all that we have wanted to do? cmp bl, 1 jne @f - xor eax, eax - mov dr6, eax - @@: - mov eax, [esp+sizeof.v86_regs+10h+18h] - cmp word [esp+v86_regs.eip], ax - jnz @f - shr eax, 16 + xor eax, eax + mov dr6, eax + @@: + mov eax, [esp+sizeof.v86_regs+10h+18h] + cmp word [esp+v86_regs.eip], ax + jnz @f + shr eax, 16 cmp word [esp+v86_regs.cs], ax jz .done @@: @@ -431,13 +431,13 @@ v86_exc_c: shl edx, 4 push eax movzx eax, word [esp+4+v86_regs.esp] - sub eax, 6 - add edx, eax - mov eax, edx - mov esi, [esp+4+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + sub eax, 6 + add edx, eax + mov eax, edx + mov esi, [esp+4+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -479,13 +479,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 jmp .nogp @@: @@ -515,13 +515,13 @@ v86_exc_c: shl edx, 4 mov eax, [esp+v86_regs.esp] sub eax, 2 - movzx eax, ax - add edx, eax - mov eax, edx - mov esi, [esp+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, ax + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -547,13 +547,13 @@ v86_exc_c: movzx edx, word [esp+v86_regs.ss] shl edx, 4 movzx eax, word [esp+v86_regs.esp] - sub eax, 4 - add edx, eax - mov eax, edx - mov esi, [esp+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + sub eax, 4 + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -578,13 +578,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 ; #PF exception jmp .nogp @@: @@ -609,13 +609,13 @@ v86_exc_c: @@: movzx edx, word [esp+v86_regs.ss] shl edx, 4 - movzx eax, word [esp+v86_regs.esp] - add edx, eax - mov eax, edx - mov esi, [esp+sizeof.v86_regs+10h+4] - call v86_get_lin_addr - cmp eax, 0x1000 - jae @f + movzx eax, word [esp+v86_regs.esp] + add edx, eax + mov eax, edx + mov esi, [esp+sizeof.v86_regs+10h+4] + call v86_get_lin_addr + cmp eax, 0x1000 + jae @f mov bl, 14 jmp .nogp @@: @@ -735,13 +735,13 @@ end if call sys_msg_board_str mov ecx, 8 movzx edx, word [esp+32+4] - shl edx, 4 - add edx, [esp+32] -@@: - mov esi, [esp+sizeof.v86_regs+10h+4] - mov eax, edx - call v86_get_lin_addr - cmp eax, 0x1000 + shl edx, 4 + add edx, [esp+32] +@@: + mov esi, [esp+sizeof.v86_regs+10h+4] + mov eax, edx + call v86_get_lin_addr + cmp eax, 0x1000 jb .nopage mov esi, v86_exc_str3-2 call sys_msg_board_str @@ -760,27 +760,27 @@ end if jmp .exit .done: - xor eax, eax - -.exit: - mov [esp+sizeof.v86_regs+10h+1Ch], eax - mov [esp+sizeof.v86_regs+10h+18h], ebx - - mov edx, [esp+sizeof.v86_regs+10h+14h] - cmp edx, -1 - jz @f - dec [v86_irqhooks+edx*8+4] + xor eax, eax + +.exit: + mov [esp+sizeof.v86_regs+10h+1Ch], eax + mov [esp+sizeof.v86_regs+10h+18h], ebx + + mov edx, [esp+sizeof.v86_regs+10h+14h] + cmp edx, -1 + jz @f + dec [v86_irqhooks+edx*8+4] jnz @f and [v86_irqhooks+edx*8], 0 -@@: - - mov esi, esp - mov edi, [esi+sizeof.v86_regs+10h+10h] - add edi, sizeof.v86_regs - mov ecx, sizeof.v86_regs/4 - rep movsd - mov esp, esi - +@@: + + mov esi, esp + mov edi, [esi+sizeof.v86_regs+10h+10h] + add edi, sizeof.v86_regs + mov ecx, sizeof.v86_regs/4 + rep movsd + mov esp, esi + cli mov ecx, [CURRENT_TASK] shl ecx, 8 @@ -861,18 +861,18 @@ v86_irq2: mov ecx, [TASK_COUNT] .scan: cmp [ebx+APPDATA.dir_table], eax - jnz .cont - push ecx - mov ecx, [ebx+APPDATA.saved_esp0] - cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6 - jb .cont2 - movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss] - shl edx, 4 - push eax - movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp] - sub eax, 6 - add edx, eax - mov eax, edx + jnz .cont + push ecx + mov ecx, [ebx+APPDATA.saved_esp0] + cmp word [ecx-sizeof.v86_regs+v86_regs.esp], 6 + jb .cont2 + movzx edx, word [ecx-sizeof.v86_regs+v86_regs.ss] + shl edx, 4 + push eax + movzx eax, word [ecx-sizeof.v86_regs+v86_regs.esp] + sub eax, 6 + add edx, eax + mov eax, edx call v86_get_lin_addr cmp eax, 0x1000 jb .cont3 @@ -892,29 +892,29 @@ v86_irq2: mov ecx, edi call irq_eoi popad - iretd -.found: - mov cr3, eax - sub word [esi-sizeof.v86_regs+v86_regs.esp], 6 - mov ecx, [esi-sizeof.v86_regs+v86_regs.eip] - mov word [edx], cx - mov ecx, [esi-sizeof.v86_regs+v86_regs.cs] - mov word [edx+2], cx - mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags] - mov word [edx+4], cx - lea eax, [edi+8] - cmp al, 10h + iretd +.found: + mov cr3, eax + sub word [esi-sizeof.v86_regs+v86_regs.esp], 6 + mov ecx, [esi-sizeof.v86_regs+v86_regs.eip] + mov word [edx], cx + mov ecx, [esi-sizeof.v86_regs+v86_regs.cs] + mov word [edx+2], cx + mov ecx, [esi-sizeof.v86_regs+v86_regs.eflags] + mov word [edx+4], cx + lea eax, [edi+8] + cmp al, 10h jb @f - add al, 60h -@@: - mov cx, [eax*4] - mov word [esi-sizeof.v86_regs+v86_regs.eip], cx - mov cx, [eax*4+2] - mov word [esi-sizeof.v86_regs+v86_regs.cs], cx - and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3 - call update_counters - lea edi, [ebx + 0x100000000 - SLOT_BASE] - shr edi, 3 + add al, 60h +@@: + mov cx, [eax*4] + mov word [esi-sizeof.v86_regs+v86_regs.eip], cx + mov cx, [eax*4+2] + mov word [esi-sizeof.v86_regs+v86_regs.cs], cx + and byte [esi-sizeof.v86_regs+v86_regs.eflags+1], not 3 + call update_counters + lea edi, [ebx + 0x100000000 - SLOT_BASE] + shr edi, 3 add edi, TASK_DATA call find_next_task.found call do_change_task diff --git a/kernel/branches/net/data16.inc b/kernel/branches/net/data16.inc index c34c177aec..bcd35ca669 100644 --- a/kernel/branches/net/data16.inc +++ b/kernel/branches/net/data16.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ flm db 0 diff --git a/kernel/branches/net/data32.inc b/kernel/branches/net/data32.inc index c995c04693..280a68b520 100644 --- a/kernel/branches/net/data32.inc +++ b/kernel/branches/net/data32.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ keymap: @@ -107,7 +107,7 @@ msg_module db 'in module ',0 msg_version db 'incompatible driver version',13,10,0 msg_www db 'please visit www.kolibrios.org',13,10,0 msg_CR db 13,10,0 -aSis db 'SIS',0 +aHDA db 'INTEL_HDA',0 intel_str db "GenuineIntel",0 AMD_str db "AuthenticAMD",0 @@ -156,23 +156,25 @@ dll_list: .bk dd dll_list .fd dd dll_list -MAX_DEFAULT_DLL_ADDR = 0x20000000 -MIN_DEFAULT_DLL_ADDR = 0x10000000 +MAX_DEFAULT_DLL_ADDR = 0x80000000 +MIN_DEFAULT_DLL_ADDR = 0x70000000 dll_cur_addr dd MIN_DEFAULT_DLL_ADDR ; supported videomodes ; mike.dld { -db 0 -dd servetable-0x10000 -draw_line dd __sys_draw_line -draw_pointer dd __sys_draw_pointer +;db 0 +;dd servetable-0x10000 +;align 4 +;draw_line dd __sys_draw_line +;draw_pointer dd __sys_draw_pointer ;//mike.dld, 2006-08-02 [ -;drawbar dd __sys_drawbar -drawbar dd __sys_drawbar.forced +;;drawbar dd __sys_drawbar +;;drawbar dd __sys_drawbar.forced +;drawbar dd vesa20_drawbar ;//mike.dld, 2006-08-02 ] -putpixel dd __sys_putpixel +;putpixel dd __sys_putpixel ; } mike.dld @@ -272,13 +274,13 @@ graph_data_l: dw 0x7ff dw 0x0000 db 0x00 - dw 11010000b *256 +11110010b - db 0x00 -tss0_l: - dw sizeof.TSS-1 - dw tss and 0xFFFF - db (tss shr 16) and 0xFF - db 10001001b + dw 11010000b *256 +11110010b + db 0x00 +tss0_l: + dw sizeof.TSS-1 + dw tss and 0xFFFF + db (tss shr 16) and 0xFF + db 10001001b dw (tss shr 16) and 0xFF00 tls_data_l: @@ -292,7 +294,8 @@ endofcode: gdte: align 16 -cur_saved_data rb 4096 +cur_saved_data: + rb 4096 fpu_data: rb 512 @@ -330,6 +333,7 @@ _WinMapAddress rd 1 _WinMapSize rd 1 def_cursor rd 1 +def_cursor_clock rd 1 current_cursor rd 1 hw_cursor rd 1 cur_saved_base rd 1 @@ -393,13 +397,10 @@ windowtypechanged rd 1 hd_entries rd 1 ;unused ? 0xfe10 -;* start code - Mario79 - mouse_active rd 1 mouse_pause rd 1 -MouseTickCounter rd 1 -;* end code - Mario79 +redrawmouse_unconditional rd 1 img_background rd 1 mem_BACKGROUND rd 1 diff --git a/kernel/branches/net/detect/biosdisk.inc b/kernel/branches/net/detect/biosdisk.inc index 2a5cc7e4b7..eb1c6688b8 100644 --- a/kernel/branches/net/detect/biosdisk.inc +++ b/kernel/branches/net/detect/biosdisk.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2008. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2008-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Detect all BIOS hard drives. ; diamond, 2008 diff --git a/kernel/branches/net/detect/biosmem.inc b/kernel/branches/net/detect/biosmem.inc index 7b66cd4b66..2bb66a600f 100644 --- a/kernel/branches/net/detect/biosmem.inc +++ b/kernel/branches/net/detect/biosmem.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2009. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2009-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Query physical memory map from BIOS. ; diamond, 2009 @@ -20,14 +20,14 @@ mov edx, 0x534D4150 int 15h jc no_E820 - cmp eax, 0x534D4150 - jnz no_E820 -e820_mem_loop: - cmp byte [di+16], 1 ; ignore non-free areas - jnz e820_mem_next - inc byte [0x9100] - add di, 20 -e820_mem_next: + cmp eax, 0x534D4150 + jnz no_E820 +e820_mem_loop: +; cmp byte [di+16], 1 ; ignore non-free areas +; jnz e820_mem_next + inc byte [0x9100] + add di, 20 +e820_mem_next: ; consequent calls to fn E820 test ebx, ebx jz e820_test_done diff --git a/kernel/branches/net/detect/dev_fd.inc b/kernel/branches/net/detect/dev_fd.inc index dd59675ccf..5105bee458 100644 --- a/kernel/branches/net/detect/dev_fd.inc +++ b/kernel/branches/net/detect/dev_fd.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;*************************************************** diff --git a/kernel/branches/net/detect/dev_hdcd.inc b/kernel/branches/net/detect/dev_hdcd.inc index 16ae83ca8b..159f49bdc9 100644 --- a/kernel/branches/net/detect/dev_hdcd.inc +++ b/kernel/branches/net/detect/dev_hdcd.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;****************************************************** diff --git a/kernel/branches/net/detect/disks.inc b/kernel/branches/net/detect/disks.inc index aba4571cfb..d6c89538f8 100644 --- a/kernel/branches/net/detect/disks.inc +++ b/kernel/branches/net/detect/disks.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ include 'dev_fd.inc' diff --git a/kernel/branches/net/detect/getcache.inc b/kernel/branches/net/detect/getcache.inc index 03dbe944c8..96461cd46f 100644 --- a/kernel/branches/net/detect/getcache.inc +++ b/kernel/branches/net/detect/getcache.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ pusha diff --git a/kernel/branches/net/detect/sear_par.inc b/kernel/branches/net/detect/sear_par.inc index e3377d23b2..17a0520961 100644 --- a/kernel/branches/net/detect/sear_par.inc +++ b/kernel/branches/net/detect/sear_par.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;**************************************************** diff --git a/kernel/branches/net/drivers/sceletone.asm b/kernel/branches/net/drivers/sceletone.asm index 4f9df29e5c..0311d23ed6 100644 --- a/kernel/branches/net/drivers/sceletone.asm +++ b/kernel/branches/net/drivers/sceletone.asm @@ -1,177 +1,173 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; - -;driver sceletone - -format MS COFF - -DEBUG equ 1 - -API_VERSION equ 0 ;debug - -include 'proc32.inc' -include 'imports.inc' - -OS_BASE equ 0; -new_app_base equ 0x60400000 -PROC_BASE equ OS_BASE+0x0080000 - -struc IOCTL -{ .handle dd ? - .io_code dd ? - .input dd ? - .inp_size dd ? - .output dd ? - .out_size dd ? -} - -virtual at 0 - IOCTL IOCTL -end virtual - -public START -public service_proc -public version - -DRV_ENTRY equ 1 -DRV_EXIT equ -1 -STRIDE equ 4 ;size of row in devices table - -SRV_GETVERSION equ 0 - -section '.flat' code readable align 16 - -proc START stdcall, state:dword - - cmp [state], 1 - jne .exit -.entry: - - if DEBUG - mov esi, msgInit - call SysMsgBoardStr - end if - - stdcall RegService, my_service, service_proc - ret -.fail: -.exit: - xor eax, eax - ret -endp - -handle equ IOCTL.handle -io_code equ IOCTL.io_code -input equ IOCTL.input -inp_size equ IOCTL.inp_size -output equ IOCTL.output -out_size equ IOCTL.out_size - -align 4 -proc service_proc stdcall, ioctl:dword - - mov ebx, [ioctl] - mov eax, [ebx+io_code] - cmp eax, SRV_GETVERSION - jne @F - - mov eax, [ebx+output] - cmp [ebx+out_size], 4 - jne .fail - mov [eax], dword API_VERSION - xor eax, eax - ret -@@: -.fail: - or eax, -1 - ret -endp - -restore handle -restore io_code -restore input -restore inp_size -restore output -restore out_size - -align 4 -proc detect - locals - last_bus dd ? - endl - - xor eax, eax - mov [bus], eax - inc eax - call PciApi - cmp eax, -1 - je .err - - mov [last_bus], eax - -.next_bus: - and [devfn], 0 -.next_dev: - stdcall PciRead32, [bus], [devfn], dword 0 - test eax, eax - jz .next - cmp eax, -1 - je .next - - mov edi, devices -@@: - mov ebx, [edi] - test ebx, ebx - jz .next - - cmp eax, ebx - je .found - - add edi, STRIDE - jmp @B -.next: - inc [devfn] - cmp [devfn], 256 - jb .next_dev - mov eax, [bus] - inc eax - mov [bus], eax - cmp eax, [last_bus] - jna .next_bus - xor eax, eax - ret -.found: - xor eax, eax - inc eax - ret -.err: - xor eax, eax - ret -endp - -DEVICE_ID equ 1234; pci device id -VENDOR_ID equ 5678; device vendor id - - -;all initialized data place here - -align 4 -devices dd (DEVICE_ID shl 16)+VENDOR_ID - dd 0 ;terminator - -version dd (5 shl 16) or (API_VERSION and 0xFFFF) - -my_service db 'MY_SERVICE',0 ;max 16 chars include zero - -msgInit db 'detect hardware...',13,10,0 -msgPCI db 'PCI accsess not supported',13,10,0 -msgFail db 'device not found',13,10,0 - -section '.data' data readable writable align 16 - -;all uninitialized data place here - +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +;driver sceletone + +format MS COFF + +DEBUG equ 1 + +API_VERSION equ 0 ;debug + +include 'proc32.inc' +include 'imports.inc' + +struc IOCTL +{ .handle dd ? + .io_code dd ? + .input dd ? + .inp_size dd ? + .output dd ? + .out_size dd ? +} + +virtual at 0 + IOCTL IOCTL +end virtual + +public START +public service_proc +public version + +DRV_ENTRY equ 1 +DRV_EXIT equ -1 +STRIDE equ 4 ;size of row in devices table + +SRV_GETVERSION equ 0 + +section '.flat' code readable align 16 + +proc START stdcall, state:dword + + cmp [state], 1 + jne .exit +.entry: + + if DEBUG + mov esi, msgInit + call SysMsgBoardStr + end if + + stdcall RegService, my_service, service_proc + ret +.fail: +.exit: + xor eax, eax + ret +endp + +handle equ IOCTL.handle +io_code equ IOCTL.io_code +input equ IOCTL.input +inp_size equ IOCTL.inp_size +output equ IOCTL.output +out_size equ IOCTL.out_size + +align 4 +proc service_proc stdcall, ioctl:dword + + mov ebx, [ioctl] + mov eax, [ebx+io_code] + cmp eax, SRV_GETVERSION + jne @F + + mov eax, [ebx+output] + cmp [ebx+out_size], 4 + jne .fail + mov [eax], dword API_VERSION + xor eax, eax + ret +@@: +.fail: + or eax, -1 + ret +endp + +restore handle +restore io_code +restore input +restore inp_size +restore output +restore out_size + +align 4 +proc detect + locals + last_bus dd ? + endl + + xor eax, eax + mov [bus], eax + inc eax + call PciApi + cmp eax, -1 + je .err + + mov [last_bus], eax + +.next_bus: + and [devfn], 0 +.next_dev: + stdcall PciRead32, [bus], [devfn], dword 0 + test eax, eax + jz .next + cmp eax, -1 + je .next + + mov edi, devices +@@: + mov ebx, [edi] + test ebx, ebx + jz .next + + cmp eax, ebx + je .found + + add edi, STRIDE + jmp @B +.next: + inc [devfn] + cmp [devfn], 256 + jb .next_dev + mov eax, [bus] + inc eax + mov [bus], eax + cmp eax, [last_bus] + jna .next_bus + xor eax, eax + ret +.found: + xor eax, eax + inc eax + ret +.err: + xor eax, eax + ret +endp + +DEVICE_ID equ 1234; pci device id +VENDOR_ID equ 5678; device vendor id + + +;all initialized data place here + +align 4 +devices dd (DEVICE_ID shl 16)+VENDOR_ID + dd 0 ;terminator + +version dd (5 shl 16) or (API_VERSION and 0xFFFF) + +my_service db 'MY_SERVICE',0 ;max 16 chars include zero + +msgInit db 'detect hardware...',13,10,0 +msgPCI db 'PCI accsess not supported',13,10,0 +msgFail db 'device not found',13,10,0 + +section '.data' data readable writable align 16 + +;all uninitialized data place here + diff --git a/kernel/branches/net/fdo.inc b/kernel/branches/net/fdo.inc index b865aae081..9b1f96d0a8 100644 --- a/kernel/branches/net/fdo.inc +++ b/kernel/branches/net/fdo.inc @@ -1,10 +1,10 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ _esp equ esp diff --git a/kernel/branches/net/fs/ext2.inc b/kernel/branches/net/fs/ext2.inc index acb243e4df..dca7c7406e 100644 --- a/kernel/branches/net/fs/ext2.inc +++ b/kernel/branches/net/fs/ext2.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; 02.02.2010 turbanoff - support 70.5 ;; -;; 23.01.2010 turbanoff - support 70.0 70.1 ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; 02.02.2010 turbanoff - support 70.5 ;; +;; 23.01.2010 turbanoff - support 70.0 70.1 ;; ;; ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; diff --git a/kernel/branches/net/fs/fat12.inc b/kernel/branches/net/fs/fat12.inc index f308aee998..731030edc1 100644 --- a/kernel/branches/net/fs/fat12.inc +++ b/kernel/branches/net/fs/fat12.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; FAT12.INC ;; @@ -8,7 +8,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ n_sector dd 0 ; temporary save for sector value diff --git a/kernel/branches/net/fs/fat32.inc b/kernel/branches/net/fs/fat32.inc index 057dd5f7f2..81f4a0e3de 100644 --- a/kernel/branches/net/fs/fat32.inc +++ b/kernel/branches/net/fs/fat32.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; FAT32.INC ;; @@ -44,7 +44,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ cache_max equ 1919 ; max. is 1919*512+0x610000=0x6ffe00 diff --git a/kernel/branches/net/fs/fs.inc b/kernel/branches/net/fs/fs.inc index 8ab90dd589..79206a814b 100644 --- a/kernel/branches/net/fs/fs.inc +++ b/kernel/branches/net/fs/fs.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; ;; @@ -17,7 +17,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ iglobal diff --git a/kernel/branches/net/fs/fs_lfn.inc b/kernel/branches/net/fs/fs_lfn.inc index ecc24aafcc..4b46a99cfd 100644 --- a/kernel/branches/net/fs/fs_lfn.inc +++ b/kernel/branches/net/fs/fs_lfn.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ image_of_eax EQU esp+32 diff --git a/kernel/branches/net/fs/iso9660.inc b/kernel/branches/net/fs/iso9660.inc index f8e1cc7c6e..7d835fa5fd 100644 --- a/kernel/branches/net/fs/iso9660.inc +++ b/kernel/branches/net/fs/iso9660.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ uglobal diff --git a/kernel/branches/net/fs/ntfs.inc b/kernel/branches/net/fs/ntfs.inc index f31ee04d62..e0d02c32f0 100644 --- a/kernel/branches/net/fs/ntfs.inc +++ b/kernel/branches/net/fs/ntfs.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ntfs_test_bootsec: diff --git a/kernel/branches/net/fs/parse_fn.inc b/kernel/branches/net/fs/parse_fn.inc index 1541b86f67..40f0dd39a7 100644 --- a/kernel/branches/net/fs/parse_fn.inc +++ b/kernel/branches/net/fs/parse_fn.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -14,7 +14,7 @@ ; ;------------------------------------------------------------------------- -$Revision$ +$Revision $ iglobal diff --git a/kernel/branches/net/fs/part_set.inc b/kernel/branches/net/fs/part_set.inc index d7f4bbd656..391c7b1158 100644 --- a/kernel/branches/net/fs/part_set.inc +++ b/kernel/branches/net/fs/part_set.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;************************************************************* diff --git a/kernel/branches/net/gui/button.inc b/kernel/branches/net/gui/button.inc index b1db263aef..801bda157c 100644 --- a/kernel/branches/net/gui/button.inc +++ b/kernel/branches/net/gui/button.inc @@ -1,12 +1,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;============================================================================== ;///// public functions /////////////////////////////////////////////////////// @@ -133,7 +133,8 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// call button._.button_dececx push edi xor edi, edi - call [draw_line] +; call [draw_line] + call __sys_draw_line pop edi add ebx, 0x00010001 dec edx @@ -164,7 +165,8 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// xor edi, edi mov ecx, esi call button._.incecx - call [draw_line] +; call [draw_line] + call __sys_draw_line ; bottom border movzx edx, word[esp + 4 + 0] @@ -173,7 +175,8 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// add ebx, edx mov ecx, esi call button._.dececx - call [draw_line] +; call [draw_line] + call __sys_draw_line ; left border pop ebx @@ -188,7 +191,8 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// pop edx mov ecx, esi call button._.incecx - call [draw_line] +; call [draw_line] + call __sys_draw_line ; right border mov dx, [esp + 4] @@ -198,7 +202,8 @@ syscall_button: ;///// system function 8 ////////////////////////////////////// add ebx, 0x00010000 mov ecx, esi call button._.dececx - call [draw_line] +; call [draw_line] + call __sys_draw_line pop ecx ebx diff --git a/kernel/branches/net/gui/event.inc b/kernel/branches/net/gui/event.inc index ddd75d4cd4..8601e2fa5f 100644 --- a/kernel/branches/net/gui/event.inc +++ b/kernel/branches/net/gui/event.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ WINDOW_MOVE_AND_RESIZE_FLAGS = \ mouse.WINDOW_RESIZE_N_FLAG + \ @@ -22,33 +22,38 @@ align 4 endg EV_SPACE = 512 FreeEvents = event_start-EVENT.fd ; "виртуальный" event, используются только поля: - ; FreeEvents.fd=event_start и FreeEvents.bk=event_end -align 4 -init_events: ;; used from kernel.asm - stdcall kernel_alloc, EV_SPACE*sizeof.EVENT - or eax, eax - jz .fail - ; eax - current event, ebx - previos event below + ; FreeEvents.fd=event_start и FreeEvents.bk=event_end +;----------------------------------------------------------------------------- +align 4 +init_events: ;; used from kernel.asm + stdcall kernel_alloc, EV_SPACE*sizeof.EVENT + or eax, eax + jz .fail + ; eax - current event, ebx - previos event below mov ecx, EV_SPACE ; current - in allocated space mov ebx, FreeEvents ; previos - начало списка push ebx ; оно же и конец потом будет - @@: - mov [ebx+EVENT.fd], eax - mov [eax+EVENT.bk], ebx - mov ebx, eax ; previos <- current - add eax, sizeof.EVENT ; new current - loop @b - pop eax ; вот оно концом и стало - mov [ebx+EVENT.fd], eax +;-------------------------------------- +align 4 +@@: + mov [ebx+EVENT.fd], eax mov [eax+EVENT.bk], ebx + mov ebx, eax ; previos <- current + add eax, sizeof.EVENT ; new current + loop @b + pop eax ; вот оно концом и стало + mov [ebx+EVENT.fd], eax + mov [eax+EVENT.bk], ebx +;-------------------------------------- +align 4 .fail: ret - +;----------------------------------------------------------------------------- EVENT_WATCHED equ 0x10000000 ;бит 28 EVENT_SIGNALED equ 0x20000000 ;бит 29 MANUAL_RESET equ 0x40000000 ;бит 30 MANUAL_DESTROY equ 0x80000000 ;бит 31 - +;----------------------------------------------------------------------------- align 4 create_event: ;; EXPORT use ;info: @@ -67,7 +72,8 @@ create_event: ;; EXPORT use mov edx, [edx+TASKDATA.pid] pushfd cli - +;-------------------------------------- +align 4 set_event: ;; INTERNAL use !!! don't use for Call ;info: ; Берем новый event из FreeEvents, заполняем его поля, как указано в ecx,edx,esi @@ -89,7 +95,9 @@ set_event: ;; INTERNAL use !!! don't use call init_events popad jz RemoveEventTo.break ; POPF+RET - @@: +;-------------------------------------- +align 4 +@@: mov eax, [eax+EVENT.fd] mov [eax+EVENT.magic], 'EVNT' mov [eax+EVENT.destroy], destroy_event.internal @@ -97,13 +105,14 @@ set_event: ;; INTERNAL use !!! don't use mov [eax+EVENT.pid], edx inc [event_uid] Mov [eax+EVENT.id],edx,[event_uid] - or esi, esi - jz RemoveEventTo - lea edi, [eax+EVENT.code] - mov ecx, (sizeof.EVENT -EVENT.code)/4 - cld - rep movsd - + or esi, esi + jz RemoveEventTo + lea edi, [eax+EVENT.code] + mov ecx, (sizeof.EVENT -EVENT.code)/4 + cld + rep movsd +;-------------------------------------- +align 4 RemoveEventTo: ;; INTERNAL use !!! don't use for Call ;param: ; eax - указатель на event, КОТОРЫЙ вставляем @@ -118,10 +127,12 @@ RemoveEventTo: ;; INTERNAL use !!! don't use xchg ecx, [eax+EVENT.fd] ; Self.fd=NewRight, ecx=OldRight mov [ebx+EVENT.fd], ecx ; OldLeft.fd=OldRight mov [ecx+EVENT.bk], ebx ; OldRight.bk=OldLeft +;-------------------------------------- +align 4 .break: popfd ret - +;----------------------------------------------------------------------------- align 4 NotDummyTest: ;; INTERNAL use (not returned for fail !!!) pop edi @@ -129,6 +140,8 @@ NotDummyTest: ;; INTERNAL use (not returned mov ebx, eax mov eax, [ebx+EVENT.pid] push edi +;-------------------------------------- +align 4 .small: ; криво как-то... pop edi pushfd @@ -137,7 +150,7 @@ NotDummyTest: ;; INTERNAL use (not returned shl eax, 8 jz RemoveEventTo.break ; POPF+RET jmp edi ; штатный возврат - +;----------------------------------------------------------------------------- align 4 raise_event: ;; EXPORT use ;info: @@ -152,25 +165,29 @@ raise_event: ;; EXPORT use ; esi - event data (=0 => skip) ;scratched: ebx,ecx,esi,edi call NotDummyTest ; not returned for fail !!! - or esi, esi - jz @f - lea edi, [ebx+EVENT.code] - mov ecx, (sizeof.EVENT -EVENT.code)/4 - cld - rep movsd - @@: + or esi, esi + jz @f + lea edi, [ebx+EVENT.code] + mov ecx, (sizeof.EVENT -EVENT.code)/4 + cld + rep movsd +;-------------------------------------- +align 4 +@@: test byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 jnz RemoveEventTo.break ; POPF+RET bt edx, 28 ;EVENT_WATCHED jnc @f test byte[ebx+EVENT.state+3], EVENT_WATCHED shr 24 jz RemoveEventTo.break ; POPF+RET - @@: +;-------------------------------------- +align 4 +@@: or byte[ebx+EVENT.state+3], EVENT_SIGNALED shr 24 add eax, SLOT_BASE+APP_EV_OFFSET xchg eax, ebx jmp RemoveEventTo - +;----------------------------------------------------------------------------- align 4 clear_event: ;; EXPORT use ;info: @@ -184,7 +201,7 @@ clear_event: ;; EXPORT use and byte[ebx+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) xchg eax, ebx jmp RemoveEventTo - +;----------------------------------------------------------------------------- align 4 send_event: ;; EXPORT use ;info: @@ -207,7 +224,7 @@ send_event: ;; EXPORT use lea ebx, [eax+SLOT_BASE+APP_EV_OFFSET] mov ecx, EVENT_SIGNALED jmp set_event - +;----------------------------------------------------------------------------- align 4 DummyTest: ;; INTERNAL use (not returned for fail !!!) ;param: @@ -217,16 +234,21 @@ DummyTest: ;; INTERNAL use (not returned jne @f cmp [eax+EVENT.id], ebx je .ret - @@: +;-------------------------------------- +align 4 +@@: pop eax xor eax, eax +;-------------------------------------- +align 4 .ret: ret - - +;----------------------------------------------------------------------------- align 4 Wait_events: or ebx, -1; infinite timeout +;-------------------------------------- +align 4 Wait_events_ex: ;info: ; Ожидание "абстрактного" события через перевод слота в 5-ю позицию. @@ -260,9 +282,11 @@ Wait_events_ex: mov [eax+TASKDATA.state], 5 call change_task mov eax, [esi+APPDATA.wait_param] - @@: +;-------------------------------------- +align 4 +@@: ret - +;----------------------------------------------------------------------------- align 4 wait_event: ;; EXPORT use ;info: @@ -281,7 +305,7 @@ wait_event: ;; EXPORT use mov edx, get_event_alone ; wait_test call Wait_events ; timeout ignored jmp wait_finish - +;----------------------------------------------------------------------------- align 4 get_event_ex: ;; f68:14 ;info: @@ -296,16 +320,18 @@ get_event_ex: ;; f68:14 ;retval: ; eax - собственно EVENT (будем называть это его хэндлом) ;scratched: ebx,ecx,edx,esi,edi - mov edx, get_event_queue ; wait_test - call Wait_events ; timeout ignored - lea esi, [eax+EVENT.code] - mov ecx, (sizeof.EVENT-EVENT.code)/4 - cld - rep movsd - mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field -wait_finish: - test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 - jnz get_event_queue.ret ; RET + mov edx, get_event_queue ; wait_test + call Wait_events ; timeout ignored + lea esi, [eax+EVENT.code] + mov ecx, (sizeof.EVENT-EVENT.code)/4 + cld + rep movsd + mov byte[edi-(sizeof.EVENT-EVENT.code)+2], cl;clear priority field +;-------------------------------------- +align 4 +wait_finish: + test byte[eax+EVENT.state+3], MANUAL_RESET shr 24 + jnz get_event_queue.ret ; RET and byte[eax+EVENT.state+3], not((EVENT_SIGNALED+EVENT_WATCHED)shr 24) test byte[eax+EVENT.state+3], MANUAL_DESTROY shr 24 jz destroy_event.internal @@ -314,7 +340,7 @@ wait_finish: pushfd cli jmp RemoveEventTo - +;----------------------------------------------------------------------------- align 4 destroy_event: ;; EXPORT use ;info: @@ -326,6 +352,8 @@ destroy_event: ;; EXPORT use ; eax - адрес объекта EVENT (=0 => fail) ;scratched: ebx,ecx call DummyTest ; not returned for fail !!! +;-------------------------------------- +align 4 .internal: xor ecx, ecx ; clear common header pushfd @@ -336,7 +364,7 @@ destroy_event: ;; EXPORT use mov [eax+EVENT.id], ecx mov ebx, FreeEvents jmp RemoveEventTo - +;----------------------------------------------------------------------------- align 4 get_event_queue: ;info: @@ -353,9 +381,11 @@ get_event_queue: mov eax, [ebx+APPOBJ.bk] ; выбираем с конца, по принципу FIFO cmp eax, ebx ; empty ??? je get_event_alone.ret0 +;-------------------------------------- +align 4 .ret: ret - +;----------------------------------------------------------------------------- align 4 get_event_alone: ;info: @@ -372,21 +402,27 @@ get_event_alone: test byte[eax+EVENT.state+3], EVENT_SIGNALED shr 24 jnz .ret or byte[eax+EVENT.state+3], EVENT_WATCHED shr 24 +;-------------------------------------- +align 4 .ret0: xor eax, eax; NO event!!! +;-------------------------------------- +align 4 .ret: ret - +;----------------------------------------------------------------------------- align 4 sys_sendwindowmsg: ;; f72 dec ebx jnz .ret ;subfunction==1 ? - ;pushfd ;а нафига? + pushfd cli sub ecx, 2 je .sendkey dec ecx jnz .retf +;-------------------------------------- +align 4 .sendbtn: cmp byte[BTN_COUNT], 1 jae .result ;overflow @@ -394,18 +430,27 @@ sys_sendwindowmsg: ;; f72 shl edx, 8 mov [BTN_BUFF], edx jmp .result +;-------------------------------------- +align 4 .sendkey: movzx eax, byte[KEY_COUNT] cmp al, 120 jae .result ;overflow inc byte[KEY_COUNT] mov [KEY_COUNT+1+eax], dl +;-------------------------------------- +align 4 .result: setae byte[esp+32] ;считаем, что исходно: dword[esp+32]==72 -.retf: ;popfd +;-------------------------------------- +align 4 +.retf: + popfd +;-------------------------------------- +align 4 .ret: ret - +;----------------------------------------------------------------------------- align 4 sys_getevent: ;; f11 mov ebx, [current_slot];пока это вопрос, чего куды сувать.......... @@ -415,16 +460,18 @@ sys_getevent: ;; f11 popfd mov [esp+32], eax ret - +;----------------------------------------------------------------------------- align 4 sys_waitforevent: ;; f10 or ebx, -1; infinite timeout +;-------------------------------------- +align 4 sys_wait_event_timeout: ;; f23 mov edx, get_event_for_app; wait_test call Wait_events_ex ; ebx - timeout mov [esp+32], eax ret - +;----------------------------------------------------------------------------- align 4 get_event_for_app: ;; used from f10,f11,f23 ;info: @@ -441,46 +488,78 @@ get_event_for_app: ;; used from f10,f11,f23 shl edi, 5 add edi, CURRENT_TASK ; edi is assumed as [TASK_BASE] mov ecx, [edi+TASKDATA.event_mask] + and ecx, 0x7FFFFFFF +;-------------------------------------- +align 4 .loop: ; пока не исчерпаем все биты маски bsr eax, ecx ; находим ненулевой бит маски (31 -> 0) jz .no_events ; исчерпали все биты маски, но ничего не нашли ??? btr ecx, eax ; сбрасываем проверяемый бит маски ; переходим на обработчик этого (eax) бита cmp eax, 9 - jae .loop ; eax=[9..31], ignored + jae .loop ; eax=[9..31], ignored (event 10...32) + cmp eax, 3 - je .loop ; eax=3, ignored - ja .FlagAutoReset ; eax=[4..8], retvals=eax+1 + je .loop ; eax=3, ignored (event 4) + + cmp eax, 4 + je .FlagAutoReset ; eax=4, retvals=eax+1 (event 5) + + cmp eax, 5 + je .mouse_check ; eax=5, retvals=eax+1 (event 6) + + ja .FlagAutoReset ; eax=[6..8], retvals=eax+1 (event 7...9) + cmp eax, 1 - jae .BtKy ; eax=[1,2], retvals=eax+1 + jae .BtKy ; eax=[1,2], retvals=eax+1 (event 2,3) +;-------------------------------------- +align 4 .WndRedraw: ; eax=0, retval WndRedraw=1 cmp [edi-twdw+WDATA.fl_redraw], al;al==0 jne .result jmp .loop - .no_events: +;-------------------------------------- +align 4 +.no_events: xor eax, eax ret - -.FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9 - cmp eax, 5; Mouse 5+1=6 - jne @f +;-------------------------------------- +align 4 +.mouse_check: ; Mouse 5+1=6 push eax + mov eax, [TASK_BASE] + mov eax, [eax + TASKDATA.event_mask] + test eax, 0x80000000 ; bit 31: active/inactive filter f.40 + jz @f + pop eax + jmp .FlagAutoReset +;-------------------------------------- +align 4 +@@: ; If the window is captured and moved by the user, then no mouse events!!! mov al, [mouse.active_sys_window.action] and al, WINDOW_MOVE_AND_RESIZE_FLAGS test al, al pop eax jnz .loop -@@: +;-------------------------------------- +align 4 +.FlagAutoReset: ; retvals: BgrRedraw=5, IPC=7, Stack=8, Debug=9 btr [ebx+APPDATA.event_mask], eax jnc .loop - .result: ; retval = eax+1 +;-------------------------------------- +align 4 +.result: ; retval = eax+1 inc eax ret - .BtKy: +;-------------------------------------- +align 4 +.BtKy: movzx edx, bh movzx edx, word[WIN_STACK+edx*2] je .Keys ; eax=1, retval Keys=2 +;-------------------------------------- +align 4 .Buttons: ; eax=2, retval Buttons=3 cmp byte[BTN_COUNT], 0 je .loop ; empty ??? @@ -493,14 +572,20 @@ get_event_for_app: ;; used from f10,f11,f23 mov [window_minimize], 1 dec byte[BTN_COUNT] jmp .loop +;-------------------------------------- +align 4 .Keys: ; eax==1 cmp edx, [TASK_COUNT] jne @f ; not Top ??? cmp [KEY_COUNT], al; al==1 jae .result ; not empty ??? - @@: +;-------------------------------------- +align 4 +@@: mov edx, hotkey_buffer - @@: +;-------------------------------------- +align 4 +@@: cmp [edx], bh ; bh - slot for testing je .result add edx, 8 @@ -508,3 +593,4 @@ get_event_for_app: ;; used from f10,f11,f23 jb @b jmp .loop ;end. +;----------------------------------------------------------------------------- \ No newline at end of file diff --git a/kernel/branches/net/gui/font.inc b/kernel/branches/net/gui/font.inc index 24c18aba11..0e30d9461c 100644 --- a/kernel/branches/net/gui/font.inc +++ b/kernel/branches/net/gui/font.inc @@ -1,132 +1,231 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ -; // Alver 22.06.2008 // { +;------------------------------------------------------------------------------ align 4 dtext_asciiz_esi: ; for skins title out push eax xor eax, eax inc eax jmp dtext.1 -; } \\ Alver \\ - +;------------------------------------------------------------------------------ align 4 -dtext: ; Text String Output (rw by Johnny_B[john@kolibrios.org]) - ; ebx x & y - ; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB ) - ; X = ABnnb: - ; nn = font - ; A = 0 <=> output esi characters; otherwise output ASCIIZ string - ; B = 1 <=> fill background with color eax - ; edx start of text - ; edi 1 force - -; // Alver 22.06.2008 // { +dtext: +; ebx x & y +; ecx style ( 0xX0000000 ) & color ( 0x00RRGGBB ) +; X = ABnnb: +; nn = font +; A = 0 <=> output esi characters; otherwise output ASCIIZ string +; B = 1 <=> fill background with color eax +; edx start of text +; edi 1 force or user area for redirect push eax xor eax, eax +;-------------------------------------- +align 4 .1: -; } \\ Alver \\ pushad - call [_display.disable_mouse] - movsx eax, bx ; eax=y sar ebx, 16 ; ebx=x xchg eax, ebx ; eax=x, ebx=y cmp esi, 255 jb .loop + mov esi, 255 +;-------------------------------------- +align 4 .loop: test ecx, ecx js .test_asciiz + dec esi js .end + jmp @f +;-------------------------------------- +align 4 .test_asciiz: cmp byte [edx], 0 jz .end -; // Alver 22.06.2008 // { + cmp byte [esp+28], 1 jne @f + dec esi js .end -; } \\ Alver \\ +;-------------------------------------- +align 4 @@: inc edx pushad movzx edx, byte [edx-1] test ecx, 0x10000000 jnz .font2 + mov esi, 9 lea ebp, [FONT_I+8*edx+edx] +;-------------------------------------- +align 4 .symloop1: mov dl, byte [ebp] or dl, 1 shl 6 +;-------------------------------------- +align 4 .pixloop1: shr dl, 1 jz .pixloop1end + jnc .nopix - call [putpixel] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area jmp .pixloop1cont +;-------------------------------------- +align 4 +@@: + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel + jmp .pixloop1cont +;-------------------------------------- +align 4 .nopix: test ecx, 0x40000000 jz .pixloop1cont + push ecx mov ecx, [esp+4+20h+20h] - call [putpixel] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area pop ecx + jmp .pixloop1cont +;-------------------------------------- +align 4 +@@: + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel + pop ecx +;-------------------------------------- +align 4 .pixloop1cont: inc eax jmp .pixloop1 +;-------------------------------------- +align 4 .pixloop1end: sub eax, 6 inc ebx inc ebp dec esi jnz .symloop1 + popad add eax, 6 jmp .loop +;-------------------------------------- +align 4 .font2: add edx, edx lea ebp, [FONT_II+4*edx+edx+1] push 9 movzx esi, byte [ebp-1] +;-------------------------------------- +align 4 .symloop2: mov dl, byte [ebp] push esi +;-------------------------------------- +align 4 .pixloop2: shr dl, 1 jnc .nopix2 - call [putpixel] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area jmp .pixloop2cont +;-------------------------------------- +align 4 +@@: + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel + jmp .pixloop2cont +;-------------------------------------- +align 4 .nopix2: test ecx, 0x40000000 jz .pixloop2cont + push ecx mov ecx, [esp+12+20h+20h] - call [putpixel] + + test ecx, 0x08000000 ; redirect the output to the user area + jz @f + + call draw_text_to_user_area pop ecx + jmp .pixloop2cont +;-------------------------------------- +align 4 +@@: + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel + pop ecx +;-------------------------------------- +align 4 .pixloop2cont: inc eax dec esi jnz .pixloop2 + pop esi sub eax, esi inc ebx inc ebp dec dword [esp] jnz .symloop2 + pop eax add dword [esp+28], esi popad jmp .loop +;-------------------------------------- +align 4 .end: popad - pop eax ; << // Alver 22.06.2008 // << + pop eax ret +;------------------------------------------------------------------------------ +; eax = x coordinate +; ebx = y coordinate +; ecx = ?? RR GG BB +; edi = user area +align 4 +draw_text_to_user_area: + pushad + imul ebx, [edi+0] + add eax, ebx + shl eax, 2 + add eax, edi + add eax, 8 + and ecx, 0xffffff + or ecx, 0xff000000 ; not transparent + mov [eax], ecx ; store pixel + popad + ret +;------------------------------------------------------------------------------ \ No newline at end of file diff --git a/kernel/branches/net/gui/mouse.inc b/kernel/branches/net/gui/mouse.inc index 009c40d102..fe430150cd 100644 --- a/kernel/branches/net/gui/mouse.inc +++ b/kernel/branches/net/gui/mouse.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2010. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2010-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ include 'mousepointer.inc' @@ -527,9 +527,12 @@ mouse._.find_sys_window_under_cursor: ;//////////////////////////////////////// ;< esi = process slot ;< edi = pointer to WDATA struct ;------------------------------------------------------------------------------ - mov esi, [Screen_Max_X] - inc esi - imul esi, [mouse.state.pos.y] +; mov esi, [Screen_Max_X] +; inc esi +; imul esi, [mouse.state.pos.y] + mov esi, [mouse.state.pos.y] + mov esi, [d_width_calc_area + esi*4] + add esi, [_WinMapAddress] add esi, [mouse.state.pos.x] movzx esi, byte[esi] @@ -565,22 +568,22 @@ mouse._.find_sys_button_under_cursor: ;//////////////////////////////////////// call mouse._.find_sys_window_under_cursor mov edx, esi - ; check if any process button contains cursor - mov eax, [BTN_ADDR] - mov ecx, [eax] - imul esi, ecx, sizeof.SYS_BUTTON - add esi, eax - inc ecx - add esi, sizeof.SYS_BUTTON - - .next_button: - dec ecx - jz .not_found - - add esi, -sizeof.SYS_BUTTON - - ; does it belong to our process? - cmp dx, [esi + SYS_BUTTON.pslot] + ; check if any process button contains cursor + mov eax, [BTN_ADDR] + mov ecx, [eax] + imul esi, ecx, sizeof.SYS_BUTTON + add esi, eax + inc ecx + add esi, sizeof.SYS_BUTTON + + .next_button: + dec ecx + jz .not_found + + add esi, -sizeof.SYS_BUTTON + + ; does it belong to our process? + cmp dx, [esi + SYS_BUTTON.pslot] jne .next_button ; does it contain cursor coordinates? diff --git a/kernel/branches/net/gui/mousepointer.inc b/kernel/branches/net/gui/mousepointer.inc index d1e0037587..e5c1393dd7 100644 --- a/kernel/branches/net/gui/mousepointer.inc +++ b/kernel/branches/net/gui/mousepointer.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; -;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; -;; Distributed under terms of the GNU General Public License ;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; +;; Distributed under terms of the GNU General Public License ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; $Revision: 2288 $ diff --git a/kernel/branches/net/gui/skincode.inc b/kernel/branches/net/gui/skincode.inc index e0c385aec5..59dc9c8074 100644 --- a/kernel/branches/net/gui/skincode.inc +++ b/kernel/branches/net/gui/skincode.inc @@ -1,17 +1,18 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ include "skindata.inc" ;skin_data = 0x00778000 - +;------------------------------------------------------------------------------ +align 4 read_skin_file: stdcall load_file, ebx test eax, eax @@ -21,6 +22,8 @@ read_skin_file: cmp ebx, 32*1024 jb @f mov ebx, 32*1024 +;-------------------------------------- +align 4 @@: lea ecx, [ebx+3] shr ecx, 2 @@ -32,16 +35,20 @@ read_skin_file: call parse_skin_data xor eax, eax ret +;-------------------------------------- +align 4 .notfound: xor eax, eax inc eax ret +;-------------------------------------- +align 4 .noskin: stdcall kernel_free, eax push 2 pop eax ret - +;------------------------------------------------------------------------------ struct SKIN_HEADER ident dd ? version dd ? @@ -81,13 +88,15 @@ struct SKIN_BITMAPS type dw ? data dd ? ends - +;------------------------------------------------------------------------------ +align 4 load_default_skin: mov [_skinh], 22 mov ebx, _skin_file_default call read_skin_file ret - +;------------------------------------------------------------------------------ +align 4 parse_skin_data: mov ebp, skin_data cmp [ebp+SKIN_HEADER.ident], 'SKIN' @@ -127,7 +136,9 @@ parse_skin_data: mov ebx, [ebp+SKIN_HEADER.bitmaps] add ebx, skin_data - .lp1: +;-------------------------------------- +align 4 +.lp1: cmp dword[ebx], 0 je .end_bitmaps movzx eax, [ebx+SKIN_BITMAPS.kind] @@ -139,9 +150,13 @@ parse_skin_data: or ecx, ecx jnz @f mov edx, skin_inactive.left.data - @@: +;-------------------------------------- +align 4 +@@: jmp .next_bitmap - .not_left: +;-------------------------------------- +align 4 +.not_left: dec eax jnz .not_oper mov esi, [ebx+SKIN_BITMAPS.data] @@ -152,9 +167,13 @@ parse_skin_data: or ecx, ecx jnz @f mov edx, skin_inactive.oper.data - @@: +;-------------------------------------- +align 4 +@@: jmp .next_bitmap - .not_oper: +;-------------------------------------- +align 4 +.not_oper: dec eax jnz .not_base mov eax, [skin_active.left.width] @@ -163,12 +182,18 @@ parse_skin_data: jnz @f mov eax, [skin_inactive.left.width] mov edx, skin_inactive.base.data - @@: +;-------------------------------------- +align 4 +@@: jmp .next_bitmap - .not_base: +;-------------------------------------- +align 4 +.not_base: add ebx, 8 jmp .lp1 - .next_bitmap: +;-------------------------------------- +align 4 +.next_bitmap: mov ecx, [ebx+SKIN_BITMAPS.data] add ecx, skin_data mov [edx+4], eax @@ -178,11 +203,14 @@ parse_skin_data: mov [edx+0], ecx add ebx, 8 jmp .lp1 - .end_bitmaps: - +;-------------------------------------- +align 4 +.end_bitmaps: mov ebx, [ebp+SKIN_HEADER.buttons] add ebx, skin_data - .lp2: +;-------------------------------------- +align 4 +.lp2: cmp dword[ebx], 0 je .end_buttons mov eax, [ebx+SKIN_BUTTONS.type] @@ -190,15 +218,21 @@ parse_skin_data: jnz .not_close mov edx, skin_btn_close jmp .next_button - .not_close: +;-------------------------------------- +align 4 +.not_close: dec eax jnz .not_minimize mov edx, skin_btn_minimize jmp .next_button - .not_minimize: +;-------------------------------------- +align 4 +.not_minimize: add ebx, 12 jmp .lp2 - .next_button: +;-------------------------------------- +align 4 +.next_button: movsx eax, [ebx+SKIN_BUTTONS.left] mov [edx+SKIN_BUTTON.left], eax movsx eax, [ebx+SKIN_BUTTONS.top] @@ -209,26 +243,22 @@ parse_skin_data: mov [edx+SKIN_BUTTON.height], eax add ebx, 12 jmp .lp2 - .end_buttons: - - .exit: +;-------------------------------------- +align 4 +.end_buttons: +.exit: ret - -sys_putimage_with_check: - or ebx, ebx - jz @f - call sys_putimage.forced - @@: - ret - +;------------------------------------------------------------------------------ +align 4 drawwindow_IV_caption: mov ebp, skin_active or al, al jnz @f mov ebp, skin_inactive - @@: - +;-------------------------------------- +align 4 +@@: mov esi, [esp+4] mov eax, [esi+WDATA.box.width] ; window width mov edx, [ebp+SKIN_DATA.left.left] @@ -238,8 +268,12 @@ drawwindow_IV_caption: add ecx, [_skinh] mov ebx, [ebp+SKIN_DATA.left.data] - call sys_putimage_with_check - + or ebx, ebx + jz @f + call sys_putimage.forced +;-------------------------------------- +align 4 +@@: mov esi, [esp+4] mov eax, [esi+WDATA.box.width] sub eax, [ebp+SKIN_DATA.left.width] @@ -260,18 +294,28 @@ drawwindow_IV_caption: mov edx, [ebp+SKIN_DATA.base.left] sub edx, [ebp+SKIN_DATA.base.width] shl edx, 16 - .baseskinloop: +;-------------------------------------- +align 4 +.baseskinloop: shr edx, 16 add edx, [ebp+SKIN_DATA.base.width] shl edx, 16 push eax ebx ecx edx - call sys_putimage_with_check + + or ebx, ebx + jz @f + call sys_putimage.forced +;-------------------------------------- +align 4 +@@: pop edx ecx ebx eax dec eax jnz .baseskinloop - .non_base: +;-------------------------------------- +align 4 +.non_base: mov esi, [esp+4] mov edx, [esi+WDATA.box.width] @@ -283,16 +327,18 @@ drawwindow_IV_caption: mov ecx, [ebp+SKIN_DATA.oper.width] shl ecx, 16 add ecx, [_skinh] - call sys_putimage_with_check + or ebx, ebx + jz @f + call sys_putimage.forced +;-------------------------------------- +align 4 +@@: ret - -;//mike.dld, 2006-08-02 ] - - +;------------------------------------------------------------------------------ +align 4 drawwindow_IV: ;param1 - aw_yes - pusha push edx @@ -303,8 +349,9 @@ drawwindow_IV: cmp byte [esp+32+4+4], 0 jne @f mov ebp, skin_inactive - @@: - +;-------------------------------------- +align 4 +@@: mov eax, [edi+WDATA.box.left] shl eax, 16 mov ax, word [edi+WDATA.box.left] @@ -313,32 +360,42 @@ drawwindow_IV: shl ebx, 16 mov bx, word [edi+WDATA.box.top] add bx, word [edi+WDATA.box.height] -; mov esi,[edi+24] -; shr esi,1 -; and esi,0x007f7f7f mov esi, [ebp+SKIN_DATA.colors.outer] + or esi, 1 shl 25 ; 0x02000000 used for draw_rectangle without top line + ror ebx, 16 + add ebx, [_skinh] + sub bx, 1 + rol ebx, 16 call draw_rectangle mov ecx, 3 - _dw3l: +;-------------------------------------- +align 4 +_dw3l: add eax, 1*65536-1 - add ebx, 1*65536-1 + add ebx, 0*65536-1 test ax, ax js no_skin_add_button test bx, bx js no_skin_add_button mov esi, [ebp+SKIN_DATA.colors.frame];[edi+24] + or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line call draw_rectangle dec ecx jnz _dw3l mov esi, [ebp+SKIN_DATA.colors.inner] + or esi, 1 shl 25; 0x02000000 used for draw_rectangle without top line add eax, 1*65536-1 - add ebx, 1*65536-1 + add ebx, 0*65536-1 test ax, ax js no_skin_add_button test bx, bx js no_skin_add_button + test [edi + WDATA.fl_wstate], WSTATE_ROLLEDUP + jnz @f call draw_rectangle - +;-------------------------------------- +align 4 +@@: cmp dword[skin_data], 'SKIN' je @f xor eax, eax @@ -348,15 +405,17 @@ drawwindow_IV: inc ecx mov edx, [_skinh] mov edi, [common_colours+4]; standard grab color - call [drawbar] +; call [drawbar] + call vesa20_drawbar jmp draw_clientbar - @@: - +;-------------------------------------- +align 4 +@@: mov al, [esp+32+4+4] call drawwindow_IV_caption - - draw_clientbar: - +;-------------------------------------- +align 4 +draw_clientbar: mov esi, [esp] mov edx, [esi+WDATA.box.top] ; WORK AREA @@ -374,12 +433,13 @@ drawwindow_IV: mov edi, [esi+WDATA.cl_workarea] test edi, 0x40000000 jnz _noinside2 - call [drawbar] - _noinside2: - +; call [drawbar] + call vesa20_drawbar +;-------------------------------------- +align 4 +_noinside2: cmp dword[skin_data], 'SKIN' jne no_skin_add_button - ;* close button mov edi, [BTN_ADDR] movzx eax, word [edi] @@ -404,7 +464,9 @@ drawwindow_IV: mov ebx, [esp] mov ebx, [ebx+WDATA.box.width] inc ebx - _bCx_at_right: +;-------------------------------------- +align 4 +_bCx_at_right: add ebx, [skin_btn_close.left] mov [eax], bx add eax, 2 ; x size @@ -418,7 +480,6 @@ drawwindow_IV: mov ebx, [skin_btn_close.height] dec ebx mov [eax], bx - ;* minimize button mov edi, [BTN_ADDR] movzx eax, word [edi] @@ -443,7 +504,9 @@ drawwindow_IV: mov ebx, [esp] mov ebx, [ebx+WDATA.box.width] inc ebx - _bMx_at_right: +;-------------------------------------- +align 4 +_bMx_at_right: add ebx, [skin_btn_minimize.left] mov [eax], bx add eax, 2 ; x size @@ -457,10 +520,10 @@ drawwindow_IV: mov ebx, [skin_btn_minimize.height] dec ebx mov [eax], bx - - no_skin_add_button: +;-------------------------------------- +align 4 +no_skin_add_button: pop edi popa - ret 4 - +;------------------------------------------------------------------------------ diff --git a/kernel/branches/net/gui/skindata.inc b/kernel/branches/net/gui/skindata.inc index 5a88916cfe..645bd7bc1a 100644 --- a/kernel/branches/net/gui/skindata.inc +++ b/kernel/branches/net/gui/skindata.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; diff --git a/kernel/branches/net/gui/window.inc b/kernel/branches/net/gui/window.inc index ae626d94c9..c2172f0dbf 100644 --- a/kernel/branches/net/gui/window.inc +++ b/kernel/branches/net/gui/window.inc @@ -1,12 +1,12 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2010. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;============================================================================== ;///// public functions /////////////////////////////////////////////////////// @@ -43,10 +43,7 @@ syscall_draw_window: ;///// system function 0 ///////////////////////////////// jae .exit push eax - inc [mouse_pause] - call [_display.disable_mouse] call window._.sys_set_window - call [_display.disable_mouse] pop eax or al, al @@ -55,18 +52,20 @@ syscall_draw_window: ;///// system function 0 ///////////////////////////////// ; type I - original style call drawwindow_I jmp window._.draw_window_caption.2 - - @@: +;-------------------------------------- +align 4 +@@: dec al jnz @f ; type II - only reserve area, no draw - call sys_window_mouse - dec [mouse_pause] - call [draw_pointer] +; call sys_window_mouse +; call [draw_pointer] + call __sys_draw_pointer jmp .exit - - @@: +;-------------------------------------- +align 4 +@@: dec al jnz @f @@ -75,7 +74,9 @@ syscall_draw_window: ;///// system function 0 ///////////////////////////////// jmp window._.draw_window_caption.2 ; type IV & V - skinned window (resizable & not) - @@: +;-------------------------------------- +align 4 +@@: mov eax, [TASK_COUNT] movzx eax, word[WIN_POS + eax * 2] cmp eax, [CURRENT_TASK] @@ -84,10 +85,11 @@ syscall_draw_window: ;///// system function 0 ///////////////////////////////// push eax call drawwindow_IV jmp window._.draw_window_caption.2 - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ syscall_display_settings: ;///// system function 48 /////////////////////////// @@ -136,10 +138,11 @@ syscall_display_settings: ;///// system function 48 /////////////////////////// cmp ebx, .sizeof.ftable / 4 ja @f jmp [.ftable + ebx * 4] - @@: +;-------------------------------------- +align 4 +@@: ret - - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.00: xor eax, eax @@ -149,10 +152,11 @@ syscall_display_settings.00: mov [windowtypechanged], eax jmp syscall_display_settings._.redraw_whole_screen - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.01: and ecx, 1 @@ -160,10 +164,11 @@ syscall_display_settings.01: je .exit mov [buttontype], ecx mov [windowtypechanged], ebx - +;-------------------------------------- +align 4 .exit: ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.02: dec ebx @@ -174,7 +179,7 @@ syscall_display_settings.02: rep movsb mov [windowtypechanged], ebx ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.03: mov edi, ecx @@ -183,13 +188,13 @@ syscall_display_settings.03: mov ecx, edx rep movsb ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.04: mov eax, [_skinh] mov [esp + 32], eax ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.05: mov eax, [screen_workarea.left - 2] @@ -199,7 +204,7 @@ syscall_display_settings.05: mov ax, word[screen_workarea.bottom] mov [esp + 20], eax ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.06: xor esi, esi @@ -214,15 +219,20 @@ syscall_display_settings.06: or eax, eax jge @f xor eax, eax - @@: +;-------------------------------------- +align 4 +@@: mov [screen_workarea.left], eax cmp ebx, edi jle @f mov ebx, edi - @@: +;-------------------------------------- +align 4 +@@: mov [screen_workarea.right], ebx - - .check_horizontal: +;-------------------------------------- +align 4 +.check_horizontal: mov edi, [Screen_Max_Y] mov eax, edx movsx ebx, ax @@ -233,24 +243,30 @@ syscall_display_settings.06: or eax, eax jge @f xor eax, eax - @@: +;-------------------------------------- +align 4 +@@: mov [screen_workarea.top], eax cmp ebx, edi jle @f mov ebx, edi - @@: +;-------------------------------------- +align 4 +@@: mov [screen_workarea.bottom], ebx - - .check_if_redraw_needed: +;-------------------------------------- +align 4 +.check_if_redraw_needed: or esi, esi jz .exit call repos_windows jmp syscall_display_settings._.calculate_whole_screen - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.07: mov eax, [_skinmargins + 0] @@ -258,7 +274,7 @@ syscall_display_settings.07: mov eax, [_skinmargins + 4] mov [esp + 20], eax ret - +;------------------------------------------------------------------------------ align 4 syscall_display_settings.08: mov ebx, ecx @@ -269,17 +285,20 @@ syscall_display_settings.08: call syscall_display_settings._.calculate_whole_screen jmp syscall_display_settings._.redraw_whole_screen - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ +align 4 syscall_display_settings._.calculate_whole_screen: xor eax, eax xor ebx, ebx mov ecx, [Screen_Max_X] mov edx, [Screen_Max_Y] jmp calculatescreen - +;------------------------------------------------------------------------------ +align 4 syscall_display_settings._.redraw_whole_screen: xor eax, eax mov [draw_limits.left], eax @@ -290,7 +309,7 @@ syscall_display_settings._.redraw_whole_screen: mov [draw_limits.bottom], eax mov eax, window_data jmp redrawscreen - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ syscall_set_window_shape: ;///// system function 50 /////////////////////////// @@ -308,15 +327,17 @@ syscall_set_window_shape: ;///// system function 50 /////////////////////////// test ebx, ebx jne .shape_scale mov [edi + APPDATA.wnd_shape], ecx - - .shape_scale: +;-------------------------------------- +align 4 +.shape_scale: dec ebx jnz .exit mov [edi + APPDATA.wnd_shape_scale], ecx - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ syscall_move_window: ;///// system function 67 //////////////////////////////// @@ -336,20 +357,27 @@ syscall_move_window: ;///// system function 67 //////////////////////////////// cmp ebx, -1 jne @f mov ebx, [edi + WDATA.box.left] - @@: +;-------------------------------------- +align 4 +@@: cmp ecx, -1 jne @f mov ecx, [edi + WDATA.box.top] - @@: +;-------------------------------------- +align 4 +@@: cmp edx, -1 jne @f mov edx, [edi + WDATA.box.width] - @@: +;-------------------------------------- +align 4 +@@: cmp esi, -1 jne @f mov esi, [edi + WDATA.box.height] - - @@: +;-------------------------------------- +align 4 +@@: push esi edx ecx ebx mov eax, esp mov bl, [edi + WDATA.fl_wstate] @@ -363,10 +391,11 @@ syscall_move_window: ;///// system function 67 //////////////////////////////// ; NOTE: do we really need this? to be reworked ; call [draw_pointer] - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ syscall_window_settings: ;///// system function 71 ///////////////////////////// @@ -395,12 +424,13 @@ syscall_window_settings: ;///// system function 71 ///////////////////////////// ; jnz .exit_fail ; not implemented yet - - .exit_fail: +;-------------------------------------- +align 4 +.exit_fail: xor eax, eax inc eax ; eax = 1 (fail) ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ set_window_defaults: ;///////////////////////////////////////////////////////// @@ -411,7 +441,9 @@ set_window_defaults: ;///////////////////////////////////////////////////////// push eax ecx xor eax, eax mov ecx, WIN_STACK - @@: +;-------------------------------------- +align 4 +@@: inc eax add ecx, 2 ; process no @@ -422,7 +454,7 @@ set_window_defaults: ;///////////////////////////////////////////////////////// jne @b pop ecx eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ calculatescreen: ;///////////////////////////////////////////////////////////// @@ -449,8 +481,9 @@ calculatescreen: ;///////////////////////////////////////////////////////////// jbe .exit push edx ecx ebx eax - - .next_window: +;-------------------------------------- +align 4 +.next_window: movzx edi, word[WIN_POS + esi * 2] shl edi, 5 @@ -479,38 +512,48 @@ calculatescreen: ;///////////////////////////////////////////////////////////// cmp eax, [esp + RECT.left] jae @f mov eax, [esp + RECT.left] - @@: +;-------------------------------------- +align 4 +@@: cmp ebx, [esp + RECT.top] jae @f mov ebx, [esp + RECT.top] - @@: +;-------------------------------------- +align 4 +@@: cmp ecx, [esp + RECT.right] jbe @f mov ecx, [esp + RECT.right] - @@: +;-------------------------------------- +align 4 +@@: cmp edx, [esp + RECT.bottom] jbe @f mov edx, [esp + RECT.bottom] - - @@: +;-------------------------------------- +align 4 +@@: push esi movzx esi, word[WIN_POS + esi * 2] call window._.set_screen pop esi - - .skip_window: +;-------------------------------------- +align 4 +.skip_window: inc esi dec ebp jnz .next_window pop eax ebx ecx edx - - .exit: +;-------------------------------------- +align 4 +.exit: pop ebp + inc [_display.mask_seqno] popfd pop esi ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ repos_windows: ;/////////////////////////////////////////////////////////////// @@ -522,8 +565,9 @@ repos_windows: ;/////////////////////////////////////////////////////////////// call force_redraw_background dec ecx jle .exit - - .next_window: +;-------------------------------------- +align 4 +.next_window: mov [edi + WDATA.fl_redraw], 1 test [edi + WDATA.fl_wstate], WSTATE_MAXIMIZED jnz .fix_maximized @@ -537,11 +581,14 @@ repos_windows: ;/////////////////////////////////////////////////////////////// sub eax, ebx jle @f mov [edi + WDATA.box.width], ebx - @@: +;-------------------------------------- +align 4 +@@: sub ebx, [edi + WDATA.box.width] mov [edi + WDATA.box.left], ebx - - .fix_vertical: +;-------------------------------------- +align 4 +.fix_vertical: mov eax, [edi + WDATA.box.top] add eax, [edi + WDATA.box.height] mov ebx, [Screen_Max_Y] @@ -551,12 +598,24 @@ repos_windows: ;/////////////////////////////////////////////////////////////// sub eax, ebx jle @f mov [edi + WDATA.box.height], ebx - @@: +;-------------------------------------- +align 4 +@@: sub ebx, [edi + WDATA.box.height] mov [edi + WDATA.box.top], ebx - jmp .fix_client_box - - .fix_maximized: +;-------------------------------------- +align 4 +.fix_client_box: + call window._.set_window_clientbox + add edi, sizeof.WDATA + loop .next_window +;-------------------------------------- +align 4 +.exit: + ret +;-------------------------------------- +align 4 +.fix_maximized: mov eax, [screen_workarea.left] mov [edi + WDATA.box.left], eax sub eax, [screen_workarea.right] @@ -569,19 +628,11 @@ repos_windows: ;/////////////////////////////////////////////////////////////// sub eax, [screen_workarea.bottom] neg eax mov [edi + WDATA.box.height], eax - - .fix_client_box: - call window._.set_window_clientbox - - add edi, sizeof.WDATA - loop .next_window - - .exit: - ret - -align 4 + jmp .fix_client_box ;------------------------------------------------------------------------------ -sys_window_mouse: ;//////////////////////////////////////////////////////////// +;align 4 +;------------------------------------------------------------------------------ +;sys_window_mouse: ;//////////////////////////////////////////////////////////// ;------------------------------------------------------------------------------ ;? ;------------------------------------------------------------------------------ @@ -600,8 +651,8 @@ sys_window_mouse: ;//////////////////////////////////////////////////////////// ; ; .exit: ; pop eax - ret - +; ret +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ draw_rectangle: ;////////////////////////////////////////////////////////////// @@ -609,28 +660,38 @@ draw_rectangle: ;////////////////////////////////////////////////////////////// ;> eax = pack[16(left), 16(right)] ;> ebx = pack[16(top), 16(bottom)] ;> esi = color +; ?? RR GG BB ; 0x01000000 negation +; ; 0x02000000 used for draw_rectangle without top line +; ; for example drawwindow_III and drawwindow_IV ;------------------------------------------------------------------------------ push eax ebx ecx edi xor edi, edi - - .flags_set: +;-------------------------------------- +align 4 +.flags_set: push ebx ; set line color mov ecx, esi - ; draw top border rol ebx, 16 push ebx rol ebx, 16 pop bx - call [draw_line] - + test ecx, 1 shl 25 + jnz @f + sub ecx, 1 shl 25 +; call [draw_line] + call __sys_draw_line +;-------------------------------------- +align 4 +@@: ; draw bottom border mov ebx, [esp - 2] pop bx - call [draw_line] +; call [draw_line] + call __sys_draw_line pop ebx add ebx, 1 * 65536 - 1 @@ -640,22 +701,25 @@ draw_rectangle: ;////////////////////////////////////////////////////////////// push eax rol eax, 16 pop ax - call [draw_line] +; call [draw_line] + call __sys_draw_line ; draw right border mov eax, [esp - 2] pop ax - call [draw_line] +; call [draw_line] + call __sys_draw_line pop edi ecx ebx eax ret - - .forced: +;-------------------------------------- +align 4 +.forced: push eax ebx ecx edi xor edi, edi inc edi jmp .flags_set - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ drawwindow_I_caption: ;//////////////////////////////////////////////////////// @@ -674,12 +738,15 @@ drawwindow_I_caption: ;//////////////////////////////////////////////////////// cmp ebx, eax jbe @f mov ebx, eax - @@: +;-------------------------------------- +align 4 +@@: push ebx xor edi, edi - - .next_line: +;-------------------------------------- +align 4 +.next_line: mov ebx, edx shl ebx, 16 add ebx, edx @@ -694,9 +761,12 @@ drawwindow_I_caption: ;//////////////////////////////////////////////////////// jz @f sub ecx, 0x00040404 mov [esi + WDATA.cl_titlebar], ecx - @@: +;-------------------------------------- +align 4 +@@: and ecx, 0x00ffffff - call [draw_line] +; call [draw_line] + call __sys_draw_line inc edx cmp edx, [esp] jb .next_line @@ -704,7 +774,7 @@ drawwindow_I_caption: ;//////////////////////////////////////////////////////// add esp, 4 pop [esi + WDATA.cl_titlebar] ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ drawwindow_I: ;//////////////////////////////////////////////////////////////// @@ -749,12 +819,14 @@ drawwindow_I: ;//////////////////////////////////////////////////////////////// mov ebx, 21 mov ecx, [esi + WDATA.box.width] mov edx, [esi + WDATA.box.height] - call [drawbar] - - .exit: +; call [drawbar] + call vesa20_drawbar +;-------------------------------------- +align 4 +.exit: popad ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ drawwindow_III_caption: ;///////////////////////////////////////////////////// @@ -774,12 +846,15 @@ drawwindow_III_caption: ;///////////////////////////////////////////////////// cmp ebx, eax jb @f mov ebx, eax - @@: +;-------------------------------------- +align 4 +@@: push ebx xor edi, edi - - .next_line: +;-------------------------------------- +align 4 +.next_line: mov ebx, edx shl ebx, 16 add ebx, edx @@ -792,14 +867,19 @@ drawwindow_III_caption: ;///////////////////////////////////////////////////// test ecx, 0x40000000 jz @f add ecx, 0x00040404 - @@: +;-------------------------------------- +align 4 +@@: test ecx, 0x80000000 jz @f sub ecx, 0x00040404 - @@: +;-------------------------------------- +align 4 +@@: mov [esi + WDATA.cl_titlebar], ecx and ecx, 0x00ffffff - call [draw_line] +; call [draw_line] + call __sys_draw_line inc edx cmp edx, [esp] jb .next_line @@ -807,7 +887,7 @@ drawwindow_III_caption: ;///////////////////////////////////////////////////// add esp, 4 pop [esi + WDATA.cl_titlebar] ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ drawwindow_III: ;////////////////////////////////////////////////////////////// @@ -833,8 +913,9 @@ drawwindow_III: ;////////////////////////////////////////////////////////////// push esi mov ecx, 3 mov esi, [edx + WDATA.cl_frames] - - .next_frame: +;-------------------------------------- +align 4 +.next_frame: add eax, 1 * 65536 - 1 add ebx, 1 * 65536 - 1 call draw_rectangle @@ -872,12 +953,14 @@ drawwindow_III: ;////////////////////////////////////////////////////////////// mov edx, [esi + WDATA.box.height] sub ecx, 4 sub edx, 4 - call [drawbar] - - .exit: +; call [drawbar] + call vesa20_drawbar +;-------------------------------------- +align 4 +.exit: popad ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ waredraw: ;//////////////////////////////////////////////////////////////////// @@ -919,26 +1002,28 @@ waredraw: ;//////////////////////////////////////////////////////////////////// mov edi, [TASK_COUNT] movzx esi, word[WIN_POS + edi * 2] call window._.set_screen + inc [_display.mask_seqno] popad ; tell application to redraw itself mov [edi + WDATA.fl_redraw], 1 xor eax, eax jmp .exit - - .do_not_draw: +;-------------------------------------- +align 4 +.do_not_draw: ; no it's not, just activate the window call window._.window_activate xor eax, eax mov byte[MOUSE_BACKGROUND], al mov byte[DONT_DRAW_MOUSE], al - - - .exit: +;-------------------------------------- +align 4 +.exit: mov byte[MOUSE_DOWN], 0 inc eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ minimize_window: ;///////////////////////////////////////////////////////////// @@ -978,12 +1063,13 @@ minimize_window: ;///////////////////////////////////////////////////////////// call redrawscreen pop esi edx ecx ebx eax - - .exit: +;-------------------------------------- +align 4 +.exit: popfd pop edi ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ restore_minimized_window: ;//////////////////////////////////////////////////// @@ -1011,7 +1097,9 @@ restore_minimized_window: ;//////////////////////////////////////////////////// cmp eax, [TASK_COUNT] jz @f mov ebp, calculatescreen - @@: +;-------------------------------------- +align 4 +@@: mov eax, [edi + WDATA.box.left] mov ebx, [edi + WDATA.box.top] mov ecx, [edi + WDATA.box.width] @@ -1019,14 +1107,15 @@ restore_minimized_window: ;//////////////////////////////////////////////////// add ecx, eax add edx, ebx call ebp - + inc [_display.mask_seqno] mov byte[MOUSE_BACKGROUND], 0 - - .exit: +;-------------------------------------- +align 4 +.exit: popfd popad ret - +;------------------------------------------------------------------------------ align 4 ; TODO: remove this proc ;------------------------------------------------------------------------------ @@ -1046,13 +1135,15 @@ window_check_events: ;///////////////////////////////////////////////////////// jnz @f call minimize_window jmp .exit - - @@: +;-------------------------------------- +align 4 +@@: call restore_minimized_window - - .exit: +;-------------------------------------- +align 4 +.exit: ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ sys_window_maximize_handler: ;///////////////////////////////////////////////// @@ -1089,8 +1180,9 @@ sys_window_maximize_handler: ;///////////////////////////////////////////////// sub [esp + BOX.height], ecx mov eax, esp jmp .set_box - - .restore_size: +;-------------------------------------- +align 4 +.restore_size: mov eax, esi shl eax, 8 add eax, SLOT_BASE + APPDATA.saved_box @@ -1099,8 +1191,9 @@ sys_window_maximize_handler: ;///////////////////////////////////////////////// [eax + BOX.top] \ [eax + BOX.left] mov eax, esp - - .set_box: +;-------------------------------------- +align 4 +.set_box: test bl, WSTATE_ROLLEDUP jz @f @@ -1108,14 +1201,17 @@ sys_window_maximize_handler: ;///////////////////////////////////////////////// call window._.get_rolledup_height mov [ecx + BOX.height], eax xchg eax, ecx - - @@: +;-------------------------------------- +align 4 +@@: call window._.set_window_box add esp, sizeof.BOX - - .exit: +;-------------------------------------- +align 4 +.exit: + inc [_display.mask_seqno] ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ sys_window_rollup_handler: ;/////////////////////////////////////////////////// @@ -1143,15 +1239,17 @@ sys_window_rollup_handler: ;/////////////////////////////////////////////////// [edi + WDATA.box.left] mov eax, esp jmp .set_box - - .restore_size: +;-------------------------------------- +align 4 +.restore_size: test bl, WSTATE_MAXIMIZED jnz @f add esp, -sizeof.BOX lea eax, [edx + APPDATA.saved_box] jmp .set_box - - @@: +;-------------------------------------- +align 4 +@@: mov eax, [screen_workarea.top] push [screen_workarea.bottom] \ [edi + WDATA.box.width] \ @@ -1159,13 +1257,13 @@ sys_window_rollup_handler: ;/////////////////////////////////////////////////// [edi + WDATA.box.left] sub [esp + BOX.height], eax mov eax, esp - - .set_box: +;-------------------------------------- +align 4 +.set_box: call window._.set_window_box add esp, sizeof.BOX - ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ sys_window_start_moving_handler: ;///////////////////////////////////////////// @@ -1177,9 +1275,8 @@ sys_window_start_moving_handler: ;///////////////////////////////////////////// ;------------------------------------------------------------------------------ mov edi, eax call window._.draw_negative_box - ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ sys_window_end_moving_handler: ;/////////////////////////////////////////////// @@ -1201,7 +1298,7 @@ sys_window_end_moving_handler: ;/////////////////////////////////////////////// mov bl, [edi + WDATA.fl_wstate] call window._.set_window_box ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ sys_window_moving_handler: ;/////////////////////////////////////////////////// @@ -1217,7 +1314,6 @@ sys_window_moving_handler: ;/////////////////////////////////////////////////// mov edi, ebx call window._.draw_negative_box ret - ;============================================================================== ;///// private functions ////////////////////////////////////////////////////// ;============================================================================== @@ -1240,7 +1336,7 @@ endg ; to be reworked ; new_window_starting dd ? ;endg - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.invalidate_screen: ;////////////////////////////////////////////////// @@ -1255,38 +1351,17 @@ window._.invalidate_screen: ;////////////////////////////////////////////////// ; TODO: do we really need `draw_limits`? ; Yes, they are used by background drawing code. - mov ecx, [eax + BOX.left] - mov edx, [ebx + BOX.left] - cmp ecx, edx - jle @f - mov ecx, edx - @@: - mov [draw_limits.left], ecx - mov ecx, [eax + BOX.left] - add ecx, [eax + BOX.width] - add edx, [ebx + BOX.width] - cmp ecx, edx - jae @f - mov ecx, edx - @@: - mov [draw_limits.right], ecx - mov ecx, [eax + BOX.top] - mov edx, [ebx + BOX.top] - cmp ecx, edx - jle @f - mov ecx, edx - @@: - mov [draw_limits.top], ecx - mov ecx, [eax + BOX.top] - add ecx, [eax + BOX.height] - add edx, [ebx + BOX.height] - cmp ecx, edx - jae @f - mov ecx, edx - @@: - mov [draw_limits.bottom], ecx - ; recalculate screen buffer at old position +; we need only to restore the background windows at the old place! + mov ecx, [ebx + BOX.left] + mov [draw_limits.left], ecx + add ecx, [ebx + BOX.width] + mov [draw_limits.right], ecx + mov ecx, [ebx + BOX.top] + mov [draw_limits.top], ecx + add ecx, [ebx + BOX.height] + mov [draw_limits.bottom], ecx +; recalculate screen buffer at old position push ebx mov edx, [eax + BOX.height] mov ecx, [eax + BOX.width] @@ -1296,8 +1371,7 @@ window._.invalidate_screen: ;////////////////////////////////////////////////// add edx, ebx call calculatescreen pop eax - - ; recalculate screen buffer at new position +; recalculate screen buffer at new position mov edx, [eax + BOX.height] mov ecx, [eax + BOX.width] mov ebx, [eax + BOX.top] @@ -1314,7 +1388,7 @@ window._.invalidate_screen: ;////////////////////////////////////////////////// pop ebx eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.set_window_box: ;///////////////////////////////////////////////////// @@ -1339,10 +1413,10 @@ end if repz cmpsd pop edi jz .exit +;-------------------------------------- +align 4 @@: - add esp, -sizeof.BOX - mov ebx, esp if WDATA.box lea esi, [edi + WDATA.box] @@ -1391,11 +1465,12 @@ end if jnz .exit mov [eax + APPDATA.saved_box.height], edx - - .exit: +;-------------------------------------- +align 4 +.exit: pop esi ebx eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.set_window_clientbox: ;/////////////////////////////////////////////// @@ -1436,8 +1511,9 @@ window._.set_window_clientbox: ;/////////////////////////////////////////////// mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax add esp, 4 jmp .exit - - .whole_window: +;-------------------------------------- +align 4 +.whole_window: xor eax, eax mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.left], eax mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.top], eax @@ -1445,11 +1521,12 @@ window._.set_window_clientbox: ;/////////////////////////////////////////////// mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.width], eax mov eax, [ecx + WDATA.box.height] mov [edi + SLOT_BASE + APPDATA.wnd_clientbox.height], eax - - .exit: +;-------------------------------------- +align 4 +.exit: pop edi ecx eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.sys_set_window: ;///////////////////////////////////////////////////// @@ -1473,7 +1550,10 @@ window._.sys_set_window: ;///////////////////////////////////////////////////// test [edi + WDATA.fl_wdrawn], 1 jnz .set_client_box or [edi + WDATA.fl_wdrawn], 1 - +; After first draw_window we need redraw mouse necessarily! +; Otherwise the user can see cursor specified by f.37.5 from another window. +; He will be really unhappy! He is terrible in rage - usually he throws stones! + mov [redrawmouse_unconditional], 1 ; NOTE: commented out since doesn't provide necessary functionality ; anyway, to be reworked ; mov eax, [timer_ticks] ; [0xfdf0] @@ -1508,8 +1588,9 @@ window._.sys_set_window: ;///////////////////////////////////////////////////// je @f xor eax, eax - - @@: +;-------------------------------------- +align 4 +@@: mov [edi + APPDATA.wnd_caption], eax mov esi, [esp] @@ -1536,8 +1617,9 @@ window._.sys_set_window: ;///////////////////////////////////////////////////// mov byte[KEY_COUNT], 0 ; empty keyboard buffer mov byte[BTN_COUNT], 0 ; empty button buffer - - .set_client_box: +;-------------------------------------- +align 4 +.set_client_box: ; update window client box coordinates call window._.set_window_clientbox @@ -1545,7 +1627,7 @@ window._.sys_set_window: ;///////////////////////////////////////////////////// mov [edi + WDATA.fl_redraw], 0 mov edx, edi ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.check_window_position: ;////////////////////////////////////////////// @@ -1564,62 +1646,72 @@ window._.check_window_position: ;////////////////////////////////////////////// mov esi, [Screen_Max_X] cmp ecx, esi ja .fix_width_high - - .check_left: +;-------------------------------------- +align 4 +.check_left: or eax, eax jl .fix_left_low add eax, ecx cmp eax, esi jg .fix_left_high - - .check_height: +;-------------------------------------- +align 4 +.check_height: mov esi, [Screen_Max_Y] cmp edx, esi ja .fix_height_high - - .check_top: +;-------------------------------------- +align 4 +.check_top: or ebx, ebx jl .fix_top_low add ebx, edx cmp ebx, esi jg .fix_top_high - - .exit: +;-------------------------------------- +align 4 +.exit: pop esi edx ecx ebx eax ret - - .fix_width_high: +;-------------------------------------- +align 4 +.fix_width_high: mov ecx, esi mov [edi + WDATA.box.width], esi jmp .check_left - - .fix_left_low: +;-------------------------------------- +align 4 +.fix_left_low: xor eax, eax mov [edi + WDATA.box.left], eax jmp .check_height - - .fix_left_high: +;-------------------------------------- +align 4 +.fix_left_high: mov eax, esi sub eax, ecx mov [edi + WDATA.box.left], eax jmp .check_height - - .fix_height_high: +;-------------------------------------- +align 4 +.fix_height_high: mov edx, esi mov [edi + WDATA.box.height], esi jmp .check_top - - .fix_top_low: +;-------------------------------------- +align 4 +.fix_top_low: xor ebx, ebx mov [edi + WDATA.box.top], ebx jmp .exit - - .fix_top_high: +;-------------------------------------- +align 4 +.fix_top_high: mov ebx, esi sub ebx, edx mov [edi + WDATA.box.top], ebx jmp .exit - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.get_titlebar_height: ;//////////////////////////////////////////////// @@ -1634,10 +1726,12 @@ window._.get_titlebar_height: ;//////////////////////////////////////////////// jne @f mov eax, [_skinh] ret - @@: +;-------------------------------------- +align 4 +@@: mov eax, 21 ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.get_rolledup_height: ;//////////////////////////////////////////////// @@ -1653,15 +1747,19 @@ window._.get_rolledup_height: ;//////////////////////////////////////////////// mov eax, [_skinh] add eax, 3 ret - @@: +;-------------------------------------- +align 4 +@@: or al, al jnz @f mov eax, 21 ret - @@: +;-------------------------------------- +align 4 +@@: mov eax, 21 + 2 ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.set_screen: ;///////////////////////////////////////////////////////// @@ -1693,8 +1791,9 @@ end virtual jnz .check_for_shaped_window cmp [window_data + edi + WDATA.box.height], 0 jz .exit - - .check_for_shaped_window: +;-------------------------------------- +align 4 +.check_for_shaped_window: mov edi, esi shl edi, 8 add edi, SLOT_BASE @@ -1709,10 +1808,14 @@ end virtual ; get WinMap start push esi - mov edi, [Screen_Max_X] - inc edi - mov esi, edi - imul edi, ebx +; mov edi, [Screen_Max_X] +; inc edi +; mov esi, edi + mov esi, [Screen_Max_X] + inc esi +; imul edi, ebx + mov edi, [d_width_calc_area + ebx*4] + add edi, eax add edi, [_WinMapAddress] pop eax @@ -1720,8 +1823,9 @@ end virtual push ax shl eax, 16 pop ax - - .next_line: +;-------------------------------------- +align 4 +.next_line: push ecx shr ecx, 2 rep stosd @@ -1735,8 +1839,9 @@ end virtual jnz .next_line jmp .exit - - .shaped_window: +;-------------------------------------- +align 4 +.shaped_window: ; for (y=0; y <= x_size; y++) ; for (x=0; x <= x_size; x++) ; if (shape[coord(x,y,scale)]==1) @@ -1751,9 +1856,11 @@ end virtual ; get WinMap start -> ebp push eax - mov eax, [Screen_Max_X] ; screen_sx - inc eax - imul eax, ebx +; mov eax, [Screen_Max_X] ; screen_sx +; inc eax +; imul eax, ebx + mov eax, [d_width_calc_area + ebx*4] + add eax, [esp] add eax, [_WinMapAddress] mov ebp, eax @@ -1783,11 +1890,13 @@ end virtual add [ff_ysz], ebx mov ebx, [ff_y] - - .ff_new_y: +;-------------------------------------- +align 4 +.ff_new_y: mov edx, [ff_x] - - .ff_new_x: +;-------------------------------------- +align 4 +.ff_new_x: ; -- body -- mov ecx, [ff_scale] mov eax, [ff_width] @@ -1806,7 +1915,9 @@ end virtual mov eax, esi mov [ebp], al ; -- end body -- - @@: +;-------------------------------------- +align 4 +@@: inc ebp inc edx cmp edx, [ff_xsz] @@ -1821,12 +1932,15 @@ end virtual jb .ff_new_y add esp, 24 - - .exit: +;-------------------------------------- +align 4 +.exit: popad + inc [_display.mask_seqno] ret - - .read_byte: +;-------------------------------------- +align 4 +.read_byte: ; eax - address ; esi - slot push eax ecx edx esi @@ -1836,7 +1950,7 @@ end virtual call read_process_memory pop esi edx ecx eax ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.window_activate: ;//////////////////////////////////////////////////// @@ -1861,11 +1975,13 @@ window._.window_activate: ;//////////////////////////////////////////////////// je .set_window_redraw_flag cmp al, 0x04 jne .move_others_down - - .set_window_redraw_flag: +;-------------------------------------- +align 4 +.set_window_redraw_flag: mov [window_data + ebx + WDATA.fl_redraw], 1 - - .move_others_down: +;-------------------------------------- +align 4 +.move_others_down: ; ax <- process no movzx ebx, word[esi] ; ax <- position in window stack @@ -1873,8 +1989,9 @@ window._.window_activate: ;//////////////////////////////////////////////////// ; drop others xor eax, eax - - .next_stack_window: +;-------------------------------------- +align 4 +.next_stack_window: cmp eax, [TASK_COUNT] jae .move_self_up inc eax @@ -1889,8 +2006,9 @@ window._.window_activate: ;//////////////////////////////////////////////////// jbe .next_stack_window dec word[WIN_STACK + eax * 2] jmp .next_stack_window - - .move_self_up: +;-------------------------------------- +align 4 +.move_self_up: movzx ebx, word[esi] ; number of processes mov ax, [TASK_COUNT] @@ -1899,16 +2017,18 @@ window._.window_activate: ;//////////////////////////////////////////////////// ; update on screen - window stack xor eax, eax - - .next_window_pos: +;-------------------------------------- +align 4 +.next_window_pos: cmp eax, [TASK_COUNT] jae .reset_vars inc eax movzx ebx, word[WIN_STACK + eax * 2] mov [WIN_POS + ebx * 2], ax jmp .next_window_pos - - .reset_vars: +;-------------------------------------- +align 4 +.reset_vars: mov byte[KEY_COUNT], 0 mov byte[BTN_COUNT], 0 mov word[MOUSE_SCROLL_H], 0 @@ -1916,7 +2036,6 @@ window._.window_activate: ;//////////////////////////////////////////////////// pop ebx eax ret - ;------------------------------------------------------------------------------ window._.window_deactivate: ;//////////////////////////////////////////////////// ;------------------------------------------------------------------------------ @@ -1925,7 +2044,8 @@ window._.window_deactivate: ;/////////////////////////////////////////////////// ;> esi = pointer to WIN_POS+ window data ;------------------------------------------------------------------------------ push eax ebx -;------------------------------------------------------------------------------ +;-------------------------------------- +align 4 .move_others_up: ; ax <- process no movzx ebx, word[esi] @@ -1933,6 +2053,8 @@ window._.window_deactivate: ;/////////////////////////////////////////////////// movzx ebx, word[WIN_STACK + ebx * 2] ; up others xor eax, eax +;-------------------------------------- +align 4 .next_stack_window: cmp eax, [TASK_COUNT] jae .move_self_down @@ -1941,13 +2063,16 @@ window._.window_deactivate: ;/////////////////////////////////////////////////// jae .next_stack_window inc word[WIN_STACK + eax * 2] jmp .next_stack_window -;---------------------------------------------- +;-------------------------------------- +align 4 .move_self_down: movzx ebx, word[esi] ; this is the last (and the low) mov [WIN_STACK + ebx * 2], word 1 ; update on screen - window stack xor eax, eax +;-------------------------------------- +align 4 .next_window_pos: cmp eax, [TASK_COUNT] jae .reset_vars @@ -1955,7 +2080,8 @@ window._.window_deactivate: ;/////////////////////////////////////////////////// movzx ebx, word[WIN_STACK + eax * 2] mov [WIN_POS + ebx * 2], ax jmp .next_window_pos -;----------------------------------------------- +;-------------------------------------- +align 4 .reset_vars: mov byte[KEY_COUNT], 0 mov byte[BTN_COUNT], 0 @@ -1987,8 +2113,9 @@ window._.check_window_draw: ;////////////////////////////////////////////////// movzx eax, word[WIN_STACK + eax * 2] ; get value of the curr process lea esi, [WIN_POS + eax * 2] ; get address of this process at 0xC400 - - .next_window: +;-------------------------------------- +align 4 +.next_window: add esi, 2 mov eax, [TASK_COUNT] @@ -2025,33 +2152,34 @@ window._.check_window_draw: ;////////////////////////////////////////////////// jge .next_window pop esi edx ebx eax - - .exit.redraw: +;-------------------------------------- +align 4 +.exit.redraw: xor ecx, ecx inc ecx ret - - .exit.no_redraw: +;-------------------------------------- +align 4 +.exit.no_redraw: pop esi edx ebx eax xor ecx, ecx ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.draw_window_caption: ;//////////////////////////////////////////////// ;------------------------------------------------------------------------------ ;? ;------------------------------------------------------------------------------ - inc [mouse_pause] - call [_display.disable_mouse] - xor eax, eax mov edx, [TASK_COUNT] movzx edx, word[WIN_POS + edx * 2] cmp edx, [CURRENT_TASK] jne @f inc eax - @@: +;-------------------------------------- +align 4 +@@: mov edx, [CURRENT_TASK] shl edx, 5 add edx, window_data @@ -2063,27 +2191,31 @@ window._.draw_window_caption: ;//////////////////////////////////////////////// je .draw_caption_style_3 jmp .not_style_3 - - .draw_caption_style_3: +;-------------------------------------- +align 4 +.draw_caption_style_3: push edx call drawwindow_IV_caption add esp, 4 jmp .2 - - .not_style_3: +;-------------------------------------- +align 4 +.not_style_3: cmp bl, 2 jne .not_style_2 call drawwindow_III_caption jmp .2 - - .not_style_2: +;-------------------------------------- +align 4 +.not_style_2: cmp bl, 0 jne .2 call drawwindow_I_caption - - .2: +;-------------------------------------- +align 4 +.2: mov edi, [CURRENT_TASK] shl edi, 5 test [edi + window_data + WDATA.fl_wstyle], WSTYLE_HASCAPTION @@ -2100,8 +2232,9 @@ window._.draw_window_caption: ;//////////////////////////////////////////////// je .skinned jmp .not_skinned - - .skinned: +;-------------------------------------- +align 4 +.skinned: mov ebp, [edi + window_data + WDATA.box.left - 2] mov bp, word[edi + window_data + WDATA.box.top] movzx eax, word[edi + window_data + WDATA.box.width] @@ -2127,8 +2260,9 @@ window._.draw_window_caption: ;//////////////////////////////////////////////// add bx, -3 add ebx, ebp jmp .dodraw - - .not_skinned: +;-------------------------------------- +align 4 +.not_skinned: cmp al, 1 je .exit @@ -2148,18 +2282,20 @@ window._.draw_window_caption: ;//////////////////////////////////////////////// mov esi, eax mov ebx, 0x00080007 add ebx, ebp - - .dodraw: +;-------------------------------------- +align 4 +.dodraw: mov ecx, [common_colours + 16] or ecx, 0x80000000 xor edi, edi call dtext_asciiz_esi - - .exit: - dec [mouse_pause] - call [draw_pointer] +;-------------------------------------- +align 4 +.exit: +; call [draw_pointer] + call __sys_draw_pointer ret - +;------------------------------------------------------------------------------ align 4 ;------------------------------------------------------------------------------ window._.draw_negative_box: ;////////////////////////////////////////////////// @@ -2170,6 +2306,8 @@ window._.draw_negative_box: ;////////////////////////////////////////////////// ;------------------------------------------------------------------------------ push eax ebx esi mov esi, 0x01000000 +;-------------------------------------- +align 4 .1: mov eax, [edi + BOX.left - 2] mov ax, word[edi + BOX.left] @@ -2181,6 +2319,8 @@ window._.draw_negative_box: ;////////////////////////////////////////////////// pop esi ebx eax ret ;------------------------------------------------------------------------------ +align 4 +;------------------------------------------------------------------------------ window._.end_moving__box: ;////////////////////////////////////////////////// ;------------------------------------------------------------------------------ ;? Draw positive box @@ -2190,8 +2330,8 @@ window._.end_moving__box: ;////////////////////////////////////////////////// push eax ebx esi xor esi, esi jmp window._.draw_negative_box.1 - - +;------------------------------------------------------------------------------ +align 4 ;------------------------------------------------------------------------------ window._.get_rect: ;///////////////////////////////////////////////////// ;------------------------------------------------------------------------------ @@ -2212,6 +2352,5 @@ window._.get_rect: ;///////////////////////////////////////////////////// add edx, [eax-twdw + WDATA.box.height] mov [ecx+RECT.bottom], edx - ret - +;------------------------------------------------------------------------------ diff --git a/kernel/branches/net/hid/mousedrv.inc b/kernel/branches/net/hid/mousedrv.inc index a4ebc219bd..56d738ee2b 100644 --- a/kernel/branches/net/hid/mousedrv.inc +++ b/kernel/branches/net/hid/mousedrv.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; check mouse @@ -22,36 +22,32 @@ $Revision$ ; FCFF com1/ps2 buffer count starting from FC00 uglobal +;-------------------------------------- +align 4 mousecount dd 0x0 mousedata dd 0x0 +Y_UNDER_subtraction_CUR_hot_y: + dd 0 +X_UNDER_subtraction_CUR_hot_x: + dd 0 +Y_UNDER_sub_CUR_hot_y_add_curh: + dd 0 +X_UNDER_sub_CUR_hot_x_add_curh: + dd 0 endg iglobal +;-------------------------------------- +align 4 mouse_delay dd 10 mouse_speed_factor: dd 3 mouse_timer_ticks dd 0 endg - -;include 'm_com.inc' - - -;test_mario79: -; push esi -; push eax -; mov [write_error_to],process_test_m79+43 -; movzx eax,al ;[DevErrorCode] -; call writehex -; mov esi,process_test_m79 -; call sys_msg_board_str -; pop eax -; pop esi -; ret -;process_test_m79 db 'K : Process - test Mario79 error 00000000',13,10,0 - +;----------------------------------------------------------------------------- +align 4 draw_mouse_under: ; return old picture - cmp [_display.restore_cursor], 0 je @F @@ -61,11 +57,14 @@ draw_mouse_under: stdcall [_display.restore_cursor], eax, ebx popad ret +;-------------------------------------- +align 4 @@: pushad xor ecx, ecx xor edx, edx - align 4 +;-------------------------------------- +align 4 mres: movzx eax, word [X_UNDER] movzx ebx, word [Y_UNDER] @@ -83,8 +82,10 @@ mres: mov ecx, [eax] pop ebx pop eax - mov edi, 1;force - call [putpixel] + mov edi, 1 ; force + or ecx, 0x04000000 ; don't save to mouseunder area +; call [putpixel] + call __sys_putpixel pop edx pop ecx inc ecx @@ -96,9 +97,9 @@ mres: jnz mres popad ret - +;----------------------------------------------------------------------------- +align 4 save_draw_mouse: - cmp [_display.move_cursor], 0 je .no_hw_cursor pushad @@ -110,9 +111,11 @@ save_draw_mouse: push eax push ebx - mov ecx, [Screen_Max_X] - inc ecx - mul ecx +; mov ecx, [Screen_Max_X] +; inc ecx +; mul ecx + mov eax, [d_width_calc_area + eax*4] + add eax, [_WinMapAddress] movzx edx, byte [ebx+eax] shl edx, 8 @@ -124,17 +127,22 @@ save_draw_mouse: push esi call [_display.select_cursor] mov [current_cursor], esi +;-------------------------------------- +align 4 .draw: stdcall [_display.move_cursor], esi popad ret -.fail: - mov ecx, [def_cursor] - mov [edx+SLOT_BASE+APPDATA.cursor], ecx - stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax - popad - ret - +;-------------------------------------- +;align 4 +;.fail: +; mov ecx, [def_cursor] +; mov [edx+SLOT_BASE+APPDATA.cursor], ecx +; stdcall [_display.move_cursor], ecx ; stdcall: [esp]=ebx,eax +; popad +; ret +;-------------------------------------- +align 4 .no_hw_cursor: pushad ; save & draw @@ -144,7 +152,8 @@ save_draw_mouse: push ebx mov ecx, 0 mov edx, 0 - align 4 +;-------------------------------------- +align 4 drm: push eax push ebx @@ -155,6 +164,7 @@ drm: add eax, ecx; save picture under mouse add ebx, edx push ecx + or ecx, 0x04000000 ; don't load to mouseunder area call getpixel mov [COLOR_TEMP], ecx pop ecx @@ -164,6 +174,7 @@ drm: add eax, ecx add eax, mouseunder mov ebx, [COLOR_TEMP] + and ebx, 0xffffff mov [eax], ebx pop ecx mov edi, edx ; y cycle @@ -178,6 +189,7 @@ drm: push ecx mov ecx, [COLOR_TEMP] call combine_colors + and ecx, 0xffffff mov [MOUSE_COLOR_MEM], ecx pop ecx pop edx @@ -188,8 +200,10 @@ drm: add ebx, edx ; and y coord+cycle push ecx mov ecx, [MOUSE_COLOR_MEM] - mov edi, 1 - call [putpixel] + mov edi, 1 ; force + or ecx, 0x04000000 ; don't save to mouseunder area +; call [putpixel] + call __sys_putpixel pop ecx mov ebx, [esp+0] ; pure y coord again mov eax, [esp+4] ; and x @@ -203,8 +217,8 @@ drm: add esp, 8 popad ret - - +;----------------------------------------------------------------------------- +align 4 combine_colors: ; in ; ecx - color ( 00 RR GG BB ) @@ -272,126 +286,187 @@ combine_colors: pop ebx pop eax ret +;----------------------------------------------------------------------------- +align 4 +check_mouse_area_for_getpixel: +; in: +; eax = x +; ebx = y +; out: +; ecx = new color + push eax ebx +; check for Y + xor ecx, ecx + mov cx, [Y_UNDER] ; [MOUSE_Y] - -__sys_disable_mouse: - cmp dword [MOUSE_VISIBLE], dword 0 - je @f - ret -@@: - pushad - cmp [CURRENT_TASK], dword 1 - je disable_m - mov edx, [CURRENT_TASK] - shl edx, 5 - add edx, window_data - movzx eax, word [MOUSE_X] - movzx ebx, word [MOUSE_Y] - mov ecx, [Screen_Max_X] - inc ecx - imul ecx, ebx - add ecx, eax - add ecx, [_WinMapAddress] - mov eax, [CURRENT_TASK] - cmp al, [ecx] - je yes_mouse_disable - cmp al, [ecx+16] - je yes_mouse_disable - add ebx, 10 - cmp ebx, [Screen_Max_Y] - jae no_mouse_disable - mov ebx, [Screen_Max_X] - inc ebx - imul ebx, 10 - add ecx, ebx - cmp al, [ecx] - je yes_mouse_disable - cmp al, [ecx+16] - je yes_mouse_disable - jmp no_mouse_disable -yes_mouse_disable: - mov edx, [CURRENT_TASK] - shl edx, 5 - add edx, window_data - movzx eax, word [MOUSE_X] - movzx ebx, word [MOUSE_Y] - mov ecx, [edx+0]; mouse inside the area ? - add eax, 10 - cmp eax, ecx - jb no_mouse_disable - sub eax, 10 - add ecx, [edx+8] - cmp eax, ecx - jg no_mouse_disable - mov ecx, [edx+4] - add ebx, 14 cmp ebx, ecx - jb no_mouse_disable - sub ebx, 14 - add ecx, [edx+12] + jb .no_mouse_area + add ecx, 23 ; mouse cursor Y size cmp ebx, ecx - jg no_mouse_disable -disable_m: - cmp dword [MOUSE_VISIBLE], dword 0 - jne no_mouse_disable - pushf - cli - call draw_mouse_under - popf - mov [MOUSE_VISIBLE], dword 1 -no_mouse_disable: - popad + ja .no_mouse_area +; offset Y + sub bx, [Y_UNDER] ;[MOUSE_Y] +;-------------------------------------- +; check for X + xor ecx, ecx + mov cx, [X_UNDER] ;[MOUSE_X] + cmp eax, ecx + jb .no_mouse_area + add ecx, 15 ; mouse cursor X size + cmp eax, ecx + ja .no_mouse_area +; offset X + sub ax, [X_UNDER] ;[MOUSE_X] +;-------------------------------------- +; eax = offset x +; ebx = offset y + shl ebx, 6 ;y + shl eax, 2 ;x + add eax, ebx + add eax, mouseunder + mov ecx, [eax] + and ecx, 0xffffff + or ecx, 0xff000000 + pop ebx eax ret - -__sys_draw_pointer: - cmp [mouse_pause], 0 - je @f +;-------------------------------------- +align 4 +.no_mouse_area: + xor ecx, ecx + pop ebx eax ret -@@: +;----------------------------------------------------------------------------- +align 4 +check_mouse_area_for_putpixel: +; in: +; ecx = x shl 16 + y +; eax = color +; out: +; eax = new color push eax - mov eax, [timer_ticks] - sub eax, [MouseTickCounter] - cmp eax, 1 - ja @f +; check for Y + mov ax, [Y_UNDER] ; [MOUSE_Y] + cmp cx, ax + jb .no_mouse_area + add ax, 23 ; mouse cursor Y size + cmp cx, ax + ja .no_mouse_area +; offset Y + sub cx, [Y_UNDER] ;[MOUSE_Y] + mov ax, cx + shl eax, 16 +;-------------------------------------- +; check for X + mov ax, [X_UNDER] ;[MOUSE_X] + shr ecx, 16 + cmp cx, ax + jb .no_mouse_area + add ax, 15 ; mouse cursor X size + cmp cx, ax + ja .no_mouse_area +; offset X + sub cx, [X_UNDER] ;[MOUSE_X] + mov ax, cx +;-------------------------------------- +; eax = (offset y) shl 16 + (offset x) + + pop ecx + + push eax ebx + + mov ebx, eax + shr ebx, 16 ;y + and eax, 0xffff ;x + + shl ebx, 6 + shl eax, 2 + add eax, ebx + add eax, mouseunder + and ecx, 0xFFFFFF + mov [eax], ecx + + pop ebx eax + + push esi edi + rol eax, 16 + movzx edi, ax ; y cycle + shl edi, 4 ; *16 bytes per row + shr eax, 16 + add edi, eax ; x cycle + lea edi, [edi*3] + add edi, [MOUSE_PICTURE] ; we have our str address + mov esi, edi + add esi, 16*24*3 + call combine_colors + pop edi esi +;-------------------------------------- +align 4 +.end: + mov eax, ecx + ret +;-------------------------------------- +align 4 +.no_mouse_area: pop eax ret -@@: - mov eax, [timer_ticks] - mov [MouseTickCounter], eax - pop eax +;----------------------------------------------------------------------------- +align 4 +__sys_draw_pointer: pushad - cmp dword [MOUSE_VISIBLE], dword 0; mouse visible ? - je chms00 - mov [MOUSE_VISIBLE], dword 0 - movzx ebx, word [MOUSE_Y] - movzx eax, word [MOUSE_X] - pushfd - cli - call save_draw_mouse - popfd -nodmu2: - popad - ret -chms00: movzx ecx, word [X_UNDER] movzx edx, word [Y_UNDER] movzx ebx, word [MOUSE_Y] movzx eax, word [MOUSE_X] + cmp [redrawmouse_unconditional], 0 + je @f + mov [redrawmouse_unconditional], 0 + jmp redrawmouse +;-------------------------------------- +align 4 +@@: cmp eax, ecx jne redrawmouse cmp ebx, edx - jne redrawmouse - jmp nodmp + je nodmp +;-------------------------------------- +align 4 redrawmouse: pushfd cli call draw_mouse_under call save_draw_mouse + +; mov eax, [_display.select_cursor] +; test eax, eax +; jz @f + cmp [_display.select_cursor], select_cursor + jne @f + + xor eax, eax + mov esi, [current_cursor] + + mov ax, [Y_UNDER] + sub eax, [esi+CURSOR.hot_y] + mov [Y_UNDER_subtraction_CUR_hot_y], eax + add eax, [cur.h] + mov [Y_UNDER_sub_CUR_hot_y_add_curh], eax + + mov ax, [X_UNDER] + sub eax, [esi+CURSOR.hot_x] + mov [X_UNDER_subtraction_CUR_hot_x], eax + add eax, [cur.w] + mov [X_UNDER_sub_CUR_hot_x_add_curh], eax +;-------------------------------------- +align 4 +@@: popfd +;-------------------------------------- +align 4 nodmp: popad ret - +;----------------------------------------------------------------------------- +align 4 proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScroll:dword, HScroll:dword mov eax, [BtnState] @@ -404,11 +479,14 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro jge @@M1 mov eax, 0 jmp @@M2 +;-------------------------------------- +align 4 @@M1: cmp ax, [Screen_Max_X];ScreenLength jl @@M2 mov ax, [Screen_Max_X];ScreenLength-1 - +;-------------------------------------- +align 4 @@M2: mov [MOUSE_X], ax;[XCoordinate] @@ -421,11 +499,14 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro jge @@M3 mov ax, 0 jmp @@M4 +;-------------------------------------- +align 4 @@M3: cmp ax, [Screen_Max_Y];ScreenHeigth jl @@M4 mov ax, [Screen_Max_Y];ScreenHeigth-1 - +;-------------------------------------- +align 4 @@M4: mov [MOUSE_Y], ax;[YCoordinate] @@ -440,7 +521,8 @@ proc set_mouse_data stdcall, BtnState:dword, XMoving:dword, YMoving:dword, VScro mov [mouse_timer_ticks], eax ret endp - +;----------------------------------------------------------------------------- +align 4 mouse_acceleration: push eax mov eax, [timer_ticks] @@ -451,6 +533,8 @@ mouse_acceleration: ;push edx imul eax, [mouse_speed_factor] ;pop edx +;-------------------------------------- +align 4 @@: ret - +;----------------------------------------------------------------------------- diff --git a/kernel/branches/net/hid/set_dtc.inc b/kernel/branches/net/hid/set_dtc.inc index 12b49bf9eb..c38681ef51 100644 --- a/kernel/branches/net/hid/set_dtc.inc +++ b/kernel/branches/net/hid/set_dtc.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;setting date,time,clock and alarm-clock diff --git a/kernel/branches/net/imports.inc b/kernel/branches/net/imports.inc index 0bd917ed96..6fb403fb1b 100644 --- a/kernel/branches/net/imports.inc +++ b/kernel/branches/net/imports.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; @@ -11,7 +11,7 @@ ; ;============================================================================ -$Revision$ +$Revision $ align 4 diff --git a/kernel/branches/net/init.inc b/kernel/branches/net/init.inc index 06483c59f7..e37125fc45 100644 --- a/kernel/branches/net/init.inc +++ b/kernel/branches/net/init.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ MEM_WB equ 6 ;write-back memory @@ -55,6 +55,9 @@ proc init_mem .calcmax: ; round all to pages mov eax, [edi] + cmp [edi+16], byte 1 + jne .unusable + test eax, 0xFFF jz @f neg eax @@ -87,7 +90,7 @@ proc init_mem add esi, eax jmp .usable .unusable: - and dword [edi+8], 0 +; and dword [edi+8], 0 .usable: add edi, 20 loop .calcmax @@ -195,6 +198,9 @@ proc init_page_map mov ebx, BOOT_VAR-OS_BASE + 0x9104 mov edx, [ebx-4] .scanmap: + cmp [ebx+16], byte 1 + jne .next + mov ecx, [ebx+8] shr ecx, 12; ecx = number of pages jz .next @@ -432,6 +438,11 @@ proc test_cpu ret endp +iglobal +align 4 +acpi_lapic_base dd 0xfee00000 ; default local apic base +endg + uglobal align 4 acpi_rsdp rd 1 @@ -443,8 +454,10 @@ acpi_dev_size rd 1 acpi_rsdt_base rd 1 acpi_madt_base rd 1 -acpi_lapic_base rd 1 acpi_ioapic_base rd 1 + +cpu_count rd 1 +smpt rd 16 endg ACPI_HI_RSDP_WINDOW_START equ 0x000E0000 @@ -493,6 +506,7 @@ rsdt_find: ;ecx= rsdt edx= SIG lea ebx, [ecx+36] mov esi, [ecx+4] add esi, ecx +align 4 .next: mov eax, [ebx] cmp [eax], edx @@ -513,9 +527,7 @@ rsdt_find: ;ecx= rsdt edx= SIG pop ebx ret - align 4 - check_acpi: call acpi_locate @@ -533,22 +545,47 @@ check_acpi: mov ecx, [eax+36] mov [acpi_lapic_base-OS_BASE], ecx + mov edi, smpt-OS_BASE + mov ebx, [ecx+0x20] + shr ebx, 24 ; read APIC ID + + mov [edi], ebx ; bootstrap always first + inc [cpu_count-OS_BASE] + add edi, 4 + lea edx, [eax+44] mov ecx, [eax+4] add ecx, eax .check: mov eax, [edx] - cmp al, 1 - je .ioapic + cmp al, 0 + jne .io_apic + shr eax, 24 ; get APIC ID + cmp eax, ebx ; skip self + je .next + + test [edx+4], byte 1 ; is enabled ? + jz .next + + cmp [cpu_count-OS_BASE], 16 + jae .next + + stosd ; store APIC ID + inc [cpu_count-OS_BASE] .next: + mov eax, [edx] movzx eax, ah add edx, eax cmp edx, ecx jb .check .done: ret -.ioapic: + +.io_apic: + cmp al, 1 + jne .next + mov eax, [edx+4] mov [acpi_ioapic_base-OS_BASE], eax - ret + jmp .next diff --git a/kernel/branches/net/kernel.asm b/kernel/branches/net/kernel.asm index 7eaa2b4bb9..c7e58278ee 100644 --- a/kernel/branches/net/kernel.asm +++ b/kernel/branches/net/kernel.asm @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; -;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; PROGRAMMING: ;; Ivan Poddubny ;; Marat Zakiyanov (Mario79) @@ -69,7 +69,7 @@ include 'macros.inc' include 'struct.inc' -$Revision$ +$Revision $ USE_COM_IRQ equ 1 ; make irq 3 and irq 4 available for PCI devices @@ -295,6 +295,8 @@ include 'init.inc' org OS_BASE+$ +include 'fdo.inc' + align 4 high_code: mov ax, os_stack @@ -330,18 +332,21 @@ high_code: mov ecx, disk_list_mutex call mutex_init + mov ecx, unpack_mutex + call mutex_init + ; SAVE REAL MODE VARIABLES - mov ax, [BOOT_VAR + 0x9031] + mov ax, [BOOT_VAR + BOOT_IDE_BASE_ADDR] mov [IDEContrRegsBaseAddr], ax ; --------------- 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, [BOOT_VAR+BOOT_APM_ENTRY] ; offset of APM entry point + movzx eax, word [BOOT_VAR+BOOT_APM_CODE_32] ; 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 [BOOT_VAR+BOOT_APM_CODE_16]; 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 [BOOT_VAR+BOOT_APM_DATA_16]; real-mode segment base address of ; protected-mode 16-bit data segment shl eax, 4 @@ -362,40 +367,37 @@ high_code: mov dword[apm_entry], ebx mov word [apm_entry + 4], apm_code_32 - gdts - mov eax, [BOOT_VAR + 0x9044]; version & flags + mov eax, [BOOT_VAR + BOOT_APM_VERSION] ; version & flags mov [apm_vf], eax ; ----------------------------------------- -; movzx eax,byte [BOOT_VAR+0x9010] ; mouse port -; mov [0xF604],byte 1 ;al - mov al, [BOOT_VAR+0x901F] ; DMA access + mov al, [BOOT_VAR+BOOT_DMA] ; DMA access mov [allow_dma_access], al - movzx eax, byte [BOOT_VAR+0x9000] ; bpp + movzx eax, byte [BOOT_VAR+BOOT_BPP] ; bpp mov [ScreenBPP], al mov [_display.bpp], eax mov [_display.vrefresh], 60 - mov [_display.disable_mouse], __sys_disable_mouse - movzx eax, word [BOOT_VAR+0x900A]; X max + movzx eax, word [BOOT_VAR+BOOT_X_RES]; X max mov [_display.width], eax dec eax mov [Screen_Max_X], eax mov [screen_workarea.right], eax - movzx eax, word [BOOT_VAR+0x900C]; Y max + movzx eax, word [BOOT_VAR+BOOT_Y_RES]; Y max mov [_display.height], eax dec eax mov [Screen_Max_Y], eax mov [screen_workarea.bottom], eax - movzx eax, word [BOOT_VAR+0x9008]; screen mode + movzx eax, word [BOOT_VAR+BOOT_VESA_MODE]; screen mode mov [SCR_MODE], eax - mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add - mov [BANK_SWITCH], eax +; mov eax, [BOOT_VAR+0x9014] ; Vesa 1.2 bnk sw add +; mov [BANK_SWITCH], eax mov [BytesPerScanLine], word 640*4 ; Bytes PerScanLine cmp [SCR_MODE], word 0x13 ; 320x200 je @f cmp [SCR_MODE], word 0x12 ; VGA 640x480 je @f - movzx eax, word[BOOT_VAR+0x9001] ; for other modes + movzx eax, word[BOOT_VAR+BOOT_PITCH] ; for other modes mov [BytesPerScanLine], ax mov [_display.pitch], eax @@: @@ -403,6 +405,12 @@ high_code: mul [_display.height] mov [_WinMapSize], eax + call calculate_fast_getting_offset_for_WinMapAddress +; for Qemu or non standart video cards +; Unfortunately [BytesPerScanLine] does not always +; equal to [_display.width] * [ScreenBPP] / 8 + call calculate_fast_getting_offset_for_LFB + mov esi, BOOT_VAR+0x9080 movzx ecx, byte [esi-1] mov [NumBiosDisks], ecx @@ -411,36 +419,30 @@ high_code: ; GRAPHICS ADDRESSES - and byte [BOOT_VAR+0x901e], 0x0 - mov eax, [BOOT_VAR+0x9018] + mov eax, [BOOT_VAR+BOOT_LFB] mov [LFBAddress], eax cmp [SCR_MODE], word 0100000000000000b jge setvesa20 - cmp [SCR_MODE], word 0x13 + cmp [SCR_MODE], word 0x13 ; EGA 320*200 256 colors je v20ga32 - mov [PUTPIXEL], dword Vesa12_putpixel24 ; Vesa 1.2 - mov [GETPIXEL], dword Vesa12_getpixel24 - cmp [ScreenBPP], byte 24 - jz ga24 - mov [PUTPIXEL], dword Vesa12_putpixel32 - mov [GETPIXEL], dword Vesa12_getpixel32 - ga24: jmp v20ga24 - setvesa20: + +setvesa20: mov [PUTPIXEL], dword Vesa20_putpixel24 ; Vesa 2.0 mov [GETPIXEL], dword Vesa20_getpixel24 cmp [ScreenBPP], byte 24 jz v20ga24 - v20ga32: +v20ga32: mov [PUTPIXEL], dword Vesa20_putpixel32 mov [GETPIXEL], dword Vesa20_getpixel32 - v20ga24: + jmp no_mode_0x12 +v20ga24: cmp [SCR_MODE], word 0x12 ; 16 C VGA 640x480 jne no_mode_0x12 mov [PUTPIXEL], dword VGA_putpixel mov [GETPIXEL], dword Vesa20_getpixel32 - no_mode_0x12: +no_mode_0x12: ; -------- Fast System Call init ---------- ; Intel SYSENTER/SYSEXIT (AMD CPU support it too) @@ -563,13 +565,13 @@ high_code: stdcall kernel_alloc, (unpack.LZMA_BASE_SIZE+(unpack.LZMA_LIT_SIZE shl \ (unpack.lc+unpack.lp)))*4 - mov [unpack.p], eax - - call init_events - mov eax, srv.fd-SRV.fd - mov [srv.fd], eax - mov [srv.bk], eax - + mov [unpack.p], eax + + call init_events + mov eax, srv.fd-SRV.fd + mov [srv.fd], eax + mov [srv.bk], eax + ;Set base of graphic segment to linear address of LFB mov eax, [LFBAddress] ; set for gs mov [graph_data_l+2], ax @@ -662,6 +664,10 @@ end if stdcall read_file, char, FONT_I, 0, 2304 stdcall read_file, char2, FONT_II, 0, 2560 + mov [MOUSE_PICTURE], dword mousepointer + mov [_display.check_mouse], check_mouse_area_for_putpixel + mov [_display.check_m_pixel], check_mouse_area_for_getpixel + mov esi, boot_fonts call boot_log @@ -969,6 +975,13 @@ if defined debug_com_base end if + mov eax, [cpu_count] + test eax, eax + jnz @F + mov al, 1 ; at least one CPU +@@: + DEBUGF 1, "K : %d CPU detected\n", eax + ; START MULTITASKING ; A 'All set - press ESC to start' messages if need @@ -994,7 +1007,6 @@ end if ; Fly :) include 'unpacker.inc' -include 'fdo.inc' align 4 boot_log: @@ -1023,7 +1035,8 @@ boot_log: ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; align 32 osloop: - call [draw_pointer] +; call [draw_pointer] + call __sys_draw_pointer call window_check_events call mouse_check_events call checkmisc @@ -1128,10 +1141,10 @@ set_variables: loop .fl60 push eax - mov ax, [BOOT_VAR+0x900c] + mov ax, [BOOT_VAR+BOOT_Y_RES] shr ax, 1 shl eax, 16 - mov ax, [BOOT_VAR+0x900A] + mov ax, [BOOT_VAR+BOOT_X_RES] shr ax, 1 mov [MOUSE_X], eax @@ -1904,7 +1917,16 @@ detect_devices: ret sys_end: - +;-------------------------------------- + cmp [_display.select_cursor], 0 + je @f +; restore default cursor before killing + pusha + mov ecx, [current_slot] + call restore_default_cursor_before_killing + popa +@@: +;-------------------------------------- mov ecx, [current_slot] mov eax, [ecx+APPDATA.tls_base] test eax, eax @@ -1920,7 +1942,39 @@ sys_end: mov ebx, 100 call delay_hs jmp waitterm +;------------------------------------------------------------------------------ +align 4 +restore_default_cursor_before_killing: + pushfd + cli + mov eax, [def_cursor] + mov [ecx+APPDATA.cursor], eax + movzx eax, word [MOUSE_Y] + movzx ebx, word [MOUSE_X] +; mov ecx, [Screen_Max_X] +; inc ecx +; mul ecx + mov eax, [d_width_calc_area + eax*4] + + add eax, [_WinMapAddress] + movzx edx, byte [ebx+eax] + shl edx, 8 + mov esi, [edx+SLOT_BASE+APPDATA.cursor] + + cmp esi, [current_cursor] + je @f + + push esi + call [_display.select_cursor] + mov [current_cursor], esi +@@: + mov [redrawmouse_unconditional], 1 + popfd +; call [draw_pointer] + call __sys_draw_pointer + ret +;------------------------------------------------------------------------------ iglobal align 4 sys_system_table: @@ -1977,6 +2031,7 @@ sysfn_shutdown: ; 18.9 = system shutdown endg ;------------------------------------------------------------------------------ sysfn_terminate: ; 18.2 = TERMINATE + push ecx cmp ecx, 2 jb noprocessterminate mov edx, [TASK_COUNT] @@ -1988,7 +2043,22 @@ sysfn_terminate: ; 18.2 = TERMINATE add ecx, CURRENT_TASK+TASKDATA.state cmp byte [ecx], 9 jz noprocessterminate - +;-------------------------------------- + cmp [_display.select_cursor], 0 + je .restore_end +; restore default cursor before killing + pusha + mov ecx, [esp+32] + shl ecx, 8 + add ecx, SLOT_BASE + mov eax, [def_cursor] + cmp [ecx+APPDATA.cursor], eax + je @f + call restore_default_cursor_before_killing +@@: + popa +.restore_end: +;-------------------------------------- ;call MEM_Heap_Lock ;guarantee that process isn't working with heap mov [ecx], byte 3; clear possible i40's ;call MEM_Heap_UnLock @@ -1996,8 +2066,11 @@ sysfn_terminate: ; 18.2 = TERMINATE cmp edx, [application_table_status]; clear app table stat jne noatsc and [application_table_status], 0 - noatsc: - noprocessterminate: +noatsc: +; for guarantee the updating data + call change_task +noprocessterminate: + add esp, 4 ret ;------------------------------------------------------------------------------ sysfn_terminate2: @@ -2032,7 +2105,7 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW jb .nowindowdeactivate cmp ecx, [TASK_COUNT] ja .nowindowdeactivate - + movzx esi, word [WIN_STACK + ecx*2] cmp esi, 1 je .nowindowdeactivate ; already deactive @@ -2043,7 +2116,7 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW movzx esi, word [WIN_STACK + ecx * 2] lea esi, [WIN_POS + esi * 2] call window._.window_deactivate - + xor eax, eax mov byte[MOUSE_BACKGROUND], al mov byte[DONT_DRAW_MOUSE], al @@ -2053,7 +2126,7 @@ sysfn_deactivate: ; 18.1 = DEACTIVATE WINDOW call syscall_display_settings._.redraw_whole_screen .nowindowdeactivate: ret - ;------------------------------------------------------------------------------ + ;------------------------------------------------------------------------------ sysfn_activate: ; 18.3 = ACTIVATE WINDOW cmp ecx, 2 jb .nowindowactivate @@ -2300,35 +2373,44 @@ version_inf: dd __REV__ version_end: endg - +;------------------------------------------------------------------------------ +align 4 sys_cachetodiskette: cmp ebx, 1 jne .no_floppy_a_save mov [flp_number], 1 jmp .save_image_on_floppy +;-------------------------------------- +align 4 .no_floppy_a_save: cmp ebx, 2 jne .no_floppy_b_save mov [flp_number], 2 +;-------------------------------------- +align 4 .save_image_on_floppy: call save_image mov [esp + 32], dword 0 cmp [FDC_Status], 0 je .yes_floppy_save +;-------------------------------------- +align 4 .no_floppy_b_save: mov [esp + 32], dword 1 +;-------------------------------------- +align 4 .yes_floppy_save: ret - +;------------------------------------------------------------------------------ uglobal ; bgrchanged dd 0x0 align 4 bgrlockpid dd 0 bgrlock db 0 endg - +;------------------------------------------------------------------------------ +align 4 sys_background: - cmp ebx, 1 ; BACKGROUND SIZE jnz nosb1 test ecx, ecx @@ -2337,12 +2419,16 @@ sys_background: test edx, edx ; cmp edx,0 jz sbgrr +;-------------------------------------- +align 4 @@: ;;Maxis use atomic bts for mutexes 4.4.2009 bts dword [bgrlock], 0 jnc @f call change_task jmp @b +;-------------------------------------- +align 4 @@: mov [BgrDataWidth], ecx mov [BgrDataHeight], edx @@ -2354,6 +2440,8 @@ sys_background: cmp eax, static_background_data jz @f stdcall kernel_free, eax +;-------------------------------------- +align 4 @@: ; calculate RAW size xor eax, eax @@ -2361,14 +2449,24 @@ sys_background: cmp [BgrDataWidth], eax jae @f mov [BgrDataWidth], eax +;-------------------------------------- +align 4 @@: cmp [BgrDataHeight], eax jae @f mov [BgrDataHeight], eax +;-------------------------------------- +align 4 @@: mov eax, [BgrDataWidth] imul eax, [BgrDataHeight] lea eax, [eax*3] +; it is reserved with aligned to the boundary of 4 KB pages, +; otherwise there may be exceptions a page fault for vesa20_drawbackground_tiled +; because the 32 bit read is used for high performance: "mov eax,[esi]" + shr eax, 12 + inc eax + shl eax, 12 mov [mem_BACKGROUND], eax ; get memory for new background stdcall kernel_alloc, eax @@ -2376,6 +2474,8 @@ sys_background: jz .memfailed mov [img_background], eax jmp .exit +;-------------------------------------- +align 4 .memfailed: ; revert to static monotone data mov [img_background], static_background_data @@ -2384,15 +2484,18 @@ sys_background: mov [BgrDataWidth], eax mov [BgrDataHeight], eax mov [mem_BACKGROUND], 4 +;-------------------------------------- +align 4 .exit: popad mov [bgrlock], 0 - - sbgrr: +;-------------------------------------- +align 4 +sbgrr: ret - +;------------------------------------------------------------------------------ +align 4 nosb1: - cmp ebx, 2 ; SET PIXEL jnz nosb2 @@ -2401,6 +2504,8 @@ nosb1: jz @f cmp eax, static_background_data jz .ret +;-------------------------------------- +align 4 @@: mov ebx, [mem_BACKGROUND] add ebx, 4095 @@ -2414,34 +2519,39 @@ nosb1: and edx, 0x00FFFFFF;255*256*256+255*256+255 add edx, ebx mov [eax+ecx], edx +;-------------------------------------- +align 4 .ret: ret +;------------------------------------------------------------------------------ +align 4 nosb2: - cmp ebx, 3 ; DRAW BACKGROUND jnz nosb3 +;-------------------------------------- +align 4 draw_background_temp: -; cmp [bgrchanged],1 ;0 -; je nosb31 -;draw_background_temp: -; mov [bgrchanged],1 ;0 mov [background_defined], 1 - mov byte[BACKGROUND_CHANGED], 1 call force_redraw_background - nosb31: +;-------------------------------------- +align 4 +nosb31: ret - nosb3: - +;------------------------------------------------------------------------------ +align 4 +nosb3: cmp ebx, 4 ; TILED / STRETCHED jnz nosb4 cmp ecx, [BgrDrawMode] je nosb41 mov [BgrDrawMode], ecx -; mov [bgrchanged],1 - nosb41: +;-------------------------------------- +align 4 +nosb41: ret - nosb4: - +;------------------------------------------------------------------------------ +align 4 +nosb4: cmp ebx, 5 ; BLOCK MOVE TO BGR jnz nosb5 cmp [img_background], static_background_data @@ -2450,25 +2560,34 @@ draw_background_temp: jnz .fin cmp esi, 4 ja .fin - @@: +;-------------------------------------- +align 4 +@@: ; bughere mov eax, ecx mov ebx, edx add ebx, [img_background];IMG_BACKGROUND mov ecx, esi call memmove - .fin: +;-------------------------------------- +align 4 +.fin: ret - nosb5: - +;------------------------------------------------------------------------------ +align 4 +nosb5: cmp ebx, 6 jnz nosb6 +;-------------------------------------- +align 4 ;;Maxis use atomic bts for mutex 4.4.2009 @@: bts dword [bgrlock], 0 jnc @f call change_task jmp @b +;-------------------------------------- +align 4 @@: mov eax, [CURRENT_TASK] mov [bgrlockpid], eax @@ -2486,11 +2605,15 @@ draw_background_temp: mov ecx, [mem_BACKGROUND] add ecx, 0xFFF shr ecx, 12 +;-------------------------------------- +align 4 .z: mov eax, [page_tabs+ebx*4] test al, 1 jz @f call free_page +;-------------------------------------- +align 4 @@: mov eax, [page_tabs+esi*4] or al, PG_UW @@ -2502,9 +2625,13 @@ draw_background_temp: inc esi loop .z ret +;-------------------------------------- +align 4 .nomem: and [bgrlockpid], 0 mov [bgrlock], 0 +;------------------------------------------------------------------------------ +align 4 nosb6: cmp ebx, 7 jnz nosb7 @@ -2523,6 +2650,8 @@ nosb6: push eax shr ecx, 12 dec ecx +;-------------------------------------- +align 4 @@: and dword [page_tabs+eax*4], 0 mov edx, eax @@ -2539,13 +2668,34 @@ nosb6: and [bgrlockpid], 0 mov [bgrlock], 0 ret +;-------------------------------------- +align 4 .err: and dword [esp+32], 0 ret - +;------------------------------------------------------------------------------ +align 4 nosb7: - ret + cmp ebx, 8 + jnz nosb8 + mov eax, [BG_Rect_X_left_right] + mov [esp + 32], eax ; eax = [left]*65536 + [right] + mov eax, [BG_Rect_Y_top_bottom] + mov [esp + 20], eax ; ebx = [top]*65536 + [bottom] + ret +;------------------------------------------------------------------------------ +align 4 +nosb8: + ret +;------------------------------------------------------------------------------ +align 4 +uglobal + BG_Rect_X_left_right dd 0x0 + BG_Rect_Y_top_bottom dd 0x0 +endg +;------------------------------------------------------------------------------ +align 4 force_redraw_background: and [draw_data+32 + RECT.left], 0 and [draw_data+32 + RECT.top], 0 @@ -2557,9 +2707,8 @@ force_redraw_background: pop ebx eax inc byte[REDRAW_BACKGROUND] ret - +;------------------------------------------------------------------------------ align 4 - sys_getbackground: ; cmp eax,1 ; SIZE dec ebx @@ -2569,7 +2718,8 @@ sys_getbackground: mov ax, [BgrDataHeight] mov [esp+32], eax ret - +;------------------------------------------------------------------------------ +align 4 nogb1: ; cmp eax,2 ; PIXEL dec ebx @@ -2580,6 +2730,8 @@ nogb1: jz @f cmp eax, static_background_data jz .ret +;-------------------------------------- +align 4 @@: mov ebx, [mem_BACKGROUND] add ebx, 4095 @@ -2592,21 +2744,26 @@ nogb1: and eax, 0xFFFFFF mov [esp+32], eax +;-------------------------------------- +align 4 .ret: ret - nogb2: +;------------------------------------------------------------------------------ +align 4 +nogb2: ; cmp eax,4 ; TILED / STRETCHED dec ebx dec ebx jnz nogb4 mov eax, [BgrDrawMode] - nogb4: +;-------------------------------------- +align 4 +nogb4: mov [esp+32], eax ret - +;------------------------------------------------------------------------------ align 4 - sys_getkey: mov [esp + 32], dword 1 ; test main buffer @@ -2628,12 +2785,18 @@ sys_getkey: mov ebx, KEY_BUFF call memmove pop eax +;-------------------------------------- +align 4 .ret_eax: mov [esp + 32], eax ret +;-------------------------------------- +align 4 .finish: ; test hotkeys buffer mov ecx, hotkey_buffer +;-------------------------------------- +align 4 @@: cmp [ecx], ebx jz .found @@ -2641,6 +2804,8 @@ sys_getkey: cmp ecx, hotkey_buffer + 120 * 8 jb @b ret +;-------------------------------------- +align 4 .found: mov ax, [ecx + 6] shl eax, 16 @@ -2649,11 +2814,9 @@ sys_getkey: and dword [ecx + 4], 0 and dword [ecx], 0 jmp .ret_eax - +;------------------------------------------------------------------------------ align 4 - sys_getbutton: - mov ebx, [CURRENT_TASK] ; TOP OF WINDOW STACK mov [esp + 32], dword 1 movzx ecx, word [WIN_STACK + ebx * 2] @@ -2667,12 +2830,12 @@ sys_getbutton: and al, 0xFE ; delete left button bit mov [BTN_COUNT], byte 0 mov [esp + 32], eax +;-------------------------------------- +align 4 .exit: ret - - +;------------------------------------------------------------------------------ align 4 - sys_cpuusage: ; RETURN: @@ -3024,22 +3187,23 @@ modify_pce: ; check if pixel is allowed to be drawn -checkpixel: - push eax edx +;checkpixel: +; push eax edx - mov edx, [Screen_Max_X] ; screen x size - inc edx - imul edx, ebx - add eax, [_WinMapAddress] - mov dl, [eax+edx]; lea eax, [...] +;; mov edx, [Screen_Max_X] ; screen x size +;; inc edx +;; imul edx, ebx +; mov edx, [d_width_calc_area + ebx*4] +; add eax, [_WinMapAddress] +; mov dl, [eax+edx]; lea eax, [...] - xor ecx, ecx - mov eax, [CURRENT_TASK] - cmp al, dl - setne cl +; xor ecx, ecx +; mov eax, [CURRENT_TASK] +; cmp al, dl +; setne cl - pop edx eax - ret +; pop edx eax +; ret iglobal cpustring db 'CPU',0 @@ -3048,12 +3212,9 @@ endg uglobal background_defined db 0 ; diamond, 11.04.2006 endg - +;----------------------------------------------------------------------------- align 4 -; check misc - checkmisc: - cmp [ctrl_alt_del], 1 jne nocpustart @@ -3061,55 +3222,116 @@ checkmisc: call fs_execute_from_sysdir mov [ctrl_alt_del], 0 - +;-------------------------------------- +align 4 nocpustart: cmp [mouse_active], 1 jne mouse_not_active mov [mouse_active], 0 - xor edi, edi - mov ecx, [TASK_COUNT] -set_mouse_event: - add edi, 256 - or [edi+SLOT_BASE+APPDATA.event_mask], dword 100000b - loop set_mouse_event -mouse_not_active: - cmp byte[BACKGROUND_CHANGED], 0 - jz no_set_bgr_event xor edi, edi + mov ebx, CURRENT_TASK + mov ecx, [TASK_COUNT] -set_bgr_event: + movzx eax, word [WIN_POS + ecx*2] ; active window + shl eax, 8 + push eax + + movzx eax, word [MOUSE_X] + movzx edx, word [MOUSE_Y] +;-------------------------------------- +align 4 +.set_mouse_event: add edi, 256 - or [edi+SLOT_BASE+APPDATA.event_mask], 16 - loop set_bgr_event - mov byte[BACKGROUND_CHANGED], 0 -no_set_bgr_event: - cmp byte[REDRAW_BACKGROUND], 0 ; background update ? + add ebx, 32 + test [ebx+TASKDATA.event_mask], 0x80000000 + jz .pos_filter + + cmp edi, [esp] ; skip if filtration active + jne .skip +;-------------------------------------- +align 4 +.pos_filter: + test [ebx+TASKDATA.event_mask], 0x40000000 + jz .set + + mov esi, [ebx-twdw+WDATA.box.left] + cmp eax, esi + jb .skip + add esi, [ebx-twdw+WDATA.box.width] + cmp eax, esi + ja .skip + + mov esi, [ebx-twdw+WDATA.box.top] + cmp edx, esi + jb .skip + add esi, [ebx-twdw+WDATA.box.height] + cmp edx, esi + ja .skip +;-------------------------------------- +align 4 +.set: + or [edi+SLOT_BASE+APPDATA.event_mask], 100000b ; set event 6 +;-------------------------------------- +align 4 +.skip: + loop .set_mouse_event + + pop eax +;-------------------------------------- +align 4 +mouse_not_active: + xor eax, eax + xchg al, [REDRAW_BACKGROUND] + test al, al ; background update ? jz nobackgr + cmp [background_defined], 0 jz nobackgr -; mov [draw_data+32 + RECT.left],dword 0 -; mov [draw_data+32 + RECT.top],dword 0 -; mov eax,[Screen_Max_X] -; mov ebx,[Screen_Max_Y] -; mov [draw_data+32 + RECT.right],eax -; mov [draw_data+32 + RECT.bottom],ebx +;-------------------------------------- +align 4 @@: + push eax + mov eax, [draw_data+32 + RECT.left] + shl eax, 16 + add eax, [draw_data+32 + RECT.right] + mov [BG_Rect_X_left_right], eax ; [left]*65536 + [right] + + mov eax, [draw_data+32 + RECT.top] + shl eax, 16 + add eax, [draw_data+32 + RECT.bottom] + mov [BG_Rect_Y_top_bottom], eax ; [top]*65536 + [bottom] + pop eax + call drawbackground +;--------- set event 5 start ---------- + push ecx edi + xor edi, edi + mov ecx, [TASK_COUNT] +;-------------------------------------- +align 4 +set_bgr_event: + add edi, 256 + or [edi+SLOT_BASE+APPDATA.event_mask], 10000b ; set event 5 + loop set_bgr_event + pop edi ecx +; call change_task - because the application must have time to call f.15.8 + call change_task +;--------- set event 5 stop ----------- xor eax, eax xchg al, [REDRAW_BACKGROUND] test al, al ; got new update request? jnz @b + mov [draw_data+32 + RECT.left], eax mov [draw_data+32 + RECT.top], eax mov [draw_data+32 + RECT.right], eax mov [draw_data+32 + RECT.bottom], eax mov [MOUSE_BACKGROUND], byte 0 - +;-------------------------------------- +align 4 nobackgr: - - ; system shutdown request - +; system shutdown request cmp [SYS_SHUTDOWN], byte 0 je noshutdown @@ -3121,30 +3343,31 @@ nobackgr: lea ecx, [edx-1] mov edx, OS_BASE+0x3040 jecxz @f +;-------------------------------------- +align 4 markz: mov [edx+TASKDATA.state], byte 3 add edx, 0x20 loop markz +;-------------------------------------- +align 4 @@: - - no_mark_system_shutdown: - - call [_display.disable_mouse] - +no_mark_system_shutdown: dec byte [SYS_SHUTDOWN] je system_shutdown - +;-------------------------------------- +align 4 noshutdown: - - mov eax, [TASK_COUNT] ; termination mov ebx, TASK_DATA+TASKDATA.state mov esi, 1 - +;-------------------------------------- +align 4 newct: mov cl, [ebx] cmp cl, byte 3 jz terminate + cmp cl, byte 4 jz terminate @@ -3153,11 +3376,9 @@ newct: dec eax jnz newct ret - -; redraw screen - +;----------------------------------------------------------------------------- +align 4 redrawscreen: - ; eax , if process window_data base is eax, do not set flag/limits pushad @@ -3168,8 +3389,9 @@ redrawscreen: ;mov ecx,0 ; redraw flags for apps xor ecx, ecx - newdw2: - +;-------------------------------------- +align 4 +newdw2: inc ecx push ecx @@ -3214,45 +3436,58 @@ redrawscreen: mov eax, [draw_limits.left] ; eax = area x start ecx = window x end cmp ecx, eax jb ricino - - bgli: - +;-------------------------------------- +align 4 +bgli: cmp dword[esp], 1 jnz .az -; cmp byte[BACKGROUND_CHANGED], 0 -; jnz newdw8 + cmp byte[REDRAW_BACKGROUND], 0 jz .az + mov dl, 0 lea eax, [edi+draw_data-window_data] mov ebx, [draw_limits.left] cmp ebx, [eax+RECT.left] jae @f + mov [eax+RECT.left], ebx mov dl, 1 - @@: +;-------------------------------------- +align 4 +@@: mov ebx, [draw_limits.top] cmp ebx, [eax+RECT.top] jae @f + mov [eax+RECT.top], ebx mov dl, 1 - @@: +;-------------------------------------- +align 4 +@@: mov ebx, [draw_limits.right] cmp ebx, [eax+RECT.right] jbe @f + mov [eax+RECT.right], ebx mov dl, 1 - @@: +;-------------------------------------- +align 4 +@@: mov ebx, [draw_limits.bottom] cmp ebx, [eax+RECT.bottom] jbe @f + mov [eax+RECT.bottom], ebx mov dl, 1 - @@: +;-------------------------------------- +align 4 +@@: add byte[REDRAW_BACKGROUND], dl jmp newdw8 - .az: - +;-------------------------------------- +align 4 +.az: mov eax, edi add eax, draw_data-window_data @@ -3270,16 +3505,16 @@ redrawscreen: cmp dword [esp], 1 jne nobgrd inc byte[REDRAW_BACKGROUND] - - newdw8: - nobgrd: +;-------------------------------------- +align 4 +newdw8: +nobgrd: mov [eax + WDATA.fl_redraw], byte 1 ; mark as redraw - - ricino: - - not_this_task: - +;-------------------------------------- +align 4 +ricino: +not_this_task: pop ecx cmp ecx, [TASK_COUNT] @@ -3287,11 +3522,10 @@ redrawscreen: pop eax popad - ret - +;----------------------------------------------------------------------------- +align 4 calculatebackground: ; background - mov edi, [_WinMapAddress] ; set os to use all pixels mov eax, 0x01010101 mov ecx, [_WinMapSize] @@ -3299,19 +3533,14 @@ calculatebackground: ; background rep stosd mov byte[REDRAW_BACKGROUND], 0 ; do not draw background! - mov byte[BACKGROUND_CHANGED], 0 - ret - +;----------------------------------------------------------------------------- uglobal imax dd 0x0 endg - - - +;----------------------------------------------------------------------------- +align 4 delay_ms: ; delay in 1/1000 sec - - push eax push ecx @@ -3325,8 +3554,9 @@ delay_ms: ; delay in 1/1000 sec and al, 0x10 mov ah, al cld - - cnt1: +;-------------------------------------- +align 4 +cnt1: in al, 0x61 and al, 0x10 cmp al, ah @@ -3337,27 +3567,29 @@ delay_ms: ; delay in 1/1000 sec pop ecx pop eax - ret - - +;----------------------------------------------------------------------------- +align 4 set_app_param: mov edi, [TASK_BASE] - mov eax, [edi + TASKDATA.event_mask] - mov [edi + TASKDATA.event_mask], ebx - mov [esp+32], eax + mov eax, ebx + btr eax, 3 ; move MOUSE_FILTRATION + mov ebx, [current_slot] ; bit into event_filter + setc byte [ebx+APPDATA.event_filter] + xchg eax, [edi + TASKDATA.event_mask] ; set new event mask + mov [esp+32], eax ; return old mask value ret - - - +;----------------------------------------------------------------------------- +align 4 delay_hs: ; delay in 1/100 secs ; ebx = delay time push ecx push edx mov edx, [timer_ticks] - - newtic: +;-------------------------------------- +align 4 +newtic: mov ecx, [timer_ticks] sub ecx, edx cmp ecx, ebx @@ -3366,16 +3598,15 @@ delay_hs: ; delay in 1/100 secs call change_task jmp newtic - - zerodelay: +;-------------------------------------- +align 4 +zerodelay: pop edx pop ecx - ret - +;----------------------------------------------------------------------------- align 16 ;very often call this subrutine memmove: ; memory move in bytes - ; eax = from ; ebx = to ; ecx = no of bytes @@ -3396,15 +3627,19 @@ memmove: ; memory move in bytes pop ecx and ecx, 11b jz .finish - @@: +;-------------------------------------- +align 4 +@@: rep movsb - - .finish: +;-------------------------------------- +align 4 +.finish: pop ecx edi esi - .ret: +;-------------------------------------- +align 4 +.ret: ret - - +;----------------------------------------------------------------------------- ; Sysfunction 34, read_floppy_file, is obsolete. Use 58 or 70 function instead. ;align 4 ; @@ -3624,37 +3859,25 @@ no_mask_io: ; popad ; end disable io map xor eax, eax ret - - +;----------------------------------------------------------------------------- align 4 drawbackground: - inc [mouse_pause] - cmp [SCR_MODE], word 0x12 - je dbrv20 - dbrv12: - cmp [SCR_MODE], word 0100000000000000b - jge dbrv20 - cmp [SCR_MODE], word 0x13 - je dbrv20 - call vesa12_drawbackground - dec [mouse_pause] - call [draw_pointer] - ret - dbrv20: +dbrv20: cmp [BgrDrawMode], dword 1 jne bgrstr call vesa20_drawbackground_tiled - dec [mouse_pause] - call [draw_pointer] +; call [draw_pointer] + call __sys_draw_pointer ret - bgrstr: - call vesa20_drawbackground_stretch - dec [mouse_pause] - call [draw_pointer] - ret - +;-------------------------------------- +align 4 +bgrstr: + call vesa20_drawbackground_stretch +; call [draw_pointer] + call __sys_draw_pointer + ret +;----------------------------------------------------------------------------- align 4 - syscall_putimage: ; PutImage sys_putimage: test ecx, 0x80008000 @@ -3663,36 +3886,32 @@ sys_putimage: jz .exit test ecx, 0xFFFF0000 jnz @f - .exit: +;-------------------------------------- +align 4 +.exit: ret - @@: +;-------------------------------------- +align 4 +@@: 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: +;-------------------------------------- +align 4 +.forced: push ebp esi 0 mov ebp, putimage_get24bpp mov esi, putimage_init24bpp +;-------------------------------------- +align 4 sys_putimage_bpp: -; call [disable_mouse] ; this will be done in xxx_putimage -; mov eax, vga_putimage - cmp [SCR_MODE], word 0x12 - jz @f ;.doit - mov eax, vesa12_putimage - cmp [SCR_MODE], word 0100000000000000b - jae @f - cmp [SCR_MODE], word 0x13 - jnz .doit -@@: - mov eax, vesa20_putimage -.doit: - inc [mouse_pause] - call eax - dec [mouse_pause] + call vesa20_putimage pop ebp esi ebp - jmp [draw_pointer] + ret +; jmp [draw_pointer] +;----------------------------------------------------------------------------- align 4 sys_putimage_palette: ; ebx = pointer to image @@ -3707,6 +3926,8 @@ sys_putimage_palette: rol edx, 16 add dx, word [eax+SLOT_BASE+APPDATA.wnd_clientbox.left] rol edx, 16 +;-------------------------------------- +align 4 .forced: cmp esi, 1 jnz @f @@ -3721,6 +3942,8 @@ sys_putimage_palette: add esp, 12 pop edi ret +;-------------------------------------- +align 4 @@: cmp esi, 2 jnz @f @@ -3731,6 +3954,8 @@ sys_putimage_palette: pop eax pop edi ret +;-------------------------------------- +align 4 @@: cmp esi, 4 jnz @f @@ -3741,6 +3966,8 @@ sys_putimage_palette: pop eax pop edi ret +;-------------------------------------- +align 4 @@: push ebp esi ebp cmp esi, 8 @@ -3748,55 +3975,71 @@ sys_putimage_palette: mov ebp, putimage_get8bpp mov esi, putimage_init8bpp jmp sys_putimage_bpp +;-------------------------------------- +align 4 @@: cmp esi, 15 jnz @f mov ebp, putimage_get15bpp mov esi, putimage_init15bpp jmp sys_putimage_bpp +;-------------------------------------- +align 4 @@: cmp esi, 16 jnz @f mov ebp, putimage_get16bpp mov esi, putimage_init16bpp jmp sys_putimage_bpp +;-------------------------------------- +align 4 @@: cmp esi, 24 jnz @f mov ebp, putimage_get24bpp mov esi, putimage_init24bpp jmp sys_putimage_bpp +;-------------------------------------- +align 4 @@: cmp esi, 32 jnz @f mov ebp, putimage_get32bpp mov esi, putimage_init32bpp jmp sys_putimage_bpp +;-------------------------------------- +align 4 @@: pop ebp esi ebp ret - +;----------------------------------------------------------------------------- +align 4 put_mono_image: push ebp esi ebp mov ebp, putimage_get1bpp mov esi, putimage_init1bpp jmp sys_putimage_bpp +;----------------------------------------------------------------------------- +align 4 put_2bit_image: push ebp esi ebp mov ebp, putimage_get2bpp mov esi, putimage_init2bpp jmp sys_putimage_bpp +;----------------------------------------------------------------------------- +align 4 put_4bit_image: push ebp esi ebp mov ebp, putimage_get4bpp mov esi, putimage_init4bpp jmp sys_putimage_bpp - +;----------------------------------------------------------------------------- +align 4 putimage_init24bpp: lea eax, [eax*3] putimage_init8bpp: ret - +;----------------------------------------------------------------------------- align 16 putimage_get24bpp: movzx eax, byte [esi+2] @@ -3804,6 +4047,7 @@ putimage_get24bpp: mov ax, [esi] add esi, 3 ret 4 +;----------------------------------------------------------------------------- align 16 putimage_get8bpp: movzx eax, byte [esi] @@ -3813,7 +4057,8 @@ putimage_get8bpp: pop edx inc esi ret 4 - +;----------------------------------------------------------------------------- +align 4 putimage_init1bpp: add eax, ecx push ecx @@ -3824,6 +4069,7 @@ putimage_init1bpp: sub eax, ecx pop ecx ret +;----------------------------------------------------------------------------- align 16 putimage_get1bpp: push edx @@ -3840,7 +4086,8 @@ putimage_get1bpp: add eax, [edx+4] pop edx ret 4 - +;----------------------------------------------------------------------------- +align 4 putimage_init2bpp: add eax, ecx push ecx @@ -3851,6 +4098,7 @@ putimage_init2bpp: sub eax, ecx pop ecx ret +;----------------------------------------------------------------------------- align 16 putimage_get2bpp: push edx @@ -3872,7 +4120,8 @@ putimage_get2bpp: mov eax, [edx+eax*4] pop edx ret 4 - +;----------------------------------------------------------------------------- +align 4 putimage_init4bpp: add eax, ecx push ecx @@ -3883,6 +4132,7 @@ putimage_init4bpp: sub eax, ecx pop ecx ret +;----------------------------------------------------------------------------- align 16 putimage_get4bpp: push edx @@ -3904,19 +4154,23 @@ putimage_get4bpp: mov eax, [edx+eax*4] pop edx ret 4 - +;----------------------------------------------------------------------------- +align 4 putimage_init32bpp: shl eax, 2 ret +;----------------------------------------------------------------------------- align 16 putimage_get32bpp: lodsd ret 4 - +;----------------------------------------------------------------------------- +align 4 putimage_init15bpp: putimage_init16bpp: add eax, eax ret +;----------------------------------------------------------------------------- align 16 putimage_get15bpp: ; 0RRRRRGGGGGBBBBB -> 00000000RRRRR000GGGGG000BBBBB000 @@ -3935,7 +4189,7 @@ putimage_get15bpp: or eax, edx pop edx ecx ret 4 - +;----------------------------------------------------------------------------- align 16 putimage_get16bpp: ; RRRRRGGGGGGBBBBB -> 00000000RRRRR000GGGGGG00BBBBB000 @@ -3954,41 +4208,27 @@ putimage_get16bpp: or eax, edx pop edx ecx ret 4 - +;----------------------------------------------------------------------------- +;align 4 ; eax x beginning ; ebx y beginning ; ecx x end ; edx y end ; edi color - -__sys_drawbar: - mov esi, [current_slot] - add eax, [esi+APPDATA.wnd_clientbox.left] - add ecx, [esi+APPDATA.wnd_clientbox.left] - add ebx, [esi+APPDATA.wnd_clientbox.top] - add edx, [esi+APPDATA.wnd_clientbox.top] - .forced: - inc [mouse_pause] -; call [disable_mouse] - cmp [SCR_MODE], word 0x12 - je dbv20 - sdbv20: - cmp [SCR_MODE], word 0100000000000000b - jge dbv20 - cmp [SCR_MODE], word 0x13 - je dbv20 - call vesa12_drawbar - dec [mouse_pause] - call [draw_pointer] - ret - dbv20: - call vesa20_drawbar - dec [mouse_pause] - call [draw_pointer] - ret - - - +;__sys_drawbar: +; mov esi, [current_slot] +; add eax, [esi+APPDATA.wnd_clientbox.left] +; add ecx, [esi+APPDATA.wnd_clientbox.left] +; add ebx, [esi+APPDATA.wnd_clientbox.top] +; add edx, [esi+APPDATA.wnd_clientbox.top] +;-------------------------------------- +;align 4 +;.forced: +; call vesa20_drawbar +; call [draw_pointer] +; ret +;----------------------------------------------------------------------------- +align 4 kb_read: push ecx edx @@ -4014,8 +4254,8 @@ kb_read: pop edx ecx ret - - +;----------------------------------------------------------------------------- +align 4 kb_write: push ecx edx @@ -4068,8 +4308,8 @@ kb_write: pop edx ecx ret - - +;----------------------------------------------------------------------------- +align 4 kb_cmd: mov ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's @@ -4100,7 +4340,7 @@ kb_cmd: setmouse: ; set mousepicture -pointer ; ps2 mouse enable - mov [MOUSE_PICTURE], dword mousepointer +; mov [MOUSE_PICTURE], dword mousepointer cli @@ -4405,9 +4645,9 @@ syscall_setpixel: ; SetPixel add eax, [edi+APPDATA.wnd_clientbox.left] add ebx, [edi+APPDATA.wnd_clientbox.top] xor edi, edi ; no force -; mov edi, 1 - call [_display.disable_mouse] - jmp [putpixel] + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; jmp [putpixel] + jmp __sys_putpixel align 4 @@ -4424,6 +4664,8 @@ syscall_writetext: ; WriteText pop esi add ebx, ebp mov eax, edi + test ecx, 0x08000000 ; redirect the output to the user area + jnz dtext xor edi, edi jmp dtext @@ -4464,7 +4706,8 @@ syscall_drawrect: ; DrawRect add ebx, [esi + APPDATA.wnd_clientbox.top] add ecx, eax add edx, ebx - jmp [drawbar] +; jmp [drawbar] + jmp vesa20_drawbar .drectr: ret @@ -4535,9 +4778,28 @@ syscall_cdaudio: ; CD call .free ; pop eax ret - +;----------------------------------------------------------------------------- +align 4 +syscall_getpixel_WinMap: ; GetPixel WinMap + cmp ebx, [Screen_Max_X] + jbe @f + cmp ecx, [Screen_Max_Y] + jbe @f + xor eax, eax + jmp .store +;-------------------------------------- +align 4 +@@: + mov eax, [d_width_calc_area + ecx*4] + add eax, [_WinMapAddress] + movzx eax, byte[eax+ebx] ; get value for current point +;-------------------------------------- +align 4 +.store: + mov [esp + 32], eax + ret +;----------------------------------------------------------------------------- align 4 - syscall_getpixel: ; GetPixel mov ecx, [Screen_Max_X] inc ecx @@ -4546,32 +4808,18 @@ syscall_getpixel: ; GetPixel div ecx mov ebx, edx xchg eax, ebx + and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area call dword [GETPIXEL]; eax - x, ebx - y mov [esp + 32], ecx ret - +;----------------------------------------------------------------------------- align 4 - syscall_getarea: ;eax = 36 ;ebx = pointer to bufer for img BBGGRRBBGGRR... ;ecx = [size x]*65536 + [size y] ;edx = [start x]*65536 + [start y] pushad - inc [mouse_pause] -; Check of use of the hardware cursor. - cmp [_display.disable_mouse], __sys_disable_mouse - jne @f -; Since the test for the coordinates of the mouse should not be used, -; then use the call [disable_mouse] is not possible! - cmp dword [MOUSE_VISIBLE], dword 0 - jne @f - pushf - cli - call draw_mouse_under - popf - mov [MOUSE_VISIBLE], dword 1 -@@: mov edi, ebx mov eax, edx shr eax, 16 @@ -4601,13 +4849,17 @@ syscall_getarea: add ebp, edi add ebx, edx - +;-------------------------------------- +align 4 .start_y: push ecx edx +;-------------------------------------- +align 4 .start_x: push eax ebx ecx add eax, ecx + and ecx, 0xFBFFFFFF ;negate 0x04000000 use mouseunder area call dword [GETPIXEL]; eax - x, ebx - y mov [ebp], cx @@ -4622,17 +4874,91 @@ syscall_getarea: dec ebx dec edx jnz .start_y - dec [mouse_pause] -; Check of use of the hardware cursor. - cmp [_display.disable_mouse], __sys_disable_mouse - jne @f - call [draw_pointer] -@@: popad ret - +;----------------------------------------------------------------------------- align 4 +syscall_putarea_backgr: +;eax = 25 +;ebx = pointer to bufer for img BBGGRRBBGGRR... +;ecx = [size x]*65536 + [size y] +;edx = [start x]*65536 + [start y] + pushad + mov edi, ebx + mov eax, edx + shr eax, 16 + mov ebx, edx + and ebx, 0xffff + dec eax + dec ebx +; eax - x, ebx - y + mov edx, ecx + shr ecx, 16 + and edx, 0xffff + mov esi, ecx +; ecx - size x, edx - size y + mov ebp, edx + dec ebp + shl ebp, 2 + imul ebp, esi + + mov esi, ecx + dec esi + shl esi, 2 + + add ebp, esi + add ebp, edi + + add ebx, edx +;-------------------------------------- +align 4 +.start_y: + push ecx edx +;-------------------------------------- +align 4 +.start_x: + push eax ecx + add eax, ecx + + mov ecx, [ebp] + rol ecx, 8 + test cl, cl ; transparensy = 0 + jz .no_put + + xor cl, cl + ror ecx, 8 + + pushad + mov edx, [d_width_calc_area + ebx*4] + add edx, [_WinMapAddress] + movzx edx, byte [eax+edx] + cmp dl, byte 1 + jne @f + + call dword [PUTPIXEL]; eax - x, ebx - y +;-------------------------------------- +align 4 +@@: + popad +;-------------------------------------- +align 4 +.no_put: + pop ecx eax + + sub ebp, 4 + dec ecx + jnz .start_x + + pop edx ecx + dec ebx + dec edx + jnz .start_y + + popad + ret +;----------------------------------------------------------------------------- +align 4 syscall_drawline: ; DrawLine mov edi, [TASK_BASE] @@ -4653,8 +4979,8 @@ syscall_drawline: ; DrawLine xor edi, edi add ebx, ebp mov ecx, edx - jmp [draw_line] - +; jmp [draw_line] + jmp __sys_draw_line align 4 @@ -4696,7 +5022,37 @@ read_from_hd: ; Read from hd - fn not in use paleholder: ret - +;------------------------------------------------------------------------------ +align 4 +calculate_fast_getting_offset_for_WinMapAddress: +; calculate data area for fast getting offset to _WinMapAddress + xor eax, eax + mov ecx, [_display.height] + inc ecx + mov edi, d_width_calc_area + cld +@@: + stosd + add eax, [_display.width] + dec ecx + jnz @r + ret +;------------------------------------------------------------------------------ +align 4 +calculate_fast_getting_offset_for_LFB: +; calculate data area for fast getting offset to LFB + xor eax, eax + mov ecx, [_display.height] + inc ecx + mov edi, BPSLine_calc_area + cld +@@: + stosd + add eax, [BytesPerScanLine] + dec ecx + jnz @r + ret +;------------------------------------------------------------------------------ align 4 set_screen: cmp eax, [Screen_Max_X] @@ -4733,6 +5089,8 @@ set_screen: test eax, eax jz .epic_fail + call calculate_fast_getting_offset_for_WinMapAddress + popad call repos_windows diff --git a/kernel/branches/net/kernel32.inc b/kernel/branches/net/kernel32.inc index 185b078eef..19395d388b 100644 --- a/kernel/branches/net/kernel32.inc +++ b/kernel/branches/net/kernel32.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; KERNEL32.INC ;; @@ -13,7 +13,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ struct POINT x dd ? @@ -125,7 +125,8 @@ struct APPDATA wait_param dd ? ;+100 +++ tls_base dd ? ;+104 dlls_list_ptr dd ? ;+108 - rb 16 ;+112 + event_filter dd ? ;+112 + rb 12 ;+116 wnd_shape dd ? ;+128 wnd_shape_scale dd ? ;+132 @@ -145,12 +146,12 @@ struct APPDATA wnd_caption dd ? wnd_clientbox BOX -ends - - -; Core functions -include "core/sync.inc" ; macros for synhronization objects -include "core/sys32.inc" ; process management +ends + + +; Core functions +include "core/sync.inc" ; macros for synhronization objects +include "core/sys32.inc" ; process management include "core/sched.inc" ; process scheduling include "core/syscall.inc" ; system call include "core/fpu.inc" ; all fpu/sse support @@ -194,7 +195,7 @@ include "sound/playnote.inc" ; player Note for Speaker PC ; display -include "video/vesa12.inc" ; Vesa 1.2 functions +;include "video/vesa12.inc" ; Vesa 1.2 functions include "video/vesa20.inc" ; Vesa 2.0 functions include "video/blitter.inc" ; include "video/vga.inc" ; VGA 16 color functions diff --git a/kernel/branches/net/kglobals.inc b/kernel/branches/net/kglobals.inc index 3299a5ebe3..82bfbe8f7e 100644 --- a/kernel/branches/net/kglobals.inc +++ b/kernel/branches/net/kglobals.inc @@ -1,11 +1,11 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ;------------------------------------------------------------------ diff --git a/kernel/branches/net/macros.inc b/kernel/branches/net/macros.inc index 53ddd70eba..482d8e45f0 100644 --- a/kernel/branches/net/macros.inc +++ b/kernel/branches/net/macros.inc @@ -1,3 +1,9 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; __REV = 0 @@ -9,7 +15,7 @@ macro $Revision a { \} } -$Revision$ +$Revision $ ;// mike.dld, 2006-29-01 [ diff --git a/kernel/branches/net/memmap.inc b/kernel/branches/net/memmap.inc index 4d475c4201..cbf5f4bf82 100644 --- a/kernel/branches/net/memmap.inc +++ b/kernel/branches/net/memmap.inc @@ -1,6 +1,12 @@ -; -; MEMORY MAP -; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +; +; MEMORY MAP +; ; Boot: ; ; 0:9000 byte bits per pixel @@ -128,13 +134,13 @@ ; FE88 dword address of button list ; FE8C dword memory to use ; FE90 -> FEFF free (112) -; FF00 byte 1 = system shutdown request -; FF01 byte task activation request? -; FFF0 byte >0 if redraw background request from app -; FFF1 byte >0 if background changed -; FFF2 write and read bank in screen -; FFF4 byte 0 if first mouse draw & do not return picture under -; FFF5 byte 1 do not draw pointer +; FF00 byte 1 = system shutdown request +; FF01 byte task activation request? +; FFF0 byte >0 if redraw background request from app +; FFF1 byte free +; FFF2 write and read bank in screen +; FFF4 byte 0 if first mouse draw & do not return picture under +; FFF5 byte 1 do not draw pointer ; FFFF byte do not change task for 1/100 sec. ; ; 0x80010000 -> 6CBFF kernel, 32-bit run-time code (up to 371 Kb) @@ -195,58 +201,68 @@ ; 0x80280000 -> 281FFF ramdisk fat (8k) ; 0x80282000 -> 283FFF floppy fat (8k) ; -; 0x80284000 -> 28BFFF HDD DMA AREA (32k) -; 0x8028C000 -> 297FFF free (48k) -; -; 0x80298000 -> 29ffff auxiliary table for background smoothing code (32k) -; -; 0x802A0000 -> 2B00ff wav device buffer (64k) -; 0x802A0000 -> 2B00ff wav device status (256) -; 0x802B0100 -> 2Bffff free (63k8) -; 0x802C0000 -> 2C3fff button info (8k) -; -; 0000 word number of buttons -; first button entry at 0x10 -; +0000 word process number -; +0002 word button id number : bits 00-15 -; +0004 word x start +; 0x80284000 -> 28BFFF HDD DMA AREA (32k) +; 0x8028C000 -> 297FFF free (48k) +; +; 0x80298000 -> 29FFFF auxiliary table for background smoothing code (32k) +; +; 0x802A0000 -> 2B00FF wav device buffer (64k) +; 0x802A0000 -> 2B00FF wav device status (256) +; +; 0x802B0100 -> 2B3FFD free (15k7) +; +; 0x802B3FEE -> 2B3FEF button info (64K+ 16 + 2 byte) +; 2B3FEE 0000 word number of buttons +; 2B3FF0 first button entry +; +; button entry at 0x10 +; +0000 word process number +; +0002 word button id number : bits 00-15 +; +0004 word x start ; +0006 word x size ; +0008 word y start -; +000A word y size -; +000C word button id number : bits 16-31 -; -; 0x802C4000 -> 2CFFFF free (48k) -; -; 0x802D0000 -> 2DFFFF reserved port area (64k) -; +; +000A word y size +; +000C word button id number : bits 16-31 +; +; 0x802C4000 -> 2C9FFF area for fast getting offset to LFB (24k) +; BPSLine_calc_area +; 0x802CA000 -> 2CFFFF area for fast getting offset to _WinMapAddress (24k) +; d_width_calc_area +; +; 0x802D0000 -> 2DFFFF reserved port area (64k) +; ; 0000 dword no of port areas reserved ; 0010 dword process id ; dword start port -; dword end port -; dword 0 -; -; 0x802E0000 -> 2EFFFF irq data area (64k) -; 0x802F0000 -> 2FFFFF low memory save (64k) -; -; 0x80300000 -> 31FFFF tcp memory (128k) -; 0x80320000 -> 327FFF tcp memory (32k) -; -; 0x80328000 -> 32FFFF !vrr driver (32k) - -; 0x80330000 -> 377FFF skin data (32k) - -; 0x80338000 -> 338FFF draw data - 256 entries (4k) -; 00 dword draw limit - x start -; 04 dword draw limit - y start -; 08 dword draw limit - x end -; 0C dword draw limit - y end -; 0x80339000 -> 3BFFF3 free (12k) -; 0x8033BFF4 -> 33BFFF background info -; 0x8033C000 page map (length b = memsize shr 15) -; 0x8033C000 + b start of static pagetables - -; 0x803FFFFF <- no direct address translation beyond this point -; ============================================================= +; dword end port +; dword 0 +; +; 0x802E0000 -> 2EFFFF irq data area (64k) ;BOOT_VAR +; +; 0x802F0000 -> 2F3FFF tcp memory stack_data_start eth_data_start (16k) +; +; 0x802F4000 -> 30ffff stack_data | stack_data_end (112k) +; +; 0x80310000 -> 317fff resendQ (32k) +; +; 0x80318000 -> 31ffff skin_data (32k) +; +; 0x80320000 -> 323FF3 draw data - 256 entries (4k) +; 00 dword draw limit - x start +; 04 dword draw limit - y start +; 08 dword draw limit - x end +; 0C dword draw limit - y end +; +; 0x8032BFF4 -> 32BFFF background info +; 0x80323FF4 BgrDrawMode +; 0x80323FF8 BgrDataWidth +; 0x80323FFC BgrDataHeight +; +; 0x80324000 page map (length b = memsize shr 15) +; 0x80324000 + b start of static pagetables + +; 0x803FFFFF <- no direct address translation beyond this point +; ============================================================= ; 0x805FF000 -> 5FFF80 TSS ; 0x80600000 -> 601FFF i/o maps diff --git a/kernel/branches/net/proc32.inc b/kernel/branches/net/proc32.inc index 42ad683607..949598b554 100644 --- a/kernel/branches/net/proc32.inc +++ b/kernel/branches/net/proc32.inc @@ -1,5 +1,11 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; Macroinstructions for defining and calling procedures diff --git a/kernel/branches/net/sound/playnote.inc b/kernel/branches/net/sound/playnote.inc index b9373b7621..20385f7ac0 100644 --- a/kernel/branches/net/sound/playnote.inc +++ b/kernel/branches/net/sound/playnote.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; PLAYNOTE.INC version 1.1 22 November 2003 ;; @@ -16,7 +16,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ align 4 sound_interface: diff --git a/kernel/branches/net/video/arrow_clock.cur b/kernel/branches/net/video/arrow_clock.cur new file mode 100644 index 0000000000..1187c4899b Binary files /dev/null and b/kernel/branches/net/video/arrow_clock.cur differ diff --git a/kernel/branches/net/video/blitter.inc b/kernel/branches/net/video/blitter.inc index 7dd7303ad4..622bc1a4c8 100644 --- a/kernel/branches/net/video/blitter.inc +++ b/kernel/branches/net/video/blitter.inc @@ -1,3 +1,9 @@ +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2011-2012. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; struct BLITTER_BLOCK xmin dd ? @@ -321,34 +327,42 @@ blit_32: mov ecx, esp call blit_clip - test eax, eax - jne .L57 - - inc [mouse_pause] - call [_display.disable_mouse] - - mov eax, [TASK_BASE] - - mov ebx, [esp+BLITTER.dst_x] - mov ebp, [esp+BLITTER.dst_y] - add ebx, [eax-twdw + WDATA.box.left] - add ebp, [eax-twdw + WDATA.box.top] - mov edi, ebp - - imul edi, [_display.pitch] - imul ebp, [_display.width] - add ebp, ebx - add ebp, [_WinMapAddress] - + test eax, eax + jne .L57 + + mov eax, [TASK_BASE] + + mov ebx, [esp+BLITTER.dst_x] + mov ebp, [esp+BLITTER.dst_y] + add ebx, [eax-twdw + WDATA.box.left] + add ebp, [eax-twdw + WDATA.box.top] + + mov ecx, ebx + add ecx, [esp+BLITTER.w] + shl ecx, 16 + mov cx, bp + add ecx, [esp+BLITTER.h] + + mov edi, ebp + +; imul edi, [_display.pitch] + mov edi, [BPSLine_calc_area+edi*4] +; imul ebp, [_display.width] + mov ebp, [d_width_calc_area+ebp*4] + + add ebp, ebx + add ebp, [_WinMapAddress] + mov eax, [esp+BLITTER.src_y] imul eax, [esp+BLITTER.stride] mov esi, [esp+BLITTER.src_x] - lea esi, [eax+esi*4] - add esi, [esp+BLITTER.bitmap] - - mov ecx, [esp+BLITTER.h] - mov edx, [esp+BLITTER.w] - + lea esi, [eax+esi*4] + add esi, [esp+BLITTER.bitmap] + + mov eax, ecx + mov ecx, [esp+BLITTER.h] + mov edx, [esp+BLITTER.w] + test ecx, ecx ;FIXME check clipping jz .L57 @@ -358,25 +372,52 @@ blit_32: cmp [_display.bpp], 32 jne .core_24 - lea edi, [edi+ebx*4] + lea edi, [edi+ebx*4] + + mov ebx, [CURRENT_TASK] +align 4 +.outer32: + xor ecx, ecx - mov ebx, [CURRENT_TASK] - -align 4 -.outer32: - xor ecx, ecx - -align 4 -.inner32: - cmp [ebp+ecx], bl - jne @F - - mov eax, [esi+ecx*4] - mov [LFB_BASE+edi+ecx*4], eax -@@: - inc ecx - dec edx - jnz .inner32 +align 4 +.inner32: + cmp [ebp+ecx], bl + jne .skip +;-------------------------------------- + push eax + mov eax, [esi+ecx*4] + +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: + push ecx + + mov ecx, [esp+4] + ror ecx, 16 + sub ecx, edx + rol ecx, 16 + sub ecx, [esp+BLITTER.h + 8] + +; check mouse area for putpixel + call [_display.check_mouse] + pop ecx +;-------------------------------------- +align 4 +.no_mouseunder: +; store to real LFB + mov [LFB_BASE+edi+ecx*4], eax + pop eax +;-------------------------------------- +align 4 +.skip: + inc ecx + dec edx + jnz .inner32 add esi, [esp+BLITTER.stride] add edi, [_display.pitch] @@ -384,14 +425,14 @@ align 4 mov edx, [esp+BLITTER.w] dec [esp+BLITTER.h] - jnz .outer32 - -.done: - dec [mouse_pause] - call [draw_pointer] -.L57: - add esp, 72 - pop ebx + jnz .outer32 + +.done: +; call [draw_pointer] + call __sys_draw_pointer +.L57: + add esp, 72 + pop ebx pop esi pop edi pop ebp @@ -407,21 +448,49 @@ align 4 mov [esp+64], edi xor ecx, ecx -align 4 -.inner24: - cmp [ebp+ecx], bl - jne @F - - mov eax, [esi+ecx*4] - - lea edi, [edi+ecx*2] - mov [edi+ecx], ax - shr eax, 16 - mov [edi+ecx+2], al -@@: - mov edi, [esp+64] - inc ecx - dec edx +align 4 +.inner24: + cmp [ebp+ecx], bl + jne .skip_1 +;-------------------------------------- + push eax + mov eax, [esi+ecx*4] + + lea edi, [edi+ecx*2] + +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder_1 +;-------------------------------------- +align 4 +@@: + push ecx + + mov ecx, [esp+4] + ror ecx, 16 + sub ecx, edx + rol ecx, 16 + sub ecx, [esp+BLITTER.h + 8] + +; check mouse area for putpixel + call [_display.check_mouse] + pop ecx +;-------------------------------------- +align 4 +.no_mouseunder_1: + mov [edi+ecx], ax + shr eax, 16 + mov [edi+ecx+2], al + + pop eax +;-------------------------------------- +align 4 +.skip_1: + mov edi, [esp+64] + inc ecx + dec edx jnz .inner24 add esi, [esp+BLITTER.stride] diff --git a/kernel/branches/net/video/cursors.inc b/kernel/branches/net/video/cursors.inc index 7581ab4102..f34bfd1e1b 100644 --- a/kernel/branches/net/video/cursors.inc +++ b/kernel/branches/net/video/cursors.inc @@ -1,35 +1,35 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ LOAD_FROM_FILE equ 0 LOAD_FROM_MEM equ 1 -LOAD_INDIRECT equ 2 -LOAD_SYSTEM equ 3 - -struct BITMAPINFOHEADER - Size dd ? - Width dd ? - Height dd ? - Planes dw ? - BitCount dw ? - Compression dd ? - SizeImage dd ? - XPelsPerMeter dd ? - YPelsPerMeter dd ? - ClrUsed dd ? - ClrImportant dd ? -ends - -align 4 -proc init_cursor stdcall, dst:dword, src:dword - locals +LOAD_INDIRECT equ 2 +LOAD_SYSTEM equ 3 + +struct BITMAPINFOHEADER + Size dd ? + Width dd ? + Height dd ? + Planes dw ? + BitCount dw ? + Compression dd ? + SizeImage dd ? + XPelsPerMeter dd ? + YPelsPerMeter dd ? + ClrUsed dd ? + ClrImportant dd ? +ends +;------------------------------------------------------------------------------ +align 4 +proc init_cursor stdcall, dst:dword, src:dword + locals rBase dd ? pQuad dd ? pBits dd ? @@ -40,17 +40,18 @@ proc init_cursor stdcall, dst:dword, src:dword endl mov esi, [src] - add esi, [esi+18] - mov eax, esi - - cmp [esi+BITMAPINFOHEADER.BitCount], 24 - je .img_24 - cmp [esi+BITMAPINFOHEADER.BitCount], 8 - je .img_8 - cmp [esi+BITMAPINFOHEADER.BitCount], 4 - je .img_4 - -.img_2: + add esi, [esi+18] + mov eax, esi + + cmp [esi+BITMAPINFOHEADER.BitCount], 24 + je .img_24 + cmp [esi+BITMAPINFOHEADER.BitCount], 8 + je .img_8 + cmp [esi+BITMAPINFOHEADER.BitCount], 4 + je .img_4 +;-------------------------------------- +align 4 +.img_2: add eax, [esi] mov [pQuad], eax add eax, 8 @@ -68,6 +69,8 @@ proc init_cursor stdcall, dst:dword, src:dword mov [rBase], edi mov esi, [pQuad] +;-------------------------------------- +align 4 .l21: mov ebx, [pBits] mov ebx, [ebx] @@ -76,6 +79,8 @@ proc init_cursor stdcall, dst:dword, src:dword mov eax, [eax] bswap eax mov [counter], 32 +;-------------------------------------- +align 4 @@: xor edx, edx shl eax, 1 @@ -103,7 +108,8 @@ proc init_cursor stdcall, dst:dword, src:dword sub [height], 1 jnz .l21 ret - +;-------------------------------------- +align 4 .img_4: add eax, [esi] mov [pQuad], eax @@ -123,11 +129,15 @@ proc init_cursor stdcall, dst:dword, src:dword mov esi, [pQuad] mov ebx, [pBits] +;-------------------------------------- +align 4 .l4: mov eax, [pAnd] mov eax, [eax] bswap eax mov [counter], 16 +;-------------------------------------- +align 4 @@: xor edx, edx shl eax, 1 @@ -168,6 +178,8 @@ proc init_cursor stdcall, dst:dword, src:dword sub [height], 1 jnz .l4 ret +;-------------------------------------- +align 4 .img_8: add eax, [esi] mov [pQuad], eax @@ -187,11 +199,15 @@ proc init_cursor stdcall, dst:dword, src:dword mov esi, [pQuad] mov ebx, [pBits] +;-------------------------------------- +align 4 .l81: mov eax, [pAnd] mov eax, [eax] bswap eax mov [counter], 32 +;-------------------------------------- +align 4 @@: xor edx, edx shl eax, 1 @@ -217,27 +233,33 @@ proc init_cursor stdcall, dst:dword, src:dword sub [height], 1 jnz .l81 ret +;-------------------------------------- +align 4 .img_24: add eax, [esi] - mov [pQuad], eax - add eax, 0xC00 - mov [pAnd], eax - mov eax, [esi+BITMAPINFOHEADER.Width] - mov [width], eax - mov ebx, [esi+BITMAPINFOHEADER.Height] - shr ebx, 1 - mov [height], ebx - + mov [pQuad], eax + add eax, 0xC00 + mov [pAnd], eax + mov eax, [esi+BITMAPINFOHEADER.Width] + mov [width], eax + mov ebx, [esi+BITMAPINFOHEADER.Height] + shr ebx, 1 + mov [height], ebx + mov edi, [dst] add edi, 32*31*4 mov [rBase], edi mov esi, [pAnd] mov ebx, [pQuad] +;-------------------------------------- +align 4 .row_24: mov eax, [esi] bswap eax mov [counter], 32 +;-------------------------------------- +align 4 @@: xor edx, edx shl eax, 1 @@ -263,7 +285,7 @@ proc init_cursor stdcall, dst:dword, src:dword jnz .row_24 ret endp - +;------------------------------------------------------------------------------ align 4 proc set_cursor stdcall, hcursor:dword mov eax, [hcursor] @@ -274,13 +296,16 @@ proc set_cursor stdcall, hcursor:dword mov ebx, [current_slot] xchg eax, [ebx+APPDATA.cursor] ret +;-------------------------------------- +align 4 .fail: mov eax, [def_cursor] mov ebx, [current_slot] xchg eax, [ebx+APPDATA.cursor] ret endp - +;------------------------------------------------------------------------------ +align 4 ; param ; eax= pid ; ebx= src @@ -293,13 +318,13 @@ create_cursor: sub esp, 4 ;space for .hcursor push ecx - push ebx - - mov ebx, eax - mov eax, sizeof.CURSOR - call create_kernel_object - test eax, eax - jz .fail + push ebx + + mov ebx, eax + mov eax, sizeof.CURSOR + call create_kernel_object + test eax, eax + jz .fail mov [.hcursor], eax @@ -328,6 +353,8 @@ create_cursor: stdcall init_cursor, eax, esi +align 4 +.add_cursor: mov ecx, [.hcursor] lea ecx, [ecx+CURSOR.list_next] lea edx, [_display.cr_list.next] @@ -338,7 +365,6 @@ create_cursor: popfd mov eax, [.hcursor] -.check_hw: cmp [_display.init_cursor], 0 je .fail @@ -347,22 +373,26 @@ create_cursor: add esp, 4 mov eax, [.hcursor] +;-------------------------------------- +align 4 .fail: add esp, 12 ret +;-------------------------------------- +align 4 .indirect: shr ebx, 16 movzx ecx, bh movzx edx, bl - mov [eax+CURSOR.hot_x], ecx - mov [eax+CURSOR.hot_y], edx + mov [edi+CURSOR.hot_x], ecx + mov [edi+CURSOR.hot_y], edx xchg edi, eax mov ecx, 1024 cld rep movsd - jmp .check_hw - + jmp .add_cursor +;------------------------------------------------------------------------------ align 4 proc load_cursor stdcall, src:dword, flags:dword locals @@ -381,6 +411,8 @@ proc load_cursor stdcall, src:dword, flags:dword test eax, eax jz .fail mov [src], eax +;-------------------------------------- +align 4 @@: push ebx push esi @@ -397,16 +429,22 @@ proc load_cursor stdcall, src:dword, flags:dword cmp word [flags], LOAD_FROM_FILE jne .exit stdcall kernel_free, [src] +;-------------------------------------- +align 4 .exit: pop edi pop esi pop ebx +;-------------------------------------- +align 4 .fail: mov eax, [handle] +;-------------------------------------- +align 4 .fail2: ret endp - +;------------------------------------------------------------------------------ align 4 proc delete_cursor stdcall, hcursor:dword locals @@ -433,17 +471,20 @@ proc delete_cursor stdcall, hcursor:dword jne @F mov eax, [def_cursor] mov [ebx+APPDATA.cursor], eax +;-------------------------------------- +align 4 @@: mov eax, [hcursor] call [eax+APPOBJ.destroy] +;-------------------------------------- +align 4 .fail: ret endp - +;------------------------------------------------------------------------------ +align 4 ; param ; eax= cursor - -align 4 destroy_cursor: push eax @@ -460,13 +501,13 @@ destroy_cursor: pop eax call destroy_kernel_object ret - +;------------------------------------------------------------------------------ align 4 select_cursor: mov eax, [esp+4] mov [_display.cursor], eax ret 4 - +;------------------------------------------------------------------------------ align 4 proc restore_24 stdcall, x:dword, y:dword @@ -484,6 +525,8 @@ proc restore_24 stdcall, x:dword, y:dword mov ecx, [cur.w] lea ecx, [ecx+ecx*2] push ecx +;-------------------------------------- +align 4 @@: mov edi, ebx add ebx, [BytesPerScanLine] @@ -496,11 +539,13 @@ proc restore_24 stdcall, x:dword, y:dword pop ecx pop edi pop esi +;-------------------------------------- +align 4 .ret: pop ebx ret endp - +;------------------------------------------------------------------------------ align 4 proc restore_32 stdcall, x:dword, y:dword @@ -515,6 +560,8 @@ proc restore_32 stdcall, x:dword, y:dword push edi mov esi, cur_saved_data +;-------------------------------------- +align 4 @@: mov edi, ebx add ebx, [BytesPerScanLine] @@ -525,12 +572,14 @@ proc restore_32 stdcall, x:dword, y:dword jnz @B pop edi +;-------------------------------------- +align 4 .ret: pop esi pop ebx ret endp - +;------------------------------------------------------------------------------ align 4 proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword locals @@ -542,7 +591,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov esi, [hcursor] mov ecx, [x] mov eax, [y] - mov ebx, [BytesPerScanLine] +; mov ebx, [BytesPerScanLine] xor edx, edx sub ecx, [esi+CURSOR.hot_x] @@ -568,7 +617,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword sub edx, [y] mov [_dy], edx - mul dword [BytesPerScanLine] +; mul dword [BytesPerScanLine] + mov eax, [BPSLine_calc_area+eax*4] lea edx, [LFB_BASE+ecx*3] add edx, eax mov [cur_saved_base], edx @@ -576,10 +626,14 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword cmp ebx, [Screen_Max_X] jbe @F mov ebx, [Screen_Max_X] +;-------------------------------------- +align 4 @@: cmp edi, [Screen_Max_Y] jbe @F mov edi, [Screen_Max_Y] +;-------------------------------------- +align 4 @@: mov [cur.right], ebx mov [cur.bottom], edi @@ -595,6 +649,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov eax, edi mov edi, cur_saved_data +;-------------------------------------- +align 4 @@: mov esi, edx add edx, [BytesPerScanLine] @@ -613,12 +669,16 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov esi, [hcursor] mov esi, [esi+CURSOR.base] lea edx, [esi+eax*4] +;-------------------------------------- +align 4 .row: mov ecx, [cur.w] mov esi, edx mov edi, ebx add edx, 32*4 add ebx, [BytesPerScanLine] +;-------------------------------------- +align 4 .pix: lodsd test eax, 0xFF000000 @@ -626,6 +686,8 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword mov [edi], ax shr eax, 16 mov [edi+2], al +;-------------------------------------- +align 4 @@: add edi, 3 dec ecx @@ -635,8 +697,7 @@ proc move_cursor_24 stdcall, hcursor:dword, x:dword, y:dword jnz .row ret endp - - +;------------------------------------------------------------------------------ align 4 proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword locals @@ -673,17 +734,22 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword sub edx, [y] mov [_dy], edx - mul dword [BytesPerScanLine] +; mul dword [BytesPerScanLine] + mov eax, [BPSLine_calc_area+eax*4] lea edx, [LFB_BASE+eax+ecx*4] mov [cur_saved_base], edx cmp ebx, [Screen_Max_X] jbe @F mov ebx, [Screen_Max_X] +;-------------------------------------- +align 4 @@: cmp edi, [Screen_Max_Y] jbe @F mov edi, [Screen_Max_Y] +;-------------------------------------- +align 4 @@: mov [cur.right], ebx mov [cur.bottom], edi @@ -699,6 +765,8 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword mov eax, edi mov edi, cur_saved_data +;-------------------------------------- +align 4 @@: mov esi, edx add edx, [BytesPerScanLine] @@ -716,17 +784,23 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword mov esi, [hcursor] mov esi, [esi+CURSOR.base] lea edx, [esi+eax*4] +;-------------------------------------- +align 4 .row: mov ecx, [cur.w] mov esi, edx mov edi, ebx add edx, 32*4 add ebx, [BytesPerScanLine] +;-------------------------------------- +align 4 .pix: lodsd test eax, 0xFF000000 jz @F mov [edi], eax +;-------------------------------------- +align 4 @@: add edi, 4 dec ecx @@ -736,16 +810,158 @@ proc move_cursor_32 stdcall, hcursor:dword, x:dword, y:dword jnz .row ret endp +;------------------------------------------------------------------------------ +align 4 +check_mouse_area_for_getpixel_new: +; in: +; eax = x +; ebx = y +; out: +; ecx = new color +;-------------------------------------- +; check for Y + cmp bx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + cmp bx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area +;-------------------------------------- +; check for X + cmp ax, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + cmp ax, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- + push eax ebx +; offset X + mov ecx, [X_UNDER_subtraction_CUR_hot_x] + sub eax, ecx ; x1 +; offset Y + mov ecx, [Y_UNDER_subtraction_CUR_hot_y] + sub ebx, ecx ; y1 +;-------------------------------------- +; ebx = offset y +; eax = offset x + imul ebx, [cur.w] ;y + add eax, ebx + mov ebx, eax + shl eax, 2 + cmp [ScreenBPP], byte 32 + je @f + sub eax, ebx +;-------------------------------------- +align 4 +@@: + add eax, cur_saved_data + mov ecx, [eax] + and ecx, 0xffffff + add ecx, 0xff000000 + pop ebx eax + ret +;-------------------------------------- +align 4 +.no_mouse_area: + xor ecx, ecx + ret +;----------------------------------------------------------------------------- +align 4 +check_mouse_area_for_putpixel_new: +; in: +; ecx = x shl 16 + y +; eax = color +; out: +; eax = new color +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area + + rol ecx, 16 +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- +align 4 +.1: + push eax +; offset X + mov ax, [X_UNDER_subtraction_CUR_hot_x] + sub cx, ax ; x1 + ror ecx, 16 +; offset Y + mov ax, [Y_UNDER_subtraction_CUR_hot_y] + sub cx, ax ; y1 +;-------------------------------------- +; ecx = (offset x) shl 16 + (offset y) + push ebx + mov ebx, ecx + shr ebx, 16 ; x + and ecx, 0xffff ; y +; ecx = offset y +; ebx = offset x + mov eax, [esp + 4] + + push ebx ecx + imul ecx, [cur.w] ;y + add ecx, ebx + mov ebx, ecx + shl ecx, 2 + cmp [ScreenBPP], byte 24 + je .24 + and eax, 0xFFFFFF + mov [ecx + cur_saved_data], eax ;store new color to + jmp @f +;-------------------------------------- +align 4 +.24: + sub ecx, ebx + mov [ecx + cur_saved_data], ax ;store new color to + shr eax, 16 + mov [ecx + cur_saved_data + 2], al ;store new color to +;-------------------------------------- +align 4 +@@: + pop ecx ebx + + shl ecx, 5 + add ecx, ebx + + mov eax, [current_cursor] + mov eax, [eax+CURSOR.base] + lea eax, [eax+ecx*4] + mov eax, [eax] + + pop ebx + + test eax, 0xFF000000 + jz @f + + pop ecx + ret +;-------------------------------------- +align 4 +@@: + pop eax +;-------------------------------------- +align 4 +.no_mouse_area: + ret +;------------------------------------------------------------------------------ align 4 get_display: mov eax, _display ret - +;------------------------------------------------------------------------------ align 4 init_display: - xor eax, eax mov edi, _display @@ -764,6 +980,7 @@ init_display: test word [SCR_MODE], 0x4000 jz .fail +; jmp .fail mov ebx, restore_32 mov ecx, move_cursor_32 @@ -775,22 +992,47 @@ init_display: mov ecx, move_cursor_24 cmp eax, 24 jne .fail +;-------------------------------------- +align 4 @@: mov [_display.select_cursor], select_cursor mov [_display.move_cursor], ecx mov [_display.restore_cursor], ebx + mov [_display.check_mouse], check_mouse_area_for_putpixel_new + mov [_display.check_m_pixel], check_mouse_area_for_getpixel_new + cmp [PUTPIXEL], dword VGA_putpixel + je @f + cmp [ScreenBPP], byte 32 + je .32 + mov [PUTPIXEL], dword Vesa20_putpixel24_new + jmp @f +;-------------------------------------- +align 4 +.32: + mov [PUTPIXEL], dword Vesa20_putpixel32_new +;-------------------------------------- +align 4 +@@: + stdcall load_cursor, clock_arrow, dword LOAD_FROM_MEM + mov [def_cursor_clock], eax stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM mov [def_cursor], eax ret +;-------------------------------------- +align 4 .fail: xor eax, eax mov [_display.select_cursor], eax mov [_display.move_cursor], eax ret - - +;------------------------------------------------------------------------------ align 4 def_arrow: file 'arrow.cur' +;------------------------------------------------------------------------------ +align 4 +clock_arrow: + file 'arrow_clock.cur' +;------------------------------------------------------------------------------ diff --git a/kernel/branches/net/video/vesa12.inc b/kernel/branches/net/video/vesa12.inc index 6b812a757a..69bebe0213 100644 --- a/kernel/branches/net/video/vesa12.inc +++ b/kernel/branches/net/video/vesa12.inc @@ -1,9 +1,9 @@ -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; -;; Distributed under terms of the GNU General Public License ;; -;; ;; -;; VESA12.INC ;; +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; ;; +;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;; +;; Distributed under terms of the GNU General Public License ;; +;; ;; +;; VESA12.INC ;; ;; ;; ;; Vesa 1.2 functions for MenuetOS ;; ;; ;; diff --git a/kernel/branches/net/video/vesa20.inc b/kernel/branches/net/video/vesa20.inc index 4805f3c4eb..7f3b4c9557 100644 --- a/kernel/branches/net/video/vesa20.inc +++ b/kernel/branches/net/video/vesa20.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2008. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; VESA20.INC ;; @@ -17,7 +17,7 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ +$Revision $ ; If you're planning to write your own video driver I suggest @@ -31,7 +31,7 @@ $Revision$ -;************************************************* +;----------------------------------------------------------------------------- ; getpixel ; ; in: @@ -40,32 +40,79 @@ $Revision$ ; ; ret: ; ecx = 00 RR GG BB - +;----------------------------------------------------------------------------- +align 4 getpixel: push eax ebx edx edi call dword [GETPIXEL] pop edi edx ebx eax ret - +;----------------------------------------------------------------------------- +align 4 Vesa20_getpixel24: ; eax = x ; ebx = y - imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: +; check mouse area for putpixel + test ecx, 0x04000000 ; don't load to mouseunder area + jnz .no_mouseunder + call [_display.check_m_pixel] + test ecx, ecx ;0xff000000 + jnz @f +;-------------------------------------- +align 4 +.no_mouseunder: +;-------------------------------------- +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [eax+eax*2]; edi = x*3 add edi, ebx ; edi = x*3+(y*y multiplier) mov ecx, [LFB_BASE+edi] +;-------------------------------------- +align 4 +@@: and ecx, 0xffffff ret - +;----------------------------------------------------------------------------- +align 4 Vesa20_getpixel32: - imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: +; check mouse area for putpixel + test ecx, 0x04000000 ; don't load to mouseunder area + jnz .no_mouseunder + call [_display.check_m_pixel] + test ecx, ecx ;0xff000000 + jnz @f +;-------------------------------------- +align 4 +.no_mouseunder: +;-------------------------------------- +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) mov ecx, [LFB_BASE+edi] +;-------------------------------------- +align 4 +@@: and ecx, 0xffffff ret - -;************************************************* - +;----------------------------------------------------------------------------- virtual at esp putimg: .real_sx dd ? @@ -80,7 +127,9 @@ virtual at esp .line_increment dd ? .winmap_newline dd ? .screen_newline dd ? - .stack_data = 4*12 + .real_sx_and_abs_cx dd ? + .real_sy_and_abs_cy dd ? + .stack_data = 4*14 .edi dd ? .esi dd ? .ebp dd ? @@ -92,7 +141,7 @@ virtual at esp .ret_addr dd ? .arg_0 dd ? end virtual - +;----------------------------------------------------------------------------- align 16 ; ebx = pointer ; ecx = size [x|y] @@ -100,10 +149,8 @@ align 16 ; ebp = pointer to 'get' function ; esi = pointer to 'init' function ; edi = parameter for 'get' function - vesa20_putimage: pushad - call [_display.disable_mouse] sub esp, putimg.stack_data ; save pointer to image mov [putimg.pti], ebx @@ -138,10 +185,14 @@ vesa20_putimage: add esp, putimg.stack_data popad ret +;-------------------------------------- +align 4 @@: cmp ebx, [putimg.image_sx] jbe .end_x mov ebx, [putimg.image_sx] +;-------------------------------------- +align 4 .end_x: mov [putimg.real_sx], ebx ; init real_sy @@ -154,10 +205,14 @@ vesa20_putimage: add esp, putimg.stack_data popad ret +;-------------------------------------- +align 4 @@: cmp ebx, [putimg.image_sy] jbe .end_y mov ebx, [putimg.image_sy] +;-------------------------------------- +align 4 .end_y: mov [putimg.real_sy], ebx ; line increment @@ -185,121 +240,441 @@ vesa20_putimage: mov esi, [putimg.pti] ; pointer to screen mov edx, [putimg.abs_cy] - imul edx, [BytesPerScanLine] +; imul edx, [BytesPerScanLine] + mov edx, [BPSLine_calc_area+edx*4] mov eax, [putimg.abs_cx] - movzx ebx, byte [ScreenBPP] - shr ebx, 3 +; movzx ebx, byte [ScreenBPP] +; shr ebx, 3 imul eax, ebx add edx, eax ; pointer to pixel map mov eax, [putimg.abs_cy] - imul eax, [Screen_Max_X] - add eax, [putimg.abs_cy] +; imul eax, [Screen_Max_X] +; add eax, [putimg.abs_cy] + mov eax, [d_width_calc_area + eax*4] + add eax, [putimg.abs_cx] add eax, [_WinMapAddress] xchg eax, ebp +;-------------------------------------- + mov ecx, [putimg.real_sx] + add ecx, [putimg.abs_cx] + mov [putimg.real_sx_and_abs_cx], ecx + mov ecx, [putimg.real_sy] + add ecx, [putimg.abs_cy] + mov [putimg.real_sy_and_abs_cy], ecx +;-------------------------------------- ; get process number mov ebx, [CURRENT_TASK] cmp byte [ScreenBPP], 32 je put_image_end_32 -;put_image_end_24: +;-------------------------------------- +put_image_end_24: mov edi, [putimg.real_sy] -align 4 +;-------------------------------------- +; check for hardware cursor + mov ecx, [_display.select_cursor] + cmp ecx, select_cursor + je put_image_end_24_new + cmp ecx, 0 + je put_image_end_24_old +;-------------------------------------- +align 4 .new_line: mov ecx, [putimg.real_sx] -; push ebp edx -align 4 +;-------------------------------------- +align 4 .new_x: push [putimg.edi] mov eax, [putimg.ebp+4] call eax cmp [ebp], bl jne .skip -; mov eax, [esi] ; eax = RRBBGGRR +;-------------------------------------- +; store to real LFB mov [LFB_BASE+edx], ax shr eax, 16 mov [LFB_BASE+edx+2], al +;-------------------------------------- +align 4 .skip: -; add esi, 3 ;[putimg.source_bpp] add edx, 3 inc ebp dec ecx jnz .new_x -; pop edx ebp + add esi, [putimg.line_increment] add edx, [putimg.screen_newline];[BytesPerScanLine] add ebp, [putimg.winmap_newline];[Screen_Max_X] -; inc ebp + cmp [putimg.ebp], putimage_get1bpp jz .correct cmp [putimg.ebp], putimage_get2bpp jz .correct cmp [putimg.ebp], putimage_get4bpp jnz @f +;-------------------------------------- +align 4 .correct: mov eax, [putimg.edi] mov byte [eax], 80h +;-------------------------------------- +align 4 @@: dec edi jnz .new_line +;-------------------------------------- +align 4 .finish: add esp, putimg.stack_data popad ret - -put_image_end_32: - mov edi, [putimg.real_sy] -align 4 +;------------------------------------------------------------------------------ +align 4 +put_image_end_24_old: +;-------------------------------------- +align 4 .new_line: mov ecx, [putimg.real_sx] -; push ebp edx -align 4 +;-------------------------------------- +align 4 .new_x: push [putimg.edi] mov eax, [putimg.ebp+4] call eax cmp [ebp], bl jne .skip -; mov eax, [esi] ; ecx = RRBBGGRR - mov [LFB_BASE+edx], eax +;-------------------------------------- + push ecx + + neg ecx + add ecx, [putimg.real_sx_and_abs_cx + 4] + shl ecx, 16 + add ecx, [putimg.real_sy_and_abs_cy + 4] + sub ecx, edi + +; check mouse area for putpixel + call check_mouse_area_for_putpixel + pop ecx +; store to real LFB + mov [LFB_BASE+edx], ax + shr eax, 16 + mov [LFB_BASE+edx+2], al +;-------------------------------------- +align 4 .skip: -; add esi, [putimg.source_bpp] - add edx, 4 + add edx, 3 inc ebp dec ecx jnz .new_x -; pop edx ebp + add esi, [putimg.line_increment] add edx, [putimg.screen_newline];[BytesPerScanLine] add ebp, [putimg.winmap_newline];[Screen_Max_X] -; inc ebp + cmp [putimg.ebp], putimage_get1bpp jz .correct cmp [putimg.ebp], putimage_get2bpp jz .correct cmp [putimg.ebp], putimage_get4bpp jnz @f +;-------------------------------------- +align 4 .correct: mov eax, [putimg.edi] mov byte [eax], 80h +;-------------------------------------- +align 4 @@: dec edi jnz .new_line + jmp put_image_end_24.finish +;------------------------------------------------------------------------------ +align 4 +put_image_end_24_new: +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- + push ecx + mov ecx, [putimg.real_sy_and_abs_cy + 4] + sub ecx, edi +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area + + rol ecx, 16 + add ecx, [putimg.real_sx_and_abs_cx + 4] + sub ecx, [esp] +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- +; check mouse area for putpixel + call check_mouse_area_for_putpixel_new.1 +;-------------------------------------- +align 4 +.no_mouse_area: + pop ecx +; store to real LFB + mov [LFB_BASE+edx], ax + shr eax, 16 + mov [LFB_BASE+edx+2], al +;-------------------------------------- +align 4 +.skip: + add edx, 3 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line + jmp put_image_end_24.finish +;------------------------------------------------------------------------------ +align 4 +put_image_end_32: + mov edi, [putimg.real_sy] +;-------------------------------------- +; check for hardware cursor + mov ecx, [_display.select_cursor] + cmp ecx, select_cursor + je put_image_end_32_new + cmp ecx, 0 + je put_image_end_32_old +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- +; store to real LFB + mov [LFB_BASE+edx], eax +;-------------------------------------- +align 4 +.skip: + add edx, 4 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line +;-------------------------------------- +align 4 .finish: add esp, putimg.stack_data popad + cmp [SCR_MODE], dword 0x12 + jne @f call VGA__putimage +;-------------------------------------- +align 4 +@@: mov [EGA_counter], 1 ret +;------------------------------------------------------------------------------ +align 4 +put_image_end_32_old: +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- + push ecx + neg ecx + add ecx, [putimg.real_sx_and_abs_cx + 4] + shl ecx, 16 + add ecx, [putimg.real_sy_and_abs_cy + 4] + sub ecx, edi -;************************************************* +; check mouse area for putpixel + call check_mouse_area_for_putpixel + pop ecx +; store to real LFB + mov [LFB_BASE+edx], eax +;-------------------------------------- +align 4 +.skip: + add edx, 4 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line + jmp put_image_end_32.finish +;------------------------------------------------------------------------------ +align 4 +put_image_end_32_new: +;-------------------------------------- +align 4 +.new_line: + mov ecx, [putimg.real_sx] +;-------------------------------------- +align 4 +.new_x: + push [putimg.edi] + mov eax, [putimg.ebp+4] + call eax + cmp [ebp], bl + jne .skip +;-------------------------------------- + push ecx + mov ecx, [putimg.real_sy_and_abs_cy + 4] + sub ecx, edi +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area + + rol ecx, 16 + add ecx, [putimg.real_sx_and_abs_cx + 4] + sub ecx, [esp] +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- +; check mouse area for putpixel + call check_mouse_area_for_putpixel_new.1 +;-------------------------------------- +align 4 +.no_mouse_area: + pop ecx +; store to real LFB + mov [LFB_BASE+edx], eax +;-------------------------------------- +align 4 +.skip: + add edx, 4 + inc ebp + dec ecx + jnz .new_x + + add esi, [putimg.line_increment] + add edx, [putimg.screen_newline];[BytesPerScanLine] + add ebp, [putimg.winmap_newline];[Screen_Max_X] + + cmp [putimg.ebp], putimage_get1bpp + jz .correct + cmp [putimg.ebp], putimage_get2bpp + jz .correct + cmp [putimg.ebp], putimage_get4bpp + jnz @f +;-------------------------------------- +align 4 +.correct: + mov eax, [putimg.edi] + mov byte [eax], 80h +;-------------------------------------- +align 4 +@@: + dec edi + jnz .new_line + jmp put_image_end_32.finish +;------------------------------------------------------------------------------ align 4 __sys_putpixel: ; eax = x coordinate ; ebx = y coordinate ; ecx = ?? RR GG BB ; 0x01000000 negation + ; 0x02000000 used for draw_rectangle without top line + ; for example drawwindow_III and drawwindow_IV ; edi = 0x00000001 force ;;; mov [novesachecksum], dword 0 @@ -312,72 +687,197 @@ __sys_putpixel: jnz .forced ; not forced: - - push eax - mov edx, [_display.width]; screen x size - imul edx, ebx - add eax, [_WinMapAddress] + mov edx, [d_width_calc_area + ebx*4] + add edx, [_WinMapAddress] movzx edx, byte [eax+edx] cmp edx, [CURRENT_TASK] - pop eax jne .exit - +;-------------------------------------- +align 4 .forced: ; check if negation test ecx, 0x01000000 jz .noneg + call getpixel not ecx + + rol ecx, 8 + mov cl, [esp+32-8+3] + ror ecx, 8 mov [esp+32-8], ecx +;-------------------------------------- +align 4 .noneg: ; OK to set pixel call dword [PUTPIXEL]; call the real put_pixel function +;-------------------------------------- +align 4 .exit: popad ret - +;----------------------------------------------------------------------------- align 4 Vesa20_putpixel24: ; eax = x ; ebx = y - imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ecx, eax + shl ecx, 16 + mov cx, bx + +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [eax+eax*2]; edi = x*3 mov eax, [esp+32-8+4] +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], 0 + jne @f +; check mouse area for putpixel + test eax, 0x04000000 + jnz @f + call check_mouse_area_for_putpixel +;-------------------------------------- +align 4 +@@: +; store to real LFB mov [LFB_BASE+ebx+edi], ax shr eax, 16 mov [LFB_BASE+ebx+edi+2], al ret +;----------------------------------------------------------------------------- +align 4 +Vesa20_putpixel24_new: +; eax = x +; ebx = y + mov ecx, eax + shl ecx, 16 + mov cx, bx +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] + lea edi, [eax+eax*2]; edi = x*3 + mov eax, [esp+32-8+4] +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + jne @f +; check mouse area for putpixel + test eax, 0x04000000 + jnz @f +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb @f + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae @f + + rol ecx, 16 +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb @f + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae @f + + call check_mouse_area_for_putpixel_new.1 +;-------------------------------------- +align 4 +@@: +; store to real LFB + mov [LFB_BASE+ebx+edi], ax + shr eax, 16 + mov [LFB_BASE+ebx+edi+2], al + ret +;----------------------------------------------------------------------------- align 4 Vesa20_putpixel32: ; eax = x ; ebx = y - imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ecx, eax + shl ecx, 16 + mov cx, bx + +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) mov eax, [esp+32-8+4]; eax = color +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], 0 + jne @f +; check mouse area for putpixel + test eax, 0x04000000 + jnz @f + call check_mouse_area_for_putpixel +;-------------------------------------- +align 4 +@@: + and eax, 0xffffff +; store to real LFB mov [LFB_BASE+edi], eax ret +;----------------------------------------------------------------------------- +align 4 +Vesa20_putpixel32_new: +; eax = x +; ebx = y + mov ecx, eax + shl ecx, 16 + mov cx, bx -;************************************************* +; imul ebx, [BytesPerScanLine] ; ebx = y * y multiplier + mov ebx, [BPSLine_calc_area+ebx*4] + lea edi, [ebx+eax*4]; edi = x*4+(y*y multiplier) + mov eax, [esp+32-8+4]; eax = color +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + jne @f +; check mouse area for putpixel + test eax, 0x04000000 + jnz @f +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb @f -;align 4 + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae @f + + rol ecx, 16 +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb @f + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae @f + + call check_mouse_area_for_putpixel_new.1 +;-------------------------------------- +align 4 +@@: + and eax, 0xffffff +; store to real LFB + mov [LFB_BASE+edi], eax + ret +;----------------------------------------------------------------------------- +align 4 calculate_edi: - mov edi, ebx - imul edi, [Screen_Max_X] - add edi, ebx +; mov edi, ebx +; imul edi, [Screen_Max_X] +; add edi, ebx + mov edi, [d_width_calc_area + ebx*4] add edi, eax ret - -;************************************************* - +;----------------------------------------------------------------------------- ; DRAWLINE - +;----------------------------------------------------------------------------- align 4 __sys_draw_line: -; inc [mouse_pause] - call [_display.disable_mouse] - ; draw a line ; eax = HIWORD = x1 ; LOWORD = x2 @@ -414,8 +914,12 @@ dl_dy equ esp+0 call vline push edx ; necessary to rightly restore stack frame at .exit jmp .exit +;-------------------------------------- +align 4 .x2lx1: neg esi ; get esi absolute value +;-------------------------------------- +align 4 .no_vline: ; checking y-axis... sub ebp, ebx ; ebp = y2-y1 @@ -425,9 +929,12 @@ dl_dy equ esp+0 mov edx, [dl_x2]; else (if y1=y2) call hline jmp .exit - +;-------------------------------------- +align 4 .y2ly1: neg ebp ; get ebp absolute value +;-------------------------------------- +align 4 .no_hline: cmp ebp, esi jle .x_rules ; |y2-y1| < |x2-x1| ? @@ -440,6 +947,8 @@ dl_dy equ esp+0 mov edx, [dl_y2] mov [dl_y2], ebx mov [dl_y1], edx +;-------------------------------------- +align 4 .no_reverse1: mov eax, [dl_dx] cdq ; extend eax sing to edx @@ -451,13 +960,16 @@ dl_dy equ esp+0 cmp ebp, edx jb @f inc eax +;-------------------------------------- +align 4 @@: ;-------------------------------------- mov edx, ebp ; edx = counter (number of pixels to draw) mov ebp, 1 *65536; <<16 ; ebp = dy = 1.0 mov esi, eax ; esi = dx jmp .y_rules - +;-------------------------------------- +align 4 .x_rules: cmp [dl_x2], eax ; make sure x1 is at the begining jge .no_reverse2 @@ -468,6 +980,8 @@ dl_dy equ esp+0 mov edx, [dl_y2] mov [dl_y2], ebx mov [dl_y1], edx +;-------------------------------------- +align 4 .no_reverse2: xor edx, edx mov eax, [dl_dy] @@ -480,16 +994,22 @@ dl_dy equ esp+0 cmp esi, edx jb @f inc eax +;-------------------------------------- +align 4 @@: ;-------------------------------------- mov edx, esi ; edx = counter (number of pixels to draw) mov esi, 1 *65536;<< 16 ; esi = dx = 1.0 mov ebp, eax ; ebp = dy +;-------------------------------------- +align 4 .y_rules: mov eax, [dl_x1] mov ebx, [dl_y1] shl eax, 16 shl ebx, 16 + + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area ;----------------------------------------------------------------------------- align 4 .draw: @@ -499,6 +1019,8 @@ align 4 test ah, 0x80 jz @f add eax, 1 shl 16 +;-------------------------------------- +align 4 @@: ;-------------------------------------- shr eax, 16 @@ -507,10 +1029,14 @@ align 4 test bh, 0x80 jz @f add ebx, 1 shl 16 +;-------------------------------------- +align 4 @@: ;-------------------------------------- shr ebx, 16 - call [putpixel] +; and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel pop ebx eax add ebx, ebp ; y = y+dy add eax, esi ; x = x+dx @@ -519,15 +1045,18 @@ align 4 ; force last drawn pixel to be at (x2,y2) mov eax, [dl_x2] mov ebx, [dl_y2] - call [putpixel] +; and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +; call [putpixel] + call __sys_putpixel +;-------------------------------------- +align 4 .exit: add esp, 6*4 popa -; dec [mouse_pause] - call [draw_pointer] +; call [draw_pointer] ret - - +;------------------------------------------------------------------------------ +align 4 hline: ; draw an horizontal line ; eax = x1 @@ -539,16 +1068,22 @@ hline: cmp edx, eax ; make sure x2 is above x1 jge @f xchg eax, edx -align 4 +;-------------------------------------- +align 4 @@: - call [putpixel] + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +;-------------------------------------- +align 4 +@@: +; call [putpixel] + call __sys_putpixel inc eax cmp eax, edx jle @b pop edx eax ret - - +;------------------------------------------------------------------------------ +align 4 vline: ; draw a vertical line ; eax = x @@ -560,19 +1095,22 @@ vline: cmp edx, ebx ; make sure y2 is above y1 jge @f xchg ebx, edx -align 4 +;-------------------------------------- +align 4 @@: - call [putpixel] + and ecx, 0xFBFFFFFF ;negate 0x04000000 save to mouseunder area +;-------------------------------------- +align 4 +@@: +; call [putpixel] + call __sys_putpixel inc ebx cmp ebx, edx jle @b pop edx ebx ret - - -;************************************************* - - +;------------------------------------------------------------------------------ +align 4 virtual at esp drbar: .bar_sx dd ? @@ -586,9 +1124,11 @@ drbar: .color dd ? .line_inc_scr dd ? .line_inc_map dd ? - .stack_data = 4*11 + .real_sx_and_abs_cx dd ? + .real_sy_and_abs_cy dd ? + .stack_data = 4*13 end virtual - +;-------------------------------------- align 4 ; eax cx ; ebx cy @@ -597,7 +1137,6 @@ align 4 ; edi color vesa20_drawbar: pushad - call [_display.disable_mouse] sub esp, drbar.stack_data mov [drbar.color], edi sub edx, ebx @@ -621,16 +1160,22 @@ vesa20_drawbar: ; \end{diamond}[20.08.2006] sub ebx, [drbar.bar_cx] ja @f +;-------------------------------------- +align 4 .exit: ;// mike.dld, 2005-01-29 add esp, drbar.stack_data popad xor eax, eax inc eax ret +;-------------------------------------- +align 4 @@: cmp ebx, [drbar.bar_sx] jbe .end_x mov ebx, [drbar.bar_sx] +;-------------------------------------- +align 4 .end_x: mov [drbar.real_sx], ebx ; real_sy = MIN(wnd_sy-bar_cy, bar_sy); @@ -645,10 +1190,14 @@ vesa20_drawbar: xor eax, eax inc eax ret +;-------------------------------------- +align 4 @@: cmp ebx, [drbar.bar_sy] jbe .end_y mov ebx, [drbar.bar_sy] +;-------------------------------------- +align 4 .end_y: mov [drbar.real_sy], ebx ; line_inc_map @@ -666,45 +1215,71 @@ vesa20_drawbar: mov [drbar.line_inc_scr], eax ; pointer to screen mov edx, [drbar.abs_cy] - imul edx, [BytesPerScanLine] +; imul edx, [BytesPerScanLine] + mov edx, [BPSLine_calc_area+edx*4] mov eax, [drbar.abs_cx] -; movzx ebx, byte [ScreenBPP] -; shr ebx, 3 imul eax, ebx add edx, eax ; pointer to pixel map mov eax, [drbar.abs_cy] - imul eax, [Screen_Max_X] - add eax, [drbar.abs_cy] +; imul eax, [Screen_Max_X] +; add eax, [drbar.abs_cy] + mov eax, [d_width_calc_area + eax*4] + add eax, [drbar.abs_cx] add eax, [_WinMapAddress] xchg eax, ebp +;-------------------------------------- + mov ebx, [drbar.real_sx] + add ebx, [drbar.abs_cx] + mov [drbar.real_sx_and_abs_cx], ebx + mov ebx, [drbar.real_sy] + add ebx, [drbar.abs_cy] + mov [drbar.real_sy_and_abs_cy], ebx + + add edx, LFB_BASE +;-------------------------------------- ; get process number - mov ebx, [CURRENT_TASK] + mov ebx, [CURRENT_TASK] ; bl - process num + mov esi, [drbar.real_sy] + mov eax, [drbar.color] ; BBGGRR00 + rol eax, 8 + mov bh, al ; 0x80 drawing gradient bars + ror eax, 8 cmp byte [ScreenBPP], 24 jne draw_bar_end_32 +;-------------------------------------- +align 4 draw_bar_end_24: - mov eax, [drbar.color] ;; BBGGRR00 - mov bh, al ;; bh = BB - shr eax, 8 ;; eax = RRGG -; eax - color high RRGG +; eax - color high RRGGBB ; bl - process num -; bh - color low BB ; ecx - temp ; edx - pointer to screen ; esi - counter ; edi - counter - mov esi, [drbar.real_sy] -align 4 +;-------------------------------------- +; check for hardware cursor + mov ecx, [_display.select_cursor] + cmp ecx, select_cursor + je draw_bar_end_24_new + cmp ecx, 0 + je draw_bar_end_24_old +;-------------------------------------- +align 4 .new_y: mov edi, [drbar.real_sx] -align 4 +;-------------------------------------- +align 4 .new_x: cmp byte [ebp], bl jne .skip - - mov [LFB_BASE+edx], bh - mov [LFB_BASE+edx + 1], ax +;-------------------------------------- +; store to real LFB + mov [edx], ax + shr eax, 16 + mov [edx + 2], al +;-------------------------------------- +align 4 .skip: ; add pixel add edx, 3 @@ -714,33 +1289,176 @@ align 4 ; add line add edx, [drbar.line_inc_scr] add ebp, [drbar.line_inc_map] -; drawing gradient bars - test eax, 0x00800000 +; drawing gradient bars + test bh, 0x80 jz @f - test bh, bh + test al, al jz @f - dec bh + dec al +;-------------------------------------- +align 4 @@: -; dec esi jnz .new_y +;-------------------------------------- +align 4 +.end: add esp, drbar.stack_data popad xor eax, eax ret - -draw_bar_end_32: - mov eax, [drbar.color] ;; BBGGRR00 - mov esi, [drbar.real_sy] -align 4 +;------------------------------------------------------------------------------ +align 4 +draw_bar_end_24_old: +;-------------------------------------- +align 4 .new_y: mov edi, [drbar.real_sx] -align 4 +;-------------------------------------- +align 4 .new_x: cmp byte [ebp], bl jne .skip +;-------------------------------------- + mov ecx, [drbar.real_sx_and_abs_cx] + sub ecx, edi + shl ecx, 16 + add ecx, [drbar.real_sy_and_abs_cy] + sub ecx, esi +; check mouse area for putpixel + call check_mouse_area_for_putpixel +; store to real LFB + mov [edx], ax + shr eax, 16 + mov [edx + 2], al + mov eax, [drbar.color] +;-------------------------------------- +align 4 +.skip: +; add pixel + add edx, 3 + inc ebp + dec edi + jnz .new_x +; add line + add edx, [drbar.line_inc_scr] + add ebp, [drbar.line_inc_map] +; drawing gradient bars + test bh, 0x80 + jz @f + test al, al + jz @f + dec al +;-------------------------------------- +align 4 +@@: + dec esi + jnz .new_y + jmp draw_bar_end_24.end +;------------------------------------------------------------------------------ +align 4 +draw_bar_end_24_new: +;-------------------------------------- +align 4 +.new_y: + mov edi, [drbar.real_sx] +;-------------------------------------- +align 4 +.new_x: + cmp byte [ebp], bl + jne .skip +;-------------------------------------- + mov ecx, [drbar.real_sy_and_abs_cy] + sub ecx, esi +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area - mov [LFB_BASE+edx], eax + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area + + rol ecx, 16 + add ecx, [drbar.real_sx_and_abs_cx] + sub ecx, edi +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- +; check mouse area for putpixel + push eax + call check_mouse_area_for_putpixel_new.1 + mov [edx], ax + shr eax, 16 + mov [edx + 2], al + pop eax + jmp .skip +; store to real LFB +;-------------------------------------- +align 4 +.no_mouse_area: + mov [edx], ax + ror eax, 16 + mov [edx + 2], al + rol eax, 16 +;-------------------------------------- +align 4 +.skip: +; add pixel + add edx, 3 + inc ebp + dec edi + jnz .new_x +; add line + add edx, [drbar.line_inc_scr] + add ebp, [drbar.line_inc_map] +; drawing gradient bars + test bh, 0x80 + jz @f + test al, al + jz @f + dec al +;-------------------------------------- +align 4 +@@: + dec esi + jnz .new_y + jmp draw_bar_end_24.end +;------------------------------------------------------------------------------ +align 4 +draw_bar_end_32: +; eax - color high RRGGBB +; bl - process num +; ecx - temp +; edx - pointer to screen +; esi - counter +; edi - counter +;-------------------------------------- +; check for hardware cursor + mov ecx, [_display.select_cursor] + cmp ecx, select_cursor + je draw_bar_end_32_new + cmp ecx, 0 + je draw_bar_end_32_old +;-------------------------------------- +align 4 +.new_y: + mov edi, [drbar.real_sx] +;-------------------------------------- +align 4 +.new_x: + cmp byte [ebp], bl + jne .skip +;-------------------------------------- +; store to real LFB + mov [edx], eax + mov eax, [drbar.color] +;-------------------------------------- +align 4 .skip: ; add pixel add edx, 4 @@ -750,35 +1468,161 @@ align 4 ; add line add edx, [drbar.line_inc_scr] add ebp, [drbar.line_inc_map] -; drawing gradient bars - test eax, 0x80000000 +; drawing gradient bars + test bh, 0x80 jz @f test al, al jz @f dec al +;-------------------------------------- +align 4 @@: -; dec esi jnz .new_y +;-------------------------------------- +align 4 +.end: add esp, drbar.stack_data popad + cmp [SCR_MODE], dword 0x12 + jne @f call VGA_draw_bar +;-------------------------------------- +align 4 +@@: xor eax, eax mov [EGA_counter], 1 ret +;------------------------------------------------------------------------------ +align 4 +draw_bar_end_32_old: +;-------------------------------------- +align 4 +.new_y: + mov edi, [drbar.real_sx] +;-------------------------------------- +align 4 +.new_x: + cmp byte [ebp], bl + jne .skip +;-------------------------------------- + mov ecx, [drbar.real_sx_and_abs_cx] + sub ecx, edi + shl ecx, 16 + add ecx, [drbar.real_sy_and_abs_cy] + sub ecx, esi +; check mouse area for putpixel + call check_mouse_area_for_putpixel +; store to real LFB + mov [edx], eax + mov eax, [drbar.color] +;-------------------------------------- +align 4 +.skip: +; add pixel + add edx, 4 + inc ebp + dec edi + jnz .new_x +; add line + add edx, [drbar.line_inc_scr] + add ebp, [drbar.line_inc_map] +; drawing gradient bars + test bh, 0x80 + jz @f + test al, al + jz @f + dec al +;-------------------------------------- +align 4 +@@: + dec esi + jnz .new_y + jmp draw_bar_end_32.end +;------------------------------------------------------------------------------ +align 4 +draw_bar_end_32_new: +;-------------------------------------- +align 4 +.new_y: + mov edi, [drbar.real_sx] +;-------------------------------------- +align 4 +.new_x: + cmp byte [ebp], bl + jne .skip +;-------------------------------------- + mov ecx, [drbar.real_sy_and_abs_cy] + sub ecx, esi +;-------------------------------------- +; check for Y + cmp cx, [Y_UNDER_subtraction_CUR_hot_y] + jb .no_mouse_area + + cmp cx, [Y_UNDER_sub_CUR_hot_y_add_curh] + jae .no_mouse_area + + rol ecx, 16 + add ecx, [drbar.real_sx_and_abs_cx] + sub ecx, edi +;-------------------------------------- +; check for X + cmp cx, [X_UNDER_subtraction_CUR_hot_x] + jb .no_mouse_area + + cmp cx, [X_UNDER_sub_CUR_hot_x_add_curh] + jae .no_mouse_area +;-------------------------------------- +; check mouse area for putpixel + push eax + call check_mouse_area_for_putpixel_new.1 + mov [edx], eax + pop eax + jmp .skip +; store to real LFB +;-------------------------------------- +align 4 +.no_mouse_area: + mov [edx], eax +;-------------------------------------- +align 4 +.skip: +; add pixel + add edx, 4 + inc ebp + dec edi + jnz .new_x +; add line + add edx, [drbar.line_inc_scr] + add ebp, [drbar.line_inc_map] +; drawing gradient bars + test bh, 0x80 + jz @f + test al, al + jz @f + dec al +;-------------------------------------- +align 4 +@@: + dec esi + jnz .new_y + jmp draw_bar_end_32.end +;------------------------------------------------------------------------------ align 4 vesa20_drawbackground_tiled: - call [_display.disable_mouse] pushad ; External loop for all y from start to end mov ebx, [draw_data+32+RECT.top] ; y start +;-------------------------------------- +align 4 dp2: mov ebp, [draw_data+32+RECT.left] ; x start ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; and LFB data (output for our function) [edi] - mov eax, [BytesPerScanLine] - mul ebx +; mov eax, [BytesPerScanLine] +; mul ebx + mov eax, [BPSLine_calc_area+ebx*4] xchg ebp, eax add ebp, eax add ebp, eax @@ -786,6 +1630,8 @@ dp2: cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size jz @f add ebp, eax +;-------------------------------------- +align 4 @@: add ebp, LFB_BASE ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB @@ -819,16 +1665,47 @@ dp2: ; edx = 1 ; esi -> bgr memory, edi -> output ; ebp = offset in WinMapAddress +;-------------------------------------- +align 4 dp3: cmp [ebp], dl jnz nbgp - movsb - movsb - movsb - jmp @f +;-------------------------------------- + push eax ecx + + mov ecx, eax + shl ecx, 16 + add ecx, ebx + + mov eax, [esi] + +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: + and eax, 0xffffff +; check mouse area for putpixel + call [_display.check_mouse] +;-------------------------------------- +align 4 +.no_mouseunder: +; store to real LFB + mov [edi], ax + shr eax, 16 + mov [edi+2], al + + pop ecx eax +;-------------------------------------- +align 4 nbgp: add esi, 3 add edi, 3 +;-------------------------------------- +align 4 @@: cmp [ScreenBPP], byte 25 ; 24 or 32 bpp? sbb edi, -1 ; +1 for 32 bpp @@ -845,6 +1722,8 @@ nbgp: sub esi, ecx sub esi, ecx jmp dp3 +;-------------------------------------- +align 4 dp4: ; next scan line inc ebx @@ -852,14 +1731,16 @@ dp4: jbe dp2 popad mov [EGA_counter], 1 + cmp [SCR_MODE], dword 0x12 + jne @f call VGA_drawbackground +;-------------------------------------- +align 4 +@@: ret - -; ---------- - - +;------------------------------------------------------------------------------ +align 4 vesa20_drawbackground_stretch: - call [_display.disable_mouse] pushad ; Helper variables ; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1) @@ -885,8 +1766,9 @@ vesa20_drawbackground_stretch: mov ebp, [draw_data+32+RECT.left] ; x start ; 1) Calculate pointers in WinMapAddress (does pixel belong to OS thread?) [ebp] ; and LFB data (output for our function) [edi] - mov eax, [BytesPerScanLine] - mul ebx +; mov eax, [BytesPerScanLine] +; mul ebx + mov eax, [BPSLine_calc_area+ebx*4] xchg ebp, eax add ebp, eax add ebp, eax @@ -894,6 +1776,8 @@ vesa20_drawbackground_stretch: cmp [ScreenBPP], byte 24 ; 24 or 32 bpp ? - x size jz @f add ebp, eax +;-------------------------------------- +align 4 @@: ; ebp:=Y*BytesPerScanLine+X*BytesPerPixel+AddrLFB call calculate_edi @@ -924,6 +1808,8 @@ vesa20_drawbackground_stretch: push edx push esi ; 3) Smooth horizontal +;-------------------------------------- +align 4 bgr_resmooth0: mov ecx, [esp+8] mov edx, [esp+4] @@ -931,6 +1817,8 @@ bgr_resmooth0: push edi mov edi, bgr_cur_line call smooth_line +;-------------------------------------- +align 4 bgr_resmooth1: mov eax, [esp+16+4] inc eax @@ -944,8 +1832,12 @@ bgr_resmooth1: add esi, [BgrDataWidth] mov edi, bgr_next_line call smooth_line +;-------------------------------------- +align 4 bgr.no2nd: pop edi +;-------------------------------------- +align 4 sdp3: xor esi, esi mov ecx, [esp+12] @@ -961,6 +1853,8 @@ sdp3: ; precalculated constants: ; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1) ; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1) +;-------------------------------------- +align 4 sdp3a: mov eax, [_WinMapAddress] cmp [ebp+eax], byte 1 @@ -970,12 +1864,33 @@ sdp3a: jz .novert mov ebx, [bgr_next_line+esi] call [overlapping_of_points_ptr] +;-------------------------------------- +align 4 .novert: - + push ecx +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: + mov ecx, [esp+20+4] ;x + shl ecx, 16 + add ecx, [esp+24+4] ;y +; check mouse area for putpixel + call [_display.check_mouse] +;-------------------------------------- +align 4 +.no_mouseunder: +; store to real LFB mov [LFB_BASE+edi], ax shr eax, 16 - mov [LFB_BASE+edi+2], al + pop ecx +;-------------------------------------- +align 4 snbgp: cmp [ScreenBPP], byte 25 sbb edi, -4 @@ -986,6 +1901,8 @@ snbgp: add esi, 4 cmp eax, [draw_data+32+RECT.right] jbe sdp3a +;-------------------------------------- +align 4 sdp4: ; next y mov ebx, [esp+24] @@ -1004,6 +1921,8 @@ sdp4: cmp [ScreenBPP], byte 24 jz @f sub edi, eax +;-------------------------------------- +align 4 @@: add edi, [BytesPerScanLine] ; restore ecx,edx; advance esi to next background line @@ -1030,19 +1949,29 @@ sdp4: inc ecx rep movsd jmp bgr_resmooth1 +;-------------------------------------- +align 4 sdpdone: add esp, 44 popad mov [EGA_counter], 1 + cmp [SCR_MODE], dword 0x12 + jne @f call VGA_drawbackground +;-------------------------------------- +align 4 +@@: ret uglobal +;-------------------------------------- align 4 bgr_cur_line rd 1920 ; maximum width of screen bgr_next_line rd 1920 +;-------------------------------------- endg - +;-------------------------------------- +align 4 smooth_line: mov al, [esi+2] shl eax, 16 @@ -1052,6 +1981,8 @@ smooth_line: mov ebx, [esi+2] shr ebx, 8 call [overlapping_of_points_ptr] +;-------------------------------------- +align 4 @@: stosd mov eax, [esp+20+8] @@ -1066,11 +1997,13 @@ smooth_line: lea eax, [eax*3] sub esi, eax jmp smooth_line +;-------------------------------------- +align 4 @@: mov eax, [draw_data+32+RECT.left] mov [esp+20+8], eax ret - +;------------------------------------------------------------------------------ align 16 overlapping_of_points: if 0 @@ -1135,18 +2068,25 @@ else end if iglobal +;-------------------------------------- align 4 overlapping_of_points_ptr dd overlapping_of_points +;-------------------------------------- endg - +;------------------------------------------------------------------------------ +align 4 init_background: mov edi, BgrAuxTable xor edx, edx +;-------------------------------------- +align 4 .loop2: mov eax, edx shl eax, 8 neg eax mov ecx, 0x200 +;-------------------------------------- +align 4 .loop1: mov byte [edi], ah inc edi @@ -1157,9 +2097,11 @@ init_background: test byte [cpu_caps+(CAPS_MMX/8)], 1 shl (CAPS_MMX mod 8) jz @f mov [overlapping_of_points_ptr], overlapping_of_points_mmx +;-------------------------------------- +align 4 @@: ret - +;------------------------------------------------------------------------------ align 16 overlapping_of_points_mmx: movd mm0, eax @@ -1179,3 +2121,4 @@ overlapping_of_points_mmx: paddb mm4, mm1 movd eax, mm4 ret +;------------------------------------------------------------------------------ diff --git a/kernel/branches/net/video/vga.inc b/kernel/branches/net/video/vga.inc index 920c57c6a4..40e5beb679 100644 --- a/kernel/branches/net/video/vga.inc +++ b/kernel/branches/net/video/vga.inc @@ -1,6 +1,6 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; -;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;; +;; Copyright (C) KolibriOS team 2004-2012. All rights reserved. ;; ;; Distributed under terms of the GNU General Public License ;; ;; ;; ;; VGA.INC ;; @@ -11,9 +11,10 @@ ;; ;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -$Revision$ - +$Revision $ +;------------------------------------------------------------------------------ +align 4 paletteVGA: ;16 colour palette @@ -24,9 +25,9 @@ paletteVGA: mov ecx, 16 mov dx, 0x3c9 xor eax, eax - - palvganew: - +;-------------------------------------- +align 4 +palvganew: mov al, 0 test ah, 4 jz palvgalbl1 @@ -34,7 +35,9 @@ paletteVGA: test ah, 8 jz palvgalbl1 add al, 32 - palvgalbl1: +;-------------------------------------- +align 4 +palvgalbl1: out dx, al; red 0,31 or 63 mov al, 0 test ah, 2 @@ -43,7 +46,9 @@ paletteVGA: test ah, 8 jz palvgalbl2 add al, 32 - palvgalbl2: +;-------------------------------------- +align 4 +palvgalbl2: out dx, al; blue 0,31 or 63 mov al, 0 test ah, 1 @@ -52,7 +57,9 @@ paletteVGA: test ah, 8 jz palvgalbl3 add al, 32 - palvgalbl3: +;-------------------------------------- +align 4 +palvgalbl3: out dx, al; green 0,31 or 63 add ah, 1 loop palvganew @@ -60,59 +67,76 @@ paletteVGA: ; mov ax, 0005h ; out dx, ax ret - +;------------------------------------------------------------------------------ +align 4 palette320x200: - mov edx, 0x3c8 xor eax, eax out dx, al mov ecx, 256 mov edx, 0x3c9 xor eax, eax - - palnew: +;-------------------------------------- +align 4 +palnew: mov al, 0 test ah, 64 jz pallbl1 add al, 21 - pallbl1: +;-------------------------------------- +align 4 +pallbl1: test ah, 128 jz pallbl2 add al, 42 - pallbl2: +;-------------------------------------- +align 4 +pallbl2: out dx, al mov al, 0 test ah, 8 jz pallbl3 add al, 8 - pallbl3: +;-------------------------------------- +align 4 +pallbl3: test ah, 16 jz pallbl4 add al, 15 - pallbl4: +;-------------------------------------- +align 4 +pallbl4: test ah, 32 jz pallbl5 add al, 40 - pallbl5: +;-------------------------------------- +align 4 +pallbl5: out dx, al mov al, 0 test ah, 1 jz pallbl6 add al, 8 - pallbl6: +;-------------------------------------- +align 4 +pallbl6: test ah, 2 jz pallbl7 add al, 15 - pallbl7: +;-------------------------------------- +align 4 +pallbl7: test ah, 4 jz pallbl8 add al, 40 - pallbl8: +;-------------------------------------- +align 4 +pallbl8: out dx, al add ah, 1 loop palnew - ret +;------------------------------------------------------------------------------ align 4 uglobal novesachecksum dd 0x0 @@ -123,13 +147,12 @@ uglobal temp: .cx dd 0 endg +;------------------------------------------------------------------------------ align 4 checkVga_N13: - cmp [SCR_MODE], dword 0x13 jne @f -; cnvl: pushad cmp [EGA_counter], 1 je novesal @@ -137,21 +160,28 @@ checkVga_N13: cmp ecx, [novesachecksum] jne novesal popad - @@: +;-------------------------------------- +align 4 +@@: ret - - novesal: +;-------------------------------------- +align 4 +novesal: mov [novesachecksum], ecx mov ecx, 0 movzx eax, word [MOUSE_Y] cmp eax, 100 jge m13l3 mov eax, 100 - m13l3: +;-------------------------------------- +align 4 +m13l3: cmp eax, 480-100 jbe m13l4 mov eax, 480-100 - m13l4: +;-------------------------------------- +align 4 +m13l4: sub eax, 100 imul eax, 640*4 add ecx, eax @@ -159,11 +189,15 @@ checkVga_N13: cmp eax, 160 jge m13l1 mov eax, 160 - m13l1: +;-------------------------------------- +align 4 +m13l1: cmp eax, 640-160 jbe m13l2 mov eax, 640-160 - m13l2: +;-------------------------------------- +align 4 +m13l2: sub eax, 160 shl eax, 2 add ecx, eax @@ -173,7 +207,9 @@ checkVga_N13: mov edx, 200 mov ecx, 320 cld - m13pix: +;-------------------------------------- +align 4 +m13pix: lodsd test eax, eax jz .save_pixel @@ -188,7 +224,9 @@ checkVga_N13: and ebx, (128+64)*256*256; red shr ebx, 8+8 add eax, ebx - .save_pixel: +;-------------------------------------- +align 4 +.save_pixel: stosb loop m13pix mov ecx, 320 @@ -198,17 +236,18 @@ checkVga_N13: mov [EGA_counter], 0 popad ret - +;------------------------------------------------------------------------------ +align 4 VGA_drawbackground: ; draw all - cmp [SCR_MODE], dword 0x12 - jne .end pushad mov esi, [LFBAddress] mov edi, VGABasePtr mov ebx, 640/32; 640*480/(8*4) mov edx, 480 - @@: +;-------------------------------------- +align 4 +@@: push ebx edx esi edi shl edx, 9 lea edx, [edx+edx*4] @@ -221,9 +260,9 @@ VGA_drawbackground: jnz @r call VGA_draw_long_line_1 popad - .end: ret - +;------------------------------------------------------------------------------ +align 4 VGA_draw_long_line: mov dx, 3ceh mov ax, 0ff08h @@ -231,7 +270,9 @@ VGA_draw_long_line: out dx, ax mov ax, 0005h out dx, ax - m12pix: +;-------------------------------------- +align 4 +m12pix: call VGA_draw_32_pixels dec ebx jnz m12pix @@ -246,7 +287,8 @@ VGA_draw_long_line: out dx, al sti ret - +;------------------------------------------------------------------------------ +align 4 VGA_draw_32_pixels: xor eax, eax mov ebp, VGA_8_pixels @@ -255,9 +297,13 @@ VGA_draw_32_pixels: mov [ebp+8], eax mov [ebp+12], eax mov ch, 4 - .main_loop: +;-------------------------------------- +align 4 +.main_loop: mov cl, 8 - .convert_pixels_to_VGA: +;-------------------------------------- +align 4 +.convert_pixels_to_VGA: lodsd ; eax = 24bit colour test eax, eax jz .end @@ -273,14 +319,18 @@ VGA_draw_32_pixels: cmp al, 170 jbe .p13green or [ebp+12], ch - .p13green: +;-------------------------------------- +align 4 +.p13green: cmp ah, 85 jbe .p13red or [ebp+4], ch cmp ah, 170 jbe .p13red or [ebp+12], ch - .p13red: +;-------------------------------------- +align 4 +.p13red: shr eax, 8 cmp ah, 85 jbe .p13cont @@ -288,11 +338,15 @@ VGA_draw_32_pixels: cmp ah, 170 jbe .p13cont or [ebp+12], ch - .p13cont: +;-------------------------------------- +align 4 +.p13cont: ror eax, 8 mov ch, ah inc cl - .end: +;-------------------------------------- +align 4 +.end: dec cl jnz .convert_pixels_to_VGA inc ebp @@ -303,7 +357,9 @@ VGA_draw_32_pixels: mov esi, ebp mov dx, 3c4h mov ah, 1h - @@: +;-------------------------------------- +align 4 +@@: mov al, 02h out dx, ax xchg ax, bp @@ -316,12 +372,36 @@ VGA_draw_32_pixels: add edi, 4 pop esi ret - +;------------------------------------------------------------------------------ +align 4 VGA_putpixel: ; eax = x ; ebx = y mov ecx, eax mov eax, [esp+32-8+4] ; color +;-------------------------------------- +; check for hardware cursor + cmp [_display.select_cursor], select_cursor + je @f + cmp [_display.select_cursor], 0 + jne .no_mouseunder +;-------------------------------------- +align 4 +@@: + push ecx + shl ecx, 16 + mov cx, bx +; check mouse area for putpixel + test eax, 0x04000000 + jnz @f + call [_display.check_mouse] +;-------------------------------------- +align 4 +@@: + pop ecx +;-------------------------------------- +align 4 +.no_mouseunder: shl ebx, 9 lea ebx, [ebx+ebx*4] ; умножение на 5 lea edx, [ebx+ecx*4] ; + x*BytesPerPixel (Vesa2.0 32) @@ -343,6 +423,8 @@ VGA_putpixel: cmp al, 170 jbe .p13green or dl, 0x08 +;-------------------------------------- +align 4 .p13green: cmp ah, 85 jbe .p13red @@ -350,6 +432,8 @@ VGA_putpixel: cmp ah, 170 jbe .p13red or dl, 0x08 +;-------------------------------------- +align 4 .p13red: shr eax, 8 cmp ah, 85 @@ -358,6 +442,8 @@ VGA_putpixel: cmp ah, 170 jbe .p13cont or dl, 0x08 +;-------------------------------------- +align 4 .p13cont: ror edx, 8 inc cl @@ -371,14 +457,12 @@ VGA_putpixel: rol edx, 8 mov [edi], dl popfd -;.end: ret - +;------------------------------------------------------------------------------ +align 4 VGA__putimage: ; ecx = size [x|y] ; edx = coordinates [x|y] - cmp [SCR_MODE], dword 0x12 - jne @f pushad rol edx, 16 movzx eax, dx @@ -389,16 +473,14 @@ VGA__putimage: movzx ecx, cx call VGA_draw_bar_1 popad -@@: ret - +;------------------------------------------------------------------------------ +align 4 VGA_draw_bar: ; eax cx ; ebx cy ; ecx xe ; edx ye - cmp [SCR_MODE], dword 0x12 - jne @f pushad sub ecx, eax sub edx, ebx @@ -408,9 +490,9 @@ VGA_draw_bar: and edx, 0xffff call VGA_draw_bar_1 popad -@@: ret - +;------------------------------------------------------------------------------ +align 4 VGA_draw_bar_1: mov [temp.cx], eax mov eax, [TASK_BASE] @@ -429,13 +511,16 @@ VGA_draw_bar_1: mov ebx, ecx shr ebx, 5 inc ebx +;-------------------------------------- +align 4 .main_loop: call VGA_draw_long_line_1 dec edx jnz .main_loop call VGA_draw_long_line_1 ret - +;------------------------------------------------------------------------------ +align 4 VGA_draw_long_line_1: push ebx edx esi edi shl edx, 9 @@ -446,5 +531,4 @@ VGA_draw_long_line_1: call VGA_draw_long_line pop edi esi edx ebx ret - - +;------------------------------------------------------------------------------