Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 546 → Rev 545

/kernel/trunk/kernel.asm
2346,8 → 2346,6
 
uglobal
; bgrchanged dd 0x0
bgrlock db 0
bgrlockpid dd 0
endg
 
sys_background:
2358,14 → 2356,6
je sbgrr
cmp ecx,0
je sbgrr
@@:
mov al, 1
xchg [bgrlock], al
test al, al
jz @f
call change_task
jmp @b
@@:
mov [BgrDataWidth],ebx
mov [BgrDataHeight],ecx
; mov [bgrchanged],1
2389,13 → 2379,12
lea eax,[eax*3]
mov [mem_BACKGROUND],eax
; get memory for new background
stdcall kernel_alloc, eax
stdcall kernel_alloc, [mem_BACKGROUND]
test eax, eax
jz .exit_mem
mov [img_background], eax
.exit_mem:
popad
mov [bgrlock], 0
 
sbgrr:
ret
2455,87 → 2444,9
ret
nosb5:
 
cmp eax, 6
jnz nosb6
@@:
mov al, 1
xchg [bgrlock], al
test al, al
jz @f
call change_task
jmp @b
@@:
mov eax, [CURRENT_TASK]
mov [bgrlockpid], eax
stdcall user_alloc, [mem_BACKGROUND]
mov [esp+36], eax
test eax, eax
jz .nomem
mov ebx, eax
shr ebx, 12
or dword [page_tabs+(ebx-1)*4], DONT_FREE_BLOCK
mov esi, [img_background]
shr esi, 12
mov ecx, [mem_BACKGROUND]
add ecx, 0xFFF
shr ecx, 12
.z:
mov eax, [page_tabs+ebx*4]
test al, 1
jz @f
call free_page
@@:
mov eax, [page_tabs+esi*4]
or al, PG_UW
mov [page_tabs+ebx*4], eax
mov eax, ebx
shl eax, 12
invlpg [eax]
inc ebx
inc esi
loop .z
ret
.nomem:
and [bgrlockpid], 0
mov [bgrlock], 0
nosb6:
cmp eax, 7
jnz nosb7
cmp [bgrlock], 0
jz .err
mov eax, [CURRENT_TASK]
cmp [bgrlockpid], eax
jnz .err
mov eax, ebx
shr eax, 12
mov ecx, [page_tabs+(eax-1)*4]
test cl, USED_BLOCK+DONT_FREE_BLOCK
jz .err
jnp .err
push eax
shr ecx, 12
@@:
and dword [page_tabs+eax*4], 0
mov edx, eax
shl edx, 12
invlpg [edx]
inc eax
loop @b
pop eax
and dword [page_tabs+(eax-1)*4], not DONT_FREE_BLOCK
stdcall user_free, ebx
mov [esp+36], eax
and [bgrlockpid], 0
mov [bgrlock], 0
ret
.err:
and dword [esp+36], 0
ret
 
nosb7:
ret
 
 
align 4
 
sys_getbackground:
/kernel/trunk/core/sys32.inc
720,11 → 720,6
mov [flp_status], 0
@@:
pop esi
cmp [bgrlockpid], esi
jnz @f
and [bgrlockpid], 0
mov [bgrlock], 0
@@:
 
pusha ; remove all irq reservations
mov eax,esi
/kernel/trunk/core/heap.inc
20,7 → 20,6
MEM_LIST_OFFSET equ 8
FREE_BLOCK equ 4
USED_BLOCK equ 8
DONT_FREE_BLOCK equ 10h
 
virtual at 0
MEM_BLOCK MEM_BLOCK
729,10 → 728,8
sub esi, 4096
shr esi, 12
mov eax, [page_tabs+esi*4]
test al, USED_BLOCK
test eax, USED_BLOCK
jz .not_used
test al, DONT_FREE_BLOCK
jnz .cantfree
 
and eax, not 4095
mov ecx, eax
768,9 → 765,6
xor eax, eax
inc eax
ret
.cantfree:
xor eax, eax
ret
endp
 
user_normalize:
842,8 → 836,6
xor eax, eax
ret
@@:
test edx, DONT_FREE_BLOCK
jnz .ret0
add ebx, 0x1FFF
shr edx, 12
shr ebx, 12
/kernel/trunk/docs/sysfuncr.txt
1,4 → 1,4
‘ˆ‘’…Œ›… ”“Š–ˆˆ Ž…€–ˆŽŽ‰ ‘ˆ‘’…Œ› Kolibri 0.7.0.0
‘ˆ‘’…Œ›… ”“Š–ˆˆ Ž…€–ˆŽŽ‰ ‘ˆ‘’…Œ› Kolibri 0.6.5.0
 
®¬¥à ä㭪樨 ¯®¬¥é ¥âáï ¢ ॣ¨áâà eax.
‚맮¢ á¨á⥬­®© ä㭪樨 ®áãé¥á⢫ï¥âáï ª®¬ ­¤®© "int 0x40".
575,34 → 575,6
ä®­®¬) ¢ë§ë¢ ©â¥ ¯®¤äã­ªæ¨î 3 ¯¥à¥à¨á®¢ª¨ ä®­ .
 
======================================================================
====================== ”ã­ªæ¨ï 15, ¯®¤äã­ªæ¨ï 6 ======================
==== ‘¯à®¥æ¨à®¢ âì ¤ ­­ë¥ ä®­  ­   ¤à¥á­®¥ ¯à®áâà ­á⢮ ¯à®æ¥áá . ====
======================================================================
 à ¬¥âàë:
* eax = 15 - ­®¬¥à ä㭪樨
* ebx = 6 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 㪠§ â¥«ì ­  ¤ ­­ë¥ ä®­ , 0 ¯à¨ ®è¨¡ª¥
‡ ¬¥ç ­¨ï:
* ‘¯à®¥æ¨à®¢ ­­ë¥ ¤ ­­ë¥ ¤®áâã¯­ë ­  ç⥭¨¥ ¨ § ¯¨áì.
*  §¬¥à ¤ ­­ëå ä®­  à ¢¥­ 3*xsize*ysize. ˆ§¬¥­¥­¨¥ à §¬¥à®¢ ä®­ 
¡«®ª¨àã¥âáï ­  ¢à¥¬ï à ¡®âë á á¯à®¥æ¨à®¢ ­­ë¬¨ ¤ ­­ë¬¨.
* –¢¥â ª ¦¤®£® ¯¨ªá¥«ï åà ­¨âáï ª ª 3-¡ ©â®¢ ï ¢¥«¨ç¨­  BBGGRR.
* ¨ªá¥«¨ ä®­®¢®£® ¨§®¡à ¦¥­¨ï § ¯¨á뢠îâáï ¯®á«¥¤®¢ â¥«ì­®
á«¥¢  ­ ¯à ¢®, ᢥàåã ¢­¨§.
 
======================================================================
====================== ”ã­ªæ¨ï 15, ¯®¤äã­ªæ¨ï 7 ======================
=== ‡ ªàëâì ¯à®¥ªæ¨î ¤ ­­ëå ä®­  ­   ¤à¥á­®¥ ¯à®áâà ­á⢮ ¯à®æ¥áá . ==
======================================================================
 à ¬¥âàë:
* eax = 15 - ­®¬¥à ä㭪樨
* ebx = 7 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 㪠§ â¥«ì ­  ¤ ­­ë¥ ä®­ 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 1 ¯à¨ ãᯥå¥, 0 ¯à¨ ®è¨¡ª¥
 
======================================================================
============= ”ã­ªæ¨ï 16 - á®åà ­¨âì à ¬¤¨áª ­  ¤¨áª¥âã. =============
======================================================================
 à ¬¥âàë:
867,7 → 839,7
‘âàãªâãà  ¡ãä¥à :
db a,b,c,d ¤«ï ¢¥àᨨ a.b.c.d
db UID_xxx: ®¤­® ¨§ UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
dd REV - ­®¬¥à svn-ॢ¨§¨¨ ï¤à 
dd REV - ­®¬¥à svn ॢ¨§¨¨ ï¤à 
„«ï ï¤à  Kolibri 0.7.0.0:
db 0,7,0,0
db 2
2333,11 → 2305,12
 à ¬¥âàë:
* eax = 48 - ­®¬¥à ä㭪樨
* ebx = 8 - ­®¬¥à ¯®¤ä㭪樨
* ecx = 㪠§ â¥«ì ­  ¨¬ï ä ©«  ᪨­ 
* ecx = 㪠§ â¥«ì ­  ¡«®ª ¤«ï ä㭪樨 58, ¢ ª®â®à®¬ ãáâ ­®¢«¥­®
¯®«¥ ¯à®¬¥¦ãâ®ç­®£® ¡ãä¥à  ¨ 㪠§ ­® ¨¬ï ä ©« 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = 1 - ­¥ 㤠«®áì § £à㧨âì ä ©«
* eax = 2 - ä ©« ­¥ ï¥âáï ä ©«®¬ ᪨­ 
* ¨­ ç¥ eax = ª®¤ ®è¨¡ª¨ ä ©«®¢®© á¨á⥬ë; ¥á«¨ ä ©« ­¥ § ¤ ñâ ᪨­,
â® ¢®§¢à é ¥âáï ®è¨¡ª  3 (­¥¨§¢¥áâ­ ï ä ©«®¢ ï á¨á⥬ ).
‡ ¬¥ç ­¨ï:
* à¨ ãᯥ譮© § £à㧪¥ ᪨­  ¢á¥ ®ª­  ¨§¢¥é îâáï ® ­¥®¡å®¤¨¬®áâ¨
¯¥à¥à¨á®¢ª¨ (ᮡë⨥ 1).
4091,14 → 4064,11
* /CD0/1, /CD1/1, /CD2/1, /CD3/1 ¤«ï ¤®áâ㯠 ᮮ⢥âá⢥­­®
ª CD ­  IDE0 (Primary Master), IDE1 (Primary Slave),
IDE2 (Secondary Master), IDE3 (Secondary Slave)
* /SYS - ®¯à¥¤¥«ï¥â á¨á⥬­ãî ¯ ¯ªã; ¯à¨ ®¡ëç­®© § £à㧪¥ á¨á⥬ë
á ¤¨áª¥âë íª¢¨¢ «¥­â­® /RD/1
à¨¬¥àë:
* '/rd/1/kernel.asm',0
* '/HD0/1/kernel.asm',0
* '/hd0/2/menuet/pics/tanzania.bmp',0
* '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
* '/sys/MySuperApp.ini',0
„®áâã¯­ë¥ ¯®¤ä㭪樨:
* ¯®¤äã­ªæ¨ï 0 - ç⥭¨¥ ä ©« 
* ¯®¤äã­ªæ¨ï 1 - ç⥭¨¥ ¯ ¯ª¨
/kernel/trunk/docs/sysfuncs.txt
1,4 → 1,4
SYSTEM FUNCTIONS of OS Kolibri 0.7.0.0
SYSTEM FUNCTIONS of OS Kolibri 0.6.5.0
 
Number of the function is located in the register eax.
The call of the system function is executed by "int 0x40" command.
568,33 → 568,6
working with a background) call subfunction 3.
 
======================================================================
===================== Function 15, subfunction 6 =====================
======== Map background data to the address space of process. ========
======================================================================
Parameters:
* eax = 15 - function number
* ebx = 6 - subfunction number
Returned value:
* eax = pointer to background data, 0 if error
Remarks:
* Mapped data are available for read and write.
* Size of background data is 3*xsize*ysize. The system blocks
changes of background sizes while process works with mapped data.
* Color of each pixel is stored as 3-bytes value BBGGRR.
* Pixels of the background image are written sequentially
from left to right, from up to down.
 
======================================================================
===== Function 15, subfunction 7 - close mapped background data. =====
======================================================================
Parameters:
* eax = 15 - function number
* ebx = 7 - subfunction number
* ecx = pointer to mapped data
Returned value:
* eax = 1 - success, 0 - error
 
======================================================================
=============== Function 16 - save ramdisk on a floppy. ==============
======================================================================
Parameters:
4052,14 → 4025,11
* /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
CD on IDE0 (Primary Master), IDE1 (Primary Slave),
IDE2 (Secondary Master), IDE3 (Secondary Slave)
* /SYS means system folder; with the usual boot (from floppy)
is equivalent to /RD/1
Examples:
* '/rd/1/kernel.asm',0
* '/HD0/1/kernel.asm',0
* '/hd0/2/menuet/pics/tanzania.bmp',0
* '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
* '/sys/MySuperApp.ini',0
Available subfunctions:
* subfunction 0 - read file
* subfunction 1 - read folder
/kernel/trunk/video/vesa20.inc
862,24 → 862,20
call [disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
mov eax, [BgrDataWidth]
dec eax
xor edx, edx
div dword [ScreenWidth]
push eax ; high
xor eax, eax
div dword [ScreenWidth]
push eax ; low
; the same for height
mov ecx, [ScreenWidth]
inc ecx
div ecx
push eax ; quo
push edx ; rem
mov eax, [BgrDataHeight]
dec eax
xor edx, edx
div dword [ScreenHeight]
push eax ; high
xor eax, eax
div dword [ScreenHeight]
push eax ; low
mov ecx, [ScreenHeight]
inc ecx
div ecx
push eax
push edx
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
mov ebp, [draw_data+32+RECT.left] ; x start
901,76 → 897,83
xchg edi, ebp
; Now eax=x, ebx=y, edi->output, ebp=offset in WinMapAddress
push ebx
; 2) Calculate offset in background memory block
push eax
; 2) Calculate offset in background memory block
mov eax, ebx
imul ebx, dword [esp+12]
mul dword [esp+8]
add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
mov esi, edx
imul esi, [BgrDataWidth]
mul dword [BgrDataHeight]
mov ecx, [ScreenHeight]
inc ecx
div ecx ; eax := y * BgrDataHeight / ScreenHeight
; edx := (y * BgrDataHeight) mod ScreenHeight
mov esi, eax
pop eax
push edx ; dword [esp] = (y * BgrDataHeight) mod ScreenHeight
; dword [esp+4] = y * BgrDataHeight / ScreenHeight
push eax
mov ecx, [BgrDataWidth]
lea edx, [ecx*3]
imul edx, [BgrDataHeight]
add edx, [img_background]
push edx
push eax
mov eax, [esp+8]
mul dword [esp+28]
push eax
mov eax, [esp+12]
mul dword [esp+28]
add [esp], edx
pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
add esi, edx
mul ecx
imul esi, ecx
dec ecx
push ecx
mov ecx, [ScreenWidth]
inc ecx
div ecx ; eax := x * BgrDataWidth / ScreenWidth
; edx := (x * BgrDataWidth) mod ScreenWidth
add esi, eax
lea esi, [esi*3]
add esi, [img_background]
mov ecx, eax
push eax edx esi
push ecx edx esi
; 3) Loop through redraw rectangle and copy background data
; Registers meaning:
; edx:ecx = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
; ecx = (x * BgrDataWidth) / ScreenWidth
; edx = (x * BgrDataWidth) mod ScreenWidth (used to fast recalculating of ecx,esi)
; esi -> bgr memory, edi -> output
; ebp = offset in WinMapAddress
; dword [esp] = saved esi
; dword [esp+4] = saved edx
; dword [esp+8] = saved ecx
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
; dword [esp+12] = BgrDataWidth-1, x-limit for overlapping of points
; dword [esp+16] = end of bgr memory (defines y-limit for overlapping of points)
; dword [esp+20] = x
; dword [esp+24] = y
; dword [esp+24] = (y * BgrDataHeight) mod ScreenHeight (used to fast recalculating of esi)
; dword [esp+28] = y
; precalculated constants:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
; dword [esp+32] = BgrDataHeight mod ScreenHeight
; dword [esp+36] = BgrDataHeight div ScreenHeight
; dword [esp+40] = BgrDataWidth mod ScreenWidth
; dword [esp+44] = BgrDataWidth div ScreenWidth
sdp3:
add edx, [esp+40]
cmp [ebp+WinMapAddress], byte 1
jnz snbgp
mov al, [esi+2]
shl eax, 16
mov ax, [esi]
test ecx, ecx
jz @f
cmp ecx, [esp+12]
jae @f
cmp edx, [ScreenWidth]
jb @f
mov ebx, [esi+2]
shr ebx, 8
call overlapping_of_points
@@:
cmp dword [esp+12], 0
jz .novert
mov ebx, [esp+24]
add ebx, [esp+32]
cmp ebx, [ScreenHeight]
jbe @f
mov ebx, [BgrDataWidth]
lea ebx, [ebx*3]
add ebx, esi
push eax
mov al, [ebx+2]
shl eax, 16
mov ax, [ebx]
test ecx, ecx
jz .nohorz
mov ebx, [ebx+2]
cmp ebx, [esp+16]
jae @f
mov ebx, [ebx-1]
shr ebx, 8
call overlapping_of_points
.nohorz:
mov ebx, eax
pop eax
push ecx
mov ecx, [esp+4+12]
call overlapping_of_points
pop ecx
.novert:
@@:
mov [edi], ax
shr eax, 16
mov [edi+2], al
983,18 → 986,23
mov [esp+20], eax
cmp eax, [draw_data+32+RECT.right]
ja sdp4
add ecx, [esp+36]
mov eax, edx
adc edx, [esp+40]
sub eax, edx
mov eax, [esp+44]
add ecx, eax
lea eax, [eax*3]
sub esi, eax
add esi, eax
; add edx, [esp+40]
cmp edx, [ScreenWidth]
jbe sdp3
sub edx, [ScreenWidth]
add ecx, 1
add esi, 3
sub edx, 1
jmp sdp3
sdp4:
; next y
mov ebx, [esp+24]
mov ebx, [esp+28]
add ebx, 1
mov [esp+24], ebx
mov [esp+28], ebx
cmp ebx, [draw_data+32+RECT.bottom]
ja sdpdone
; advance edi, ebp to next scan line
1011,23 → 1019,28
@@:
add edi, [BytesPerScanLine]
; restore ecx,edx; advance esi to next background line
mov eax, [esp+28]
mov ebx, [esp+32]
add [esp+12], eax
mov eax, [esp+16]
adc [esp+16], ebx
pop esi edx ecx
push ecx edx
sub eax, [esp+16-4]
lea eax, [eax*3]
imul eax, [BgrDataWidth]
sub esi, eax
xor ebx, ebx
mov eax, [esp+24-4]
add eax, [esp+32-4]
cmp eax, [ScreenHeight]
jbe @f
sub eax, [ScreenHeight]
mov ebx, 1
sub eax, ebx
@@:
mov [esp+24-4], eax
add ebx, [esp+36-4]
lea ebx, [ebx*3]
imul ebx, [BgrDataWidth]
add esi, ebx
push esi
mov eax, [draw_data+32+RECT.left]
mov [esp+20], eax
jmp sdp3
sdpdone:
add esp, 44
add esp, 48
popad
mov [EGA_counter],1
call VGA_drawbackground
1034,32 → 1047,28
ret
 
overlapping_of_points:
push ecx edx
mov edx, eax
push esi
shr ecx, 24
mov esi, ecx
mov ecx, ebx
push ecx edx edi
mov ecx, eax
mov edx, ebx
movzx eax, cl
movzx ebx, dl
movzx eax, cl
sub eax, ebx
add eax, ebx
rcr eax, 1
movzx edi, ax
movzx eax, ch
movzx ebx, dh
imul eax, esi
add dl, ah
add eax, ebx
rcr eax, 1
ror edi, 8
add edi, eax
shr ecx, 8
shr edx, 8
movzx eax, ch
sub eax, ebx
imul eax, esi
add dh, ah
ror ecx, 16
ror edx, 16
movzx eax, cl
movzx ebx, dl
sub eax, ebx
imul eax, esi
pop esi
add dl, ah
mov eax, edx
pop edx
movzx ebx, dh
add eax, ebx
rcr eax, 1
ror edi, 8
add eax, edi
ror eax, 16
pop ecx
pop edi edx ecx
ret