Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 752 → Rev 753

/kernel/trunk/const.inc
250,8 → 250,8
LFBAddress equ (OS_BASE+0x000FE80)
MEM_AMOUNT equ (OS_BASE+0x000FE8C)
 
ScreenWidth equ (OS_BASE+0x000FE00)
ScreenHeight equ (OS_BASE+0x000FE04)
Screen_Max_X equ (OS_BASE+0x000FE00)
Screen_Max_Y equ (OS_BASE+0x000FE04)
BytesPerScanLine equ (OS_BASE+0x000FE08)
SCR_MODE equ (OS_BASE+0x000FE0C)
 
/kernel/trunk/core/malloc.inc
983,7 → 983,7
align 4
init_malloc:
 
stdcall kernel_alloc, 0x30000
stdcall kernel_alloc, 0x40000
 
mov [mst.top], eax
mov [mst.topsize], 128*1024
/kernel/trunk/core/taskman.inc
1063,9 → 1063,9
 
mov [ecx+0],dword 0
mov [ecx+4],dword 0
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
mov [ecx+8],eax
mov eax,[ScreenHeight]
mov eax,[Screen_Max_Y]
mov [ecx+12],eax
 
mov ebx, [pl0_stack]
/kernel/trunk/data32.inc
104,6 → 104,28
vrr_m db 'VRR_M',0
kernel_file db 'KERNEL MNT'
 
align 4
;supported videomodes
mode_1280_1024_32:
dw 1280,1024,32,60
mode_1280_1024_24:
dw 1280,1024,24,60
mode_1024_768_32:
dw 1024,768,32,60
mode_1024_768_24:
dw 1024,768,24,60
mode_800_600_32
dw 800,600,32,60
mode_800_600_24
dw 800,600,24,60
mode_640_480_32
dw 640,480,32,60
mode_640_480_24
dw 640,480,24,60
mode_640_480_16
dw 640,480,16,60
mode 320_240_8
dw 320,240,8,60
 
; mike.dld {
db 0
/kernel/trunk/gui/window.inc
179,7 → 179,7
inc edx
 
; get WinMap start
mov edi, [ScreenWidth] ; screen_sx
mov edi, [Screen_Max_X] ; screen_sx
inc edi
imul edi, ebx
add edi, eax
199,7 → 199,7
 
pop edx
pop ecx
add edi, [ScreenWidth]
add edi, [Screen_Max_X]
inc edi
sub edi, ecx
dec edx
240,7 → 240,7
 
; get WinMap start -> ebp
push eax
mov eax, [ScreenWidth] ; screen_sx
mov eax, [Screen_Max_X] ; screen_sx
inc eax
imul eax, ebx
add eax, [esp]
302,7 → 302,7
jb .ff_new_x
sub ebp, [ff_xsz]
add ebp, [ff_x]
add ebp, [ScreenWidth] ; screen.x
add ebp, [Screen_Max_X] ; screen.x
inc ebp
inc ebx
cmp ebx, [ff_ysz]
359,9 → 359,9
redraw_screen_direct:
mov [dlx],dword 0
mov [dly],dword 0
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
mov [dlxe],eax
mov eax,[ScreenHeight]
mov eax,[Screen_Max_Y]
mov [dlye],eax
mov eax,window_data
call redrawscreen
437,10 → 437,10
movsx ebx,word[esp+16]
cmp eax,ebx
jge .lp1
or eax,eax;[ScreenWidth]
or eax,eax;[Screen_Max_X]
jl @f
mov [screen_workarea.left],eax
@@: cmp ebx,[ScreenWidth]
@@: cmp ebx,[Screen_Max_X]
jg .lp1
mov [screen_workarea.right],ebx
.lp1: movsx eax,word[esp+24+2]
450,14 → 450,14
or eax,eax;[0xFE04]
jl @f
mov [screen_workarea.top],eax
@@: cmp ebx,[ScreenHeight]
@@: cmp ebx,[Screen_Max_Y]
jg .lp2
mov [screen_workarea.bottom],ebx
.lp2: call repos_windows
mov eax, 0
mov ebx, 0
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
call calculatescreen
; jmp redraw_screen_direct
.exit:
483,8 → 483,8
jnz .ret
xor eax, eax
xor ebx, ebx
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
call calculatescreen
jmp redraw_screen_direct
.ret:
526,7 → 526,7
ret
.lp2: mov eax,[edi+WDATA.box.left]
add eax,[edi+WDATA.box.width]
mov ebx,[ScreenWidth]
mov ebx,[Screen_Max_X]
; inc ebx
cmp eax,ebx
jle .lp4
538,7 → 538,7
mov [edi+WDATA.box.left],ebx
.lp4: mov eax,[edi+WDATA.box.top]
add eax,[edi+WDATA.box.height]
mov ebx,[ScreenHeight]
mov ebx,[Screen_Max_Y]
; inc ebx
cmp eax,ebx
jle .lp6
569,7 → 569,7
 
mov esi,ecx ; check x pos
add esi,eax
cmp esi,[ScreenWidth]
cmp esi,[Screen_Max_X]
jbe x_pos_ok
mov [edi+WDATA.box.left],dword 0
xor eax, eax
577,7 → 577,7
 
mov esi,edx ; check y pos
add esi,ebx
cmp esi,[ScreenHeight]
cmp esi,[Screen_Max_Y]
jbe y_pos_ok
mov [edi+WDATA.box.top],dword 0
mov ebx,0
585,17 → 585,17
 
mov esi,ecx ; check x size
add esi,eax
cmp esi,[ScreenWidth]
cmp esi,[Screen_Max_X]
jbe x_size_ok
mov ecx,[ScreenWidth]
mov ecx,[Screen_Max_X]
mov [edi+WDATA.box.width],ecx
x_size_ok:
 
mov esi,edx ; check y size
add esi,ebx
cmp esi,[ScreenHeight]
cmp esi,[Screen_Max_Y]
jbe y_size_ok
mov edx,[ScreenHeight]
mov edx,[Screen_Max_Y]
mov [edi+WDATA.box.height],edx
y_size_ok:
 
1391,8 → 1391,8
 
call drawwindowframes
 
mov ax,[ScreenWidth]
mov bx,[ScreenHeight]
mov ax,[Screen_Max_X]
mov bx,[Screen_Max_Y]
 
cmp [do_resize_from_corner],1
je no_new_position
1545,9 → 1545,9
sub eax,[screen_workarea.top]
@@: mov [edi+WDATA.box.height],eax
add eax, [edi+WDATA.box.top]
cmp eax, [ScreenHeight]
cmp eax, [Screen_Max_Y]
jbe @f
mov eax, [ScreenHeight]
mov eax, [Screen_Max_Y]
sub eax, [edi+WDATA.box.height]
mov [edi+WDATA.box.top], eax
@@: call check_window_position
1605,16 → 1605,16
 
mov eax,[edi+WDATA.box.top] ; check Y inside screen
add eax,[edi+WDATA.box.height]
cmp eax,[ScreenHeight]
cmp eax,[Screen_Max_Y]
jbe no_window_sizing
mov eax,[edi+WDATA.box.left] ; check X inside screen
add eax,[edi+WDATA.box.width]
cmp eax,[ScreenWidth]
cmp eax,[Screen_Max_X]
jbe no_window_sizing
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
sub eax,[edi+WDATA.box.width]
mov [edi+WDATA.box.left],eax
mov eax,[ScreenHeight]
mov eax,[Screen_Max_Y]
sub eax,[edi+WDATA.box.height]
mov [edi+WDATA.box.top],eax
call set_window_clientbox
/kernel/trunk/hid/m_com.inc
92,10 → 92,10
add ax, [MOUSE_X]
; Êóðñîð íå äîëæåí âûõîäèòü çà ëåâóþ èëè ïðàâóþ ãðàíèöó ýêðàíà
js .x1
cmp ax, [ScreenWidth]
cmp ax, [Screen_Max_X]
jb .x2
; Óñòàíîâèòü êîîðäèíàòó X ïî ïðàâîé ãðàíèöå
mov ax, [ScreenWidth]
mov ax, [Screen_Max_X]
jmp .x2
.x1:
; Óñòàíîâèòü êîîðäèíàòó X ïî ëåâîé ãðàíèöå
111,10 → 111,10
add ax, [MOUSE_Y]
; Êóðñîð íå äîëæåí âûõîäèòü çà âåðõíþþ èëè íèæíþþ ãðàíèöó ýêðàíà
js .y1
cmp ax, [ScreenHeight]
cmp ax, [Screen_Max_Y]
jb .y2
; Óñòàíîâèòü êîîðäèíàòó Y ïî íèæíåé ãðàíèöå
mov ax, [ScreenHeight]
mov ax, [Screen_Max_Y]
jmp .y2
.y1:
; Óñòàíîâèòü êîîðäèíàòó Y ïî âåðõíåé ãðàíèöå
/kernel/trunk/hid/mousedrv.inc
108,7 → 108,7
push eax
push ebx
 
mov ecx, [ScreenWidth]
mov ecx, [Screen_Max_X]
inc ecx
mul ecx
 
292,7 → 292,7
add edx,window_data
movzx eax, word [MOUSE_X]
movzx ebx, word [MOUSE_Y]
mov ecx,[ScreenWidth]
mov ecx,[Screen_Max_X]
inc ecx
imul ecx,ebx
add ecx,eax
304,7 → 304,7
movzx ebx, byte [ecx+16]
cmp eax,ebx
je yes_mouse_disable
mov ebx,[ScreenWidth]
mov ebx,[Screen_Max_X]
inc ebx
imul ebx,10
add ecx,ebx
411,9 → 411,9
mov eax,0
jmp @@M2
@@M1:
cmp ax,[ScreenWidth] ;ScreenLength
cmp ax,[Screen_Max_X] ;ScreenLength
jl @@M2
mov ax,[ScreenWidth] ;ScreenLength-1
mov ax,[Screen_Max_X] ;ScreenLength-1
 
@@M2:
mov [MOUSE_X],ax ;[XCoordinate]
428,9 → 428,9
mov ax,0
jmp @@M4
@@M3:
cmp ax,[ScreenHeight] ;ScreenHeigth
cmp ax,[Screen_Max_Y] ;ScreenHeigth
jl @@M4
mov ax,[ScreenHeight] ;ScreenHeigth-1
mov ax,[Screen_Max_Y] ;ScreenHeigth-1
 
@@M4:
mov [MOUSE_Y],ax ;[YCoordinate]
/kernel/trunk/kernel.asm
344,13 → 344,16
mov [allow_dma_access], al
mov al,[BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al
 
xchg bx, bx
 
movzx eax,word [BOOT_VAR+0x900A] ; X max
dec eax
mov [ScreenWidth],eax
mov [Screen_Max_X],eax
mov [screen_workarea.right],eax
movzx eax,word [BOOT_VAR+0x900C] ; Y max
dec eax
mov [ScreenHeight],eax
mov [Screen_Max_Y],eax
mov [screen_workarea.bottom],eax
movzx eax,word [BOOT_VAR+0x9008] ; screen mode
mov [SCR_MODE],eax
1126,10 → 1129,10
;* mouse centered - start code- Mario79
mouse_centered:
push eax
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
shr eax,1
mov [MOUSE_X],ax
mov eax,[ScreenHeight]
mov eax,[Screen_Max_Y]
shr eax,1
mov [MOUSE_Y],ax
pop eax
2559,8 → 2562,8
mov [draw_data+32 + RECT.left],dword 0
mov [draw_data+32 + RECT.top],dword 0
push eax ebx
mov eax,[ScreenWidth]
mov ebx,[ScreenHeight]
mov eax,[Screen_Max_X]
mov ebx,[Screen_Max_Y]
mov [draw_data+32 + RECT.right],eax
mov [draw_data+32 + RECT.bottom],ebx
pop ebx eax
2880,9 → 2883,9
add edx, draw_data - CURRENT_TASK
mov [edx + RECT.left], 0
mov [edx + RECT.top], 0
mov eax, [ScreenWidth]
mov eax, [Screen_Max_X]
mov [edx + RECT.right], eax
mov eax, [ScreenHeight]
mov eax, [Screen_Max_Y]
mov [edx + RECT.bottom], eax
 
mov edi, [TASK_BASE]
3483,7 → 3486,7
checkpixel:
push eax edx
 
mov edx,[ScreenWidth] ; screen x size
mov edx,[Screen_Max_X] ; screen x size
inc edx
imul edx, ebx
mov dl, [eax+edx+display_data] ; lea eax, [...]
3544,8 → 3547,8
no_set_bgr_event:
; mov [draw_data+32 + RECT.left],dword 0
; mov [draw_data+32 + RECT.top],dword 0
; mov eax,[ScreenWidth]
; mov ebx,[ScreenHeight]
; mov eax,[Screen_Max_X]
; mov ebx,[Screen_Max_Y]
; mov [draw_data+32 + RECT.right],eax
; mov [draw_data+32 + RECT.bottom],ebx
call drawbackground
4856,9 → 4859,9
 
cmp eax,1 ; resolution
jne no_gs1
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
shl eax,16
mov ax,[ScreenHeight]
mov ax,[Screen_Max_Y]
add eax,0x00010001
mov [esp+36],eax
ret
4970,9 → 4973,9
 
align 4
syscall_getscreensize: ; GetScreenSize
mov ax, [ScreenWidth]
mov ax, [Screen_Max_X]
shl eax, 16
mov ax, [ScreenHeight]
mov ax, [Screen_Max_Y]
mov [esp + 32], eax
ret
 
5060,7 → 5063,7
align 4
 
syscall_getpixel: ; GetPixel
mov ecx, [ScreenWidth]
mov ecx, [Screen_Max_X]
inc ecx
xor edx, edx
mov eax, ebx
/kernel/trunk/kernel32.inc
61,6 → 61,13
BOX BOX
end virtual
 
struc DISPMODE {
.width rw 1
.height rw 1
.bpp rw 1
.freq rw 1
}
 
; constants definition
WSTATE_NORMAL = 00000000b
WSTATE_MAXIMIZED = 00000001b
/kernel/trunk/video/cursors.inc
478,8 → 478,8
stdcall load_cursor, def_arrow, dword LOAD_FROM_MEM
mov [def_cursor], eax
 
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
inc ecx
inc edx
mov [scr_width], ecx
/kernel/trunk/video/vesa12.inc
290,7 → 290,7
push edx
 
mul dword [BgrDataWidth]
mov ecx,[ScreenWidth]
mov ecx,[Screen_Max_X]
inc ecx
div ecx
 
297,7 → 297,7
push eax
mov eax,ebx
mul dword [BgrDataHeight]
mov ecx,[ScreenHeight]
mov ecx,[Screen_Max_Y]
inc ecx
div ecx
mov ebx,eax
324,7 → 324,7
pusha
mov esi,eax
mov edi,ebx
mov eax,[ScreenWidth]
mov eax,[Screen_Max_X]
add eax,1
mul ebx
cmp [eax+esi+WinMapAddress],byte 1
443,10 → 443,10
cmp ecx,0
jnz dbcblimitlset12
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
cmp ecx,[ScreenWidth]
cmp ecx,[Screen_Max_X]
jnz dbcblimitlset12
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
cmp ecx,[ScreenHeight]
cmp ecx,[Screen_Max_Y]
jnz dbcblimitlset12
pop ecx
pop eax
799,10 → 799,10
cmp dword [eax+draw_data-CURRENT_TASK+RECT.top], 0
jnz dbcblimitlset212
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.right]
cmp ecx,[ScreenWidth]
cmp ecx,[Screen_Max_X]
jnz dbcblimitlset212
mov ecx,[eax+draw_data-CURRENT_TASK+RECT.bottom]
cmp ecx,[ScreenHeight]
cmp ecx,[Screen_Max_Y]
jnz dbcblimitlset212
pop ecx
push 0
/kernel/trunk/video/vesa20.inc
23,8 → 23,8
; If you're planning to write your own video driver I suggest
; you replace the VESA12.INC file and see those instructions.
 
;ScreenWidth equ 0xfe00
;ScreenHeight equ 0xfe04
;Screen_Max_X equ 0xfe00
;Screen_Max_Y equ 0xfe04
;BytesPerScanLine equ 0xfe08
;LFBAddress equ 0xfe80
;ScreenBPP equ 0xfbf1
172,7 → 172,7
add eax, [putimg.arg_0]
mov [putimg.line_increment], eax
; winmap new line increment
mov eax, [ScreenWidth]
mov eax, [Screen_Max_X]
inc eax
sub eax, [putimg.real_sx]
mov [putimg.winmap_newline], eax
197,7 → 197,7
add edx, [LFBAddress]
; pointer to pixel map
mov eax, [putimg.abs_cy]
imul eax, [ScreenWidth]
imul eax, [Screen_Max_X]
add eax, [putimg.abs_cy]
add eax, [putimg.abs_cx]
add eax, WinMapAddress
232,7 → 232,7
; pop edx ebp
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
add ebp, [putimg.winmap_newline] ;[Screen_Max_X]
; inc ebp
dec edi
jnz .new_line
265,7 → 265,7
; pop edx ebp
add esi, [putimg.line_increment]
add edx, [putimg.screen_newline] ;[BytesPerScanLine]
add ebp, [putimg.winmap_newline] ;[ScreenWidth]
add ebp, [putimg.winmap_newline] ;[Screen_Max_X]
; inc ebp
dec edi
jnz .new_line
297,9 → 297,9
pop ecx
jnz .exit
.forced:
cmp [ScreenWidth], eax
cmp [Screen_Max_X], eax
jb .exit
cmp [ScreenHeight], ebx
cmp [Screen_Max_Y], ebx
jb .exit
.ok:
; check if negation
346,7 → 346,7
;align 4
calculate_edi:
mov edi, ebx
imul edi, [ScreenWidth]
imul edi, [Screen_Max_X]
add edi, ebx
add edi, eax
ret
603,7 → 603,7
.end_y:
mov [drbar.real_sy], ebx
; line_inc_map
mov eax, [ScreenWidth]
mov eax, [Screen_Max_X]
sub eax, [drbar.real_sx]
inc eax
mov [drbar.line_inc_map], eax
626,7 → 626,7
add edx, [LFBAddress]
; pointer to pixel map
mov eax, [drbar.abs_cy]
imul eax, [ScreenWidth]
imul eax, [Screen_Max_X]
add eax, [drbar.abs_cy]
add eax, [drbar.abs_cx]
add eax, WinMapAddress
726,7 → 726,7
 
; xor edx,edx
; mov eax,ebp
; mov ebx,[ScreenWidth] ; Screen_X_size
; mov ebx,[Screen_Max_X] ; Screen_X_size
; inc ebx ; +1
; sub eax,WinMapAddress ; -AddrBuffer
; div ebx ;
752,7 → 752,7
; pusha
 
; xor edx,edx
; mov ebx,[ScreenWidth]
; mov ebx,[Screen_Max_X]
; inc ebx
; sub eax,WinMapAddress
; div ebx
864,23 → 864,23
call [disable_mouse]
pushad
; Helper variables
; calculate 2^32*(BgrDataWidth-1) mod (ScreenWidth-1)
; calculate 2^32*(BgrDataWidth-1) mod (Screen_Max_X-1)
mov eax, [BgrDataWidth]
dec eax
xor edx, edx
div dword [ScreenWidth]
div dword [Screen_Max_X]
push eax ; high
xor eax, eax
div dword [ScreenWidth]
div dword [Screen_Max_X]
push eax ; low
; the same for height
mov eax, [BgrDataHeight]
dec eax
xor edx, edx
div dword [ScreenHeight]
div dword [Screen_Max_Y]
push eax ; high
xor eax, eax
div dword [ScreenHeight]
div dword [Screen_Max_Y]
push eax ; low
; External loop for all y from start to end
mov ebx, [draw_data+32+RECT.top] ; y start
908,7 → 908,7
mov eax, ebx
imul ebx, dword [esp+12]
mul dword [esp+8]
add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
add edx, ebx ; edx:eax = y * 2^32*(BgrDataHeight-1)/(Screen_Max_Y-1)
mov esi, edx
imul esi, [BgrDataWidth]
push edx
919,7 → 919,7
mov eax, [esp+12]
mul dword [esp+28]
add [esp], edx
pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
pop edx ; edx:eax = x * 2^32*(BgrDataWidth-1)/(Screen_Max_X-1)
add esi, edx
lea esi, [esi*3]
add esi, [img_background]
957,13 → 957,13
; esi = offset in current line, edi -> output
; ebp = offset in WinMapAddress
; dword [esp] = offset in bgr data
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (ScreenWidth-1)
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (ScreenHeight-1)
; qword [esp+4] = x * 2^32 * (BgrDataWidth-1) / (Screen_Max_X-1)
; qword [esp+12] = y * 2^32 * (BgrDataHeight-1) / (Screen_Max_Y-1)
; dword [esp+20] = x
; dword [esp+24] = y
; precalculated constants:
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(ScreenHeight-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(ScreenWidth-1)
; qword [esp+28] = 2^32*(BgrDataHeight-1)/(Screen_Max_Y-1)
; qword [esp+36] = 2^32*(BgrDataWidth-1)/(Screen_Max_X-1)
sdp3a:
cmp [ebp+WinMapAddress], byte 1
jnz snbgp
996,7 → 996,7
; advance edi, ebp to next scan line
sub eax, [draw_data+32+RECT.left]
sub ebp, eax
add ebp, [ScreenWidth]
add ebp, [Screen_Max_X]
add ebp, 1
sub edi, eax
sub edi, eax
1026,7 → 1026,7
push edi
mov esi, bgr_next_line
mov edi, bgr_cur_line
mov ecx, [ScreenWidth]
mov ecx, [Screen_Max_X]
inc ecx
rep movsd
jmp bgr_resmooth1
/kernel/trunk/vmodeint.inc
26,7 → 26,7
 
cmp eax,13 ; CALL VIDEOMODE DRIVER FUNCTIONS
jne .no_vmode_drv_access
pushd [ScreenWidth] [ScreenHeight]
pushd [Screen_Max_X] [Screen_Max_Y]
popd [old_screen_height] [old_screen_width]
or eax,-1 ; If driver is absent then eax does not change
call (VMODE_BASE+0x100) ; Entry point of video driver
36,12 → 36,12
; mov [esp+28],edx
mov eax,[old_screen_width]
mov ebx,[old_screen_height]
sub eax,[ScreenWidth]
sub eax,[Screen_Max_X]
jnz @f
sub ebx,[ScreenHeight]
sub ebx,[Screen_Max_Y]
jz .resolution_wasnt_changed
jmp .lp1
@@: sub ebx,[ScreenHeight]
@@: sub ebx,[Screen_Max_Y]
.lp1: sub [screen_workarea.right],eax
sub [screen_workarea.bottom],ebx
 
48,8 → 48,8
call repos_windows
mov eax, 0
mov ebx, 0
mov ecx, [ScreenWidth]
mov edx, [ScreenHeight]
mov ecx, [Screen_Max_X]
mov edx, [Screen_Max_Y]
call calculatescreen
 
.resolution_wasnt_changed: