Subversion Repositories Kolibri OS

Rev

Rev 8858 | Rev 8867 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 8858 Rev 8866
Line 75... Line 75...
75
format binary as "mnt"
75
format binary as "mnt"
Line 76... Line 76...
76
 
76
 
77
include 'macros.inc'
77
include 'macros.inc'
Line 78... Line 78...
78
include 'struct.inc'
78
include 'struct.inc'
Line 79... Line 79...
79
 
79
 
80
$Revision: 8858 $
80
$Revision: 8866 $
Line 624... Line 624...
624
        mov     dword [edx], 'OS'
624
        mov     dword [edx], 'OS'
625
        xor     ecx, ecx
625
        xor     ecx, ecx
626
        call    scheduler_add_thread
626
        call    scheduler_add_thread
Line 627... Line 627...
627
 
627
 
628
        mov     dword [CURRENT_TASK], 2
628
        mov     dword [CURRENT_TASK], 2
629
        mov     dword [TASK_COUNT], 2
629
        mov     dword [thread_count], 2
630
        mov     dword [current_slot], SLOT_BASE + sizeof.APPDATA*2
630
        mov     dword [current_slot], SLOT_BASE + sizeof.APPDATA*2
Line 631... Line 631...
631
        mov     dword [TASK_BASE], CURRENT_TASK + sizeof.TASKDATA*2
631
        mov     dword [TASK_BASE], CURRENT_TASK + sizeof.TASKDATA*2
632
 
632
 
Line 1964... Line 1964...
1964
        stdcall delete_cursor, ecx
1964
        stdcall delete_cursor, ecx
1965
        mov     [esp+36-4], eax
1965
        mov     [esp+36-4], eax
1966
        ret
1966
        ret
Line 1967... Line 1967...
1967
 
1967
 
1968
.msz:
1968
.msz:
1969
        mov     edi, [TASK_COUNT]
1969
        mov     edi, [thread_count]
1970
        movzx   edi, word [WIN_POS + edi*2]
1970
        movzx   edi, word [WIN_POS + edi*2]
1971
        cmp     edi, [CURRENT_TASK]
1971
        cmp     edi, [CURRENT_TASK]
1972
        jne     @f
1972
        jne     @f
1973
        mov     ax, [MOUSE_SCROLL_H]
1973
        mov     ax, [MOUSE_SCROLL_H]
Line 2187... Line 2187...
2187
        jl      exit_for_anyone
2187
        jl      exit_for_anyone
2188
        cmp     ecx, SYSTEM_RESTART
2188
        cmp     ecx, SYSTEM_RESTART
2189
        jg      exit_for_anyone
2189
        jg      exit_for_anyone
2190
        mov     [BOOT.shutdown_type], cl
2190
        mov     [BOOT.shutdown_type], cl
Line 2191... Line 2191...
2191
 
2191
 
2192
        mov     eax, [TASK_COUNT]
2192
        mov     eax, [thread_count]
2193
        mov     [SYS_SHUTDOWN], al
2193
        mov     [SYS_SHUTDOWN], al
2194
        mov     [shutdown_processes], eax
2194
        mov     [shutdown_processes], eax
2195
        call    wakeup_osloop
2195
        call    wakeup_osloop
2196
        and     dword [esp+32], 0
2196
        and     dword [esp+32], 0
Line 2210... Line 2210...
2210
;------------------------------------------------------------------------------
2210
;------------------------------------------------------------------------------
2211
sysfn_terminate:        ; 18.2 = TERMINATE
2211
sysfn_terminate:        ; 18.2 = TERMINATE
2212
        push    ecx
2212
        push    ecx
2213
        cmp     ecx, 2
2213
        cmp     ecx, 2
2214
        jb      noprocessterminate
2214
        jb      noprocessterminate
2215
        mov     edx, [TASK_COUNT]
2215
        mov     edx, [thread_count]
2216
        cmp     ecx, edx
2216
        cmp     ecx, edx
2217
        ja      noprocessterminate
2217
        ja      noprocessterminate
2218
        mov     eax, [TASK_COUNT]
2218
        mov     eax, [thread_count]
2219
        shl     ecx, BSF sizeof.TASKDATA
2219
        shl     ecx, BSF sizeof.TASKDATA
2220
        mov     edx, [ecx+CURRENT_TASK+TASKDATA.pid]
2220
        mov     edx, [ecx+CURRENT_TASK+TASKDATA.pid]
2221
        add     ecx, CURRENT_TASK+TASKDATA.state
2221
        add     ecx, CURRENT_TASK+TASKDATA.state
2222
        cmp     byte [ecx], TSTATE_FREE
2222
        cmp     byte [ecx], TSTATE_FREE
2223
        jz      noprocessterminate
2223
        jz      noprocessterminate
Line 2288... Line 2288...
2288
        ret
2288
        ret
2289
;------------------------------------------------------------------------------
2289
;------------------------------------------------------------------------------
2290
sysfn_deactivate:         ; 18.1 = DEACTIVATE WINDOW
2290
sysfn_deactivate:         ; 18.1 = DEACTIVATE WINDOW
2291
        cmp     ecx, 2
2291
        cmp     ecx, 2
2292
        jb      .nowindowdeactivate
2292
        jb      .nowindowdeactivate
2293
        cmp     ecx, [TASK_COUNT]
2293
        cmp     ecx, [thread_count]
2294
        ja      .nowindowdeactivate
2294
        ja      .nowindowdeactivate
Line 2295... Line 2295...
2295
 
2295
 
2296
        movzx   esi, word [WIN_STACK + ecx*2]
2296
        movzx   esi, word [WIN_STACK + ecx*2]
2297
        cmp     esi, 1
2297
        cmp     esi, 1
Line 2309... Line 2309...
2309
        ret
2309
        ret
2310
;------------------------------------------------------------------------------
2310
;------------------------------------------------------------------------------
2311
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2311
sysfn_activate:         ; 18.3 = ACTIVATE WINDOW
2312
        cmp     ecx, 2
2312
        cmp     ecx, 2
2313
        jb      .nowindowactivate
2313
        jb      .nowindowactivate
2314
        cmp     ecx, [TASK_COUNT]
2314
        cmp     ecx, [thread_count]
2315
        ja      .nowindowactivate
2315
        ja      .nowindowactivate
2316
;-------------------------------------
2316
;-------------------------------------
2317
@@:
2317
@@:
2318
; If the window is captured and moved by the user,
2318
; If the window is captured and moved by the user,
2319
; then you can't change the position in window stack!!!
2319
; then you can't change the position in window stack!!!
Line 2327... Line 2327...
2327
;-------------------------------------
2327
;-------------------------------------
2328
        mov     [window_minimize], 2; restore window if minimized
2328
        mov     [window_minimize], 2; restore window if minimized
2329
        call    wakeup_osloop
2329
        call    wakeup_osloop
Line 2330... Line 2330...
2330
 
2330
 
2331
        movzx   esi, word [WIN_STACK + ecx*2]
2331
        movzx   esi, word [WIN_STACK + ecx*2]
2332
        cmp     esi, [TASK_COUNT]
2332
        cmp     esi, [thread_count]
Line 2333... Line 2333...
2333
        je      .nowindowactivate; already active
2333
        je      .nowindowactivate; already active
2334
 
2334
 
2335
        mov     edi, ecx
2335
        mov     edi, ecx
Line 2353... Line 2353...
2353
 
2353
 
2354
        cmp     edx, -1
2354
        cmp     edx, -1
2355
        jne     @f
2355
        jne     @f
2356
        mov     edx, [CURRENT_TASK]
2356
        mov     edx, [CURRENT_TASK]
2357
     @@:
2357
     @@:
2358
        cmp     edx, [TASK_COUNT]
2358
        cmp     edx, [thread_count]
2359
        ja      .fail
2359
        ja      .fail
2360
        cmp     edx, 1
2360
        cmp     edx, 1
Line 2361... Line 2361...
2361
        je      .fail
2361
        je      .fail
Line 2426... Line 2426...
2426
   include 'blkdev/rdsave.inc'
2426
   include 'blkdev/rdsave.inc'
2427
;!!!!!!!!!!!!!!!!!!!!!!!!
2427
;!!!!!!!!!!!!!!!!!!!!!!!!
2428
;------------------------------------------------------------------------------
2428
;------------------------------------------------------------------------------
2429
align 4
2429
align 4
2430
sysfn_getactive:        ; 18.7 = get active window
2430
sysfn_getactive:        ; 18.7 = get active window
2431
        mov     eax, [TASK_COUNT]
2431
        mov     eax, [thread_count]
2432
        movzx   eax, word [WIN_POS + eax*2]
2432
        movzx   eax, word [WIN_POS + eax*2]
2433
        mov     [esp+32], eax
2433
        mov     [esp+32], eax
2434
        ret
2434
        ret
2435
;------------------------------------------------------------------------------
2435
;------------------------------------------------------------------------------
2436
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2436
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
Line 3103... Line 3103...
3103
sys_getkey:
3103
sys_getkey:
3104
        mov     [esp + 32], dword 1
3104
        mov     [esp + 32], dword 1
3105
        ; test main buffer
3105
        ; test main buffer
3106
        mov     ebx, [CURRENT_TASK]                          ; TOP OF WINDOW STACK
3106
        mov     ebx, [CURRENT_TASK]                          ; TOP OF WINDOW STACK
3107
        movzx   ecx, word [WIN_STACK + ebx * 2]
3107
        movzx   ecx, word [WIN_STACK + ebx * 2]
3108
        mov     edx, [TASK_COUNT]
3108
        mov     edx, [thread_count]
3109
        cmp     ecx, edx
3109
        cmp     ecx, edx
3110
        jne     .finish
3110
        jne     .finish
3111
        cmp     [KEY_COUNT], byte 0
3111
        cmp     [KEY_COUNT], byte 0
3112
        je      .finish
3112
        je      .finish
3113
        movzx   ax, byte [KEY_BUFF + 120 + 2]
3113
        movzx   ax, byte [KEY_BUFF + 120 + 2]
Line 3159... Line 3159...
3159
align 4
3159
align 4
3160
sys_getbutton:
3160
sys_getbutton:
3161
        mov     ebx, [CURRENT_TASK]                         ; TOP OF WINDOW STACK
3161
        mov     ebx, [CURRENT_TASK]                         ; TOP OF WINDOW STACK
3162
        mov     [esp + 32], dword 1
3162
        mov     [esp + 32], dword 1
3163
        movzx   ecx, word [WIN_STACK + ebx * 2]
3163
        movzx   ecx, word [WIN_STACK + ebx * 2]
3164
        mov     edx, [TASK_COUNT] ; less than 256 processes
3164
        mov     edx, [thread_count] ; less than 256 processes
3165
        cmp     ecx, edx
3165
        cmp     ecx, edx
3166
        jne     .exit
3166
        jne     .exit
3167
        movzx   eax, byte [BTN_COUNT]
3167
        movzx   eax, byte [BTN_COUNT]
3168
        test    eax, eax
3168
        test    eax, eax
3169
        jz      .exit
3169
        jz      .exit
Line 3276... Line 3276...
3276
        pop     edi
3276
        pop     edi
Line 3277... Line 3277...
3277
 
3277
 
3278
.nofillbuf:
3278
.nofillbuf:
Line 3279... Line 3279...
3279
    ; return number of processes
3279
    ; return number of processes
3280
 
3280
 
3281
        mov     eax, [TASK_COUNT]
3281
        mov     eax, [thread_count]
Line 3282... Line 3282...
3282
        mov     [esp+32], eax
3282
        mov     [esp+32], eax
3283
        ret
3283
        ret
Line 3565... Line 3565...
3565
        mov     [mouse_active], 0
3565
        mov     [mouse_active], 0
Line 3566... Line 3566...
3566
 
3566
 
3567
        xor     edi, edi
3567
        xor     edi, edi
Line 3568... Line 3568...
3568
        mov     ebx, CURRENT_TASK
3568
        mov     ebx, CURRENT_TASK
3569
 
3569
 
3570
        mov     ecx, [TASK_COUNT]
3570
        mov     ecx, [thread_count]
3571
        movzx   eax, word [WIN_POS + ecx*2]     ; active window
3571
        movzx   eax, word [WIN_POS + ecx*2]     ; active window
Line 3572... Line 3572...
3572
        shl     eax, 8
3572
        shl     eax, 8
Line 3639... Line 3639...
3639
;        DEBUGF  1, "K : backg x %x\n",[BG_Rect_X_left_right]
3639
;        DEBUGF  1, "K : backg x %x\n",[BG_Rect_X_left_right]
3640
;        DEBUGF  1, "K : backg y %x\n",[BG_Rect_Y_top_bottom]
3640
;        DEBUGF  1, "K : backg y %x\n",[BG_Rect_Y_top_bottom]
3641
;--------- set event 5 start ----------
3641
;--------- set event 5 start ----------
3642
        push    ecx edi
3642
        push    ecx edi
3643
        xor     edi, edi
3643
        xor     edi, edi
3644
        mov     ecx, [TASK_COUNT]
3644
        mov     ecx, [thread_count]
3645
;--------------------------------------
3645
;--------------------------------------
3646
align 4
3646
align 4
3647
set_bgr_event:
3647
set_bgr_event:
3648
        add     edi, sizeof.APPDATA
3648
        add     edi, sizeof.APPDATA
3649
        mov     eax, [BG_Rect_X_left_right]
3649
        mov     eax, [BG_Rect_X_left_right]
Line 3731... Line 3731...
3731
        dec     byte [SYS_SHUTDOWN]
3731
        dec     byte [SYS_SHUTDOWN]
3732
        je      system_shutdown
3732
        je      system_shutdown
3733
;--------------------------------------
3733
;--------------------------------------
3734
align 4
3734
align 4
3735
noshutdown:
3735
noshutdown:
3736
        mov     eax, [TASK_COUNT]           ; termination
3736
        mov     eax, [thread_count]           ; termination
3737
        mov     ebx, TASK_DATA+TASKDATA.state
3737
        mov     ebx, TASK_DATA+TASKDATA.state
3738
        mov     esi, 1
3738
        mov     esi, 1
3739
;--------------------------------------
3739
;--------------------------------------
3740
align 4
3740
align 4
3741
newct:
3741
newct:
Line 3970... Line 3970...
3970
align 4
3970
align 4
3971
ricino:
3971
ricino:
3972
not_this_task:
3972
not_this_task:
3973
        pop     ecx
3973
        pop     ecx
Line 3974... Line 3974...
3974
 
3974
 
3975
        cmp     ecx, [TASK_COUNT]
3975
        cmp     ecx, [thread_count]
Line 3976... Line 3976...
3976
        jle     newdw2
3976
        jle     newdw2
3977
 
3977
 
3978
        pop     eax
3978
        pop     eax