Subversion Repositories Kolibri OS

Rev

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

Rev 9910 Rev 9911
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: 9910 $
80
$Revision: 9911 $
Line 1071... Line 1071...
1071
        cmp     al, 129
1071
        cmp     al, 129
1072
        jne     .bll1
1072
        jne     .bll1
1073
end if
1073
end if
Line 1074... Line 1074...
1074
 
1074
 
1075
        mov     [timer_ticks_enable], 1         ; for cd driver
-
 
1076
 
1075
        mov     [timer_ticks_enable], 1         ; for cd driver
Line 1077... Line 1076...
1077
        sti
1076
        sti
Line 1078... Line 1077...
1078
 
1077
 
1079
        call    mtrr_validate
-
 
1080
 
-
 
1081
        jmp     osloop
1078
        call    mtrr_validate
Line 1082... Line 1079...
1082
 
1079
 
1083
 
1080
        jmp     osloop
1084
        ; Fly :)
1081
        ; Fly :)
Line 1264... Line 1261...
1264
; All other parts of the kernel do not expect multi-CPU.
1261
; All other parts of the kernel do not expect multi-CPU.
1265
; Also, APs don't even have a stack here.
1262
; Also, APs don't even have a stack here.
1266
; Beware. Don't do anything here. Anything at all.
1263
; Beware. Don't do anything here. Anything at all.
1267
idle_loop:
1264
idle_loop:
1268
        cmp     [use_mwait_for_idle], 0
1265
        cmp     [use_mwait_for_idle], 0
1269
        jnz     idle_loop_mwait
1266
        jnz     .mwait
Line 1270... Line 1267...
1270
 
1267
 
1271
idle_loop_hlt:
1268
.hlt:
1272
        hlt
1269
        hlt
Line 1273... Line 1270...
1273
        jmp     idle_loop_hlt
1270
        jmp     .hlt
1274
 
1271
 
1275
idle_loop_mwait:
1272
.mwait:
1276
        mov     eax, idle_addr
1273
        mov     eax, idle_addr
1277
        xor     ecx, ecx
1274
        xor     ecx, ecx
1278
        xor     edx, edx
1275
        xor     edx, edx
1279
        monitor
1276
        monitor
1280
        xor     ecx, ecx
1277
        xor     ecx, ecx
1281
        mov     eax, 20h        ; or 10h
1278
        mov     eax, 20h        ; or 10h
Line 1282... Line 1279...
1282
        mwait
1279
        mwait
1283
        jmp     idle_loop_mwait
1280
        jmp     .mwait
1284
 
1281
 
Line 1332... Line 1329...
1332
endg
1329
endg
Line 1333... Line 1330...
1333
 
1330
 
Line 1334... Line 1331...
1334
set_variables:
1331
set_variables:
1335
 
1332
 
1336
        mov     ecx, 0x16                    ; flush port 0x60
1333
        mov     ecx, 0x16                    ; flush port 0x60
1337
.fl60:
1334
@@:
1338
        in      al, 0x60
1335
        in      al, 0x60
Line 1339... Line 1336...
1339
        loop    .fl60
1336
        loop    @b
1340
        push    eax
1337
        push    eax
1341
 
1338
 
Line 1401... Line 1398...
1401
display_number_force:
1398
display_number_force:
1402
        push    eax
1399
        push    eax
1403
        and     eax, 0x3fffffff
1400
        and     eax, 0x3fffffff
1404
        cmp     eax, 0xffff     ; length > 0 ?
1401
        cmp     eax, 0xffff     ; length > 0 ?
1405
        pop     eax
1402
        pop     eax
1406
        jge     cont_displ
1403
        jge     .cont_displ
1407
        ret
1404
        ret
1408
   cont_displ:
1405
   .cont_displ:
1409
        push    eax
1406
        push    eax
1410
        and     eax, 0x3fffffff
1407
        and     eax, 0x3fffffff
1411
        cmp     eax, 61*0x10000  ; length <= 60 ?
1408
        cmp     eax, 61*0x10000  ; length <= 60 ?
1412
        pop     eax
1409
        pop     eax
1413
        jb      cont_displ2
1410
        jb      .cont_displ2
1414
        ret
1411
        ret
1415
   cont_displ2:
1412
   .cont_displ2:
Line 1416... Line 1413...
1416
 
1413
 
Line 1417... Line 1414...
1417
        pushad
1414
        pushad
1418
 
1415
 
1419
        cmp     al, 1            ; ecx is a pointer ?
1416
        cmp     al, 1            ; ecx is a pointer ?
1420
        jne     displnl1
1417
        jne     @f
1421
        mov     ebp, ebx
1418
        mov     ebp, ebx
1422
        add     ebp, 4
1419
        add     ebp, 4
1423
        mov     ebp, [ebp + std_application_base_address]
1420
        mov     ebp, [ebp] ;[ebp + std_application_base_address]
1424
        mov     ebx, [ebx + std_application_base_address]
1421
        mov     ebx, [ebx] ;[ebx + std_application_base_address]
Line 1425... Line 1422...
1425
 displnl1:
1422
@@:
1426
        sub     esp, 64
1423
        sub     esp, 64
-
 
1424
 
1427
 
1425
        test    ah, ah            ; DECIMAL
1428
        test    ah, ah            ; DECIMAL
1426
        jnz     .no_display_desnum
1429
        jnz     no_display_desnum
1427
 
1430
        shr     eax, 16
1428
        shr     eax, 16
1431
        and     eax, 0xC03f
1429
        and     eax, 0xC03f
1432
;     and   eax,0x3f
1430
;     and   eax,0x3f
1433
        push    eax
1431
        push    eax
1434
        and     eax, 0x3f
1432
        and     eax, 0x3f
1435
        mov     edi, esp
1433
        mov     edi, esp
1436
        add     edi, 4+64-1
1434
        add     edi, 4+64-1
1437
        mov     ecx, eax
1435
        mov     ecx, eax
1438
        mov     eax, ebx
1436
        mov     eax, ebx
1439
        mov     ebx, 10
1437
        mov     ebx, 10
1440
 d_desnum:
1438
@@:
1441
        xor     edx, edx
1439
        xor     edx, edx
1442
        call    division_64_bits
1440
        call    division_64_bits
1443
        div     ebx
1441
        div     ebx
1444
        add     dl, 48
1442
        add     dl, 48
-
 
1443
        mov     [edi], dl
1445
        mov     [edi], dl
1444
        dec     edi
1446
        dec     edi
1445
        loop    @b
1447
        loop    d_desnum
1446
 
1448
        pop     eax
1447
        pop     eax
1449
        call    normalize_number
1448
        call    normalize_number
1450
        call    draw_num_text
1449
        call    draw_num_text
1451
        add     esp, 64
1450
        add     esp, 64
Line 1452... Line 1451...
1452
        popad
1451
        popad
1453
        ret
1452
        ret
-
 
1453
.no_display_desnum:
1454
   no_display_desnum:
1454
 
1455
 
1455
        cmp     ah, 0x01         ; HEXADECIMAL
1456
        cmp     ah, 0x01         ; HEXADECIMAL
1456
        jne     .no_display_hexnum
1457
        jne     no_display_hexnum
1457
 
1458
        shr     eax, 16
1458
        shr     eax, 16
1459
        and     eax, 0xC03f
1459
        and     eax, 0xC03f
1460
;     and   eax,0x3f
1460
;     and   eax,0x3f
1461
        push    eax
1461
        push    eax
1462
        and     eax, 0x3f
1462
        and     eax, 0x3f
1463
        mov     edi, esp
1463
        mov     edi, esp
1464
        add     edi, 4+64-1
1464
        add     edi, 4+64-1
1465
        mov     ecx, eax
1465
        mov     ecx, eax
1466
        mov     eax, ebx
1466
        mov     eax, ebx
1467
        mov     ebx, 16
1467
        mov     ebx, 16
1468
   d_hexnum:
1468
@@:
1469
        xor     edx, edx
1469
        xor     edx, edx
1470
        call    division_64_bits
1470
        call    division_64_bits
1471
        div     ebx
1471
        div     ebx
1472
   hexletters = __fdo_hexdigits
1472
   ;hexletters = __fdo_hexdigits
1473
        add     edx, hexletters
1473
        add     edx, __fdo_hexdigits ;hexletters
-
 
1474
        mov     dl, [edx]
1474
        mov     dl, [edx]
1475
        mov     [edi], dl
1475
        mov     [edi], dl
1476
        dec     edi
1476
        dec     edi
1477
        loop    @b
1477
        loop    d_hexnum
1478
 
1478
        pop     eax
1479
        pop     eax
1479
        call    normalize_number
1480
        call    normalize_number
1480
        call    draw_num_text
1481
        call    draw_num_text
Line 1481... Line 1482...
1481
        add     esp, 64
1482
        add     esp, 64
1482
        popad
1483
        popad
-
 
1484
        ret
1483
        ret
1485
.no_display_hexnum:
1484
   no_display_hexnum:
1486
 
1485
 
1487
        cmp     ah, 0x02         ; BINARY
1486
        cmp     ah, 0x02         ; BINARY
1488
        jne     .no_display_binnum
1487
        jne     no_display_binnum
1489
 
1488
        shr     eax, 16
1490
        shr     eax, 16
1489
        and     eax, 0xC03f
1491
        and     eax, 0xC03f
1490
;     and   eax,0x3f
1492
;     and   eax,0x3f
1491
        push    eax
1493
        push    eax
1492
        and     eax, 0x3f
1494
        and     eax, 0x3f
1493
        mov     edi, esp
1495
        mov     edi, esp
1494
        add     edi, 4+64-1
1496
        add     edi, 4+64-1
1495
        mov     ecx, eax
1497
        mov     ecx, eax
1496
        mov     eax, ebx
1498
        mov     eax, ebx
1497
        mov     ebx, 2
1499
        mov     ebx, 2
1498
   d_binnum:
1500
@@:
1499
        xor     edx, edx
1501
        xor     edx, edx
1500
        call    division_64_bits
1502
        call    division_64_bits
-
 
1503
        div     ebx
1501
        div     ebx
1504
        add     dl, 48
1502
        add     dl, 48
1505
        mov     [edi], dl
1503
        mov     [edi], dl
1506
        dec     edi
1504
        dec     edi
1507
        loop    @b
1505
        loop    d_binnum
1508
 
1506
        pop     eax
1509
        pop     eax
1507
        call    normalize_number
1510
        call    normalize_number
Line 1508... Line 1511...
1508
        call    draw_num_text
1511
        call    draw_num_text
1509
        add     esp, 64
1512
        add     esp, 64
1510
        popad
1513
        popad
Line 1570... Line 1573...
1570
        jnc     @f
1573
        jnc     @f
1571
        mov     edi, eax
1574
        mov     edi, eax
1572
@@:
1575
@@:
1573
        jmp     dtext
1576
        jmp     dtext
1574
;-----------------------------------------------------------------------------
1577
;-----------------------------------------------------------------------------
1575
iglobal
-
 
1576
midi_base dw 0
-
 
1577
endg
-
 
1578
;-----------------------------------------------------------------------------
-
 
1579
align 4
1578
align 4
1580
sys_setup:
1579
sys_setup:
1581
;  1 = roland mpu midi base , base io address
1580
;  1 = roland mpu midi base , base io address
1582
;  2 = keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1581
;  2 = keyboard   1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
1583
;  3 = not used
1582
;  3 = not used
Line 1807... Line 1806...
1807
;-----------------------------------------------------------------------------
1806
;-----------------------------------------------------------------------------
1808
get_timer_ticks:
1807
get_timer_ticks:
1809
        mov     eax, [timer_ticks]
1808
        mov     eax, [timer_ticks]
1810
        ret
1809
        ret
1811
;-----------------------------------------------------------------------------
1810
;-----------------------------------------------------------------------------
-
 
1811
iglobal
-
 
1812
midi_base dw 0
-
 
1813
endg
Line -... Line 1814...
-
 
1814
 
-
 
1815
align 4
-
 
1816
sys_midi:
-
 
1817
        cmp     word [mididp], 0
-
 
1818
        jnz     @f
-
 
1819
        mov     [esp + SYSCALL_STACK.eax], 1
-
 
1820
        ret
-
 
1821
@@:
-
 
1822
        and     [esp + SYSCALL_STACK.eax], 0
-
 
1823
        dec     ebx
-
 
1824
        jnz     .smn1
-
 
1825
 ;    call setuart
-
 
1826
@@:
-
 
1827
        call    .is_output
-
 
1828
        test    al, al
-
 
1829
        jnz     @b
-
 
1830
        mov     dx, word [midisp]
-
 
1831
        mov     al, 0xff
-
 
1832
        out     dx, al
-
 
1833
@@:
-
 
1834
        mov     dx, word [midisp]
-
 
1835
        mov     al, 0xff
-
 
1836
        out     dx, al
-
 
1837
        call    .is_input
-
 
1838
        test    al, al
-
 
1839
        jnz     @b
-
 
1840
        call    .get_mpu_in
-
 
1841
        cmp     al, 0xfe
-
 
1842
        jnz     @b
-
 
1843
@@:
-
 
1844
        call    .is_output
-
 
1845
        test    al, al
-
 
1846
        jnz     @b
-
 
1847
        mov     dx, word [midisp]
-
 
1848
        mov     al, 0x3f
-
 
1849
        out     dx, al
-
 
1850
        ret
-
 
1851
.smn1:
-
 
1852
        dec     ebx
-
 
1853
        jnz     .ret
-
 
1854
@@:
-
 
1855
        call    .get_mpu_in
-
 
1856
        call    .is_output
-
 
1857
        test    al, al
-
 
1858
        jnz     @b
-
 
1859
        mov     al, bl
-
 
1860
        call    .put_mpu_out
-
 
1861
.ret:
-
 
1862
        ret
1812
 
1863
 
1813
is_input:
1864
.is_input:
1814
        push    edx
1865
        push    edx
1815
        mov     dx, word [midisp]
1866
        mov     dx, word [midisp]
1816
        in      al, dx
1867
        in      al, dx
1817
        and     al, 0x80
1868
        and     al, 0x80
1818
        pop     edx
1869
        pop     edx
Line 1819... Line 1870...
1819
        ret
1870
        ret
1820
 
1871
 
1821
is_output:
1872
.is_output:
1822
        push    edx
1873
        push    edx
1823
        mov     dx, word [midisp]
1874
        mov     dx, word [midisp]
1824
        in      al, dx
1875
        in      al, dx
1825
        and     al, 0x40
1876
        and     al, 0x40
Line 1826... Line 1877...
1826
        pop     edx
1877
        pop     edx
1827
        ret
1878
        ret
1828
 
1879
 
1829
get_mpu_in:
1880
.get_mpu_in:
1830
        push    edx
1881
        push    edx
1831
        mov     dx, word [mididp]
1882
        mov     dx, word [mididp]
Line 1832... Line 1883...
1832
        in      al, dx
1883
        in      al, dx
1833
        pop     edx
1884
        pop     edx
1834
        ret
1885
        ret
1835
 
1886
 
1836
put_mpu_out:
1887
.put_mpu_out:
1837
        push    edx
1888
        push    edx
Line 1838... Line -...
1838
        mov     dx, word [mididp]
-
 
1839
        out     dx, al
-
 
1840
        pop     edx
-
 
1841
        ret
-
 
1842
 
-
 
1843
align 4
-
 
1844
sys_midi:
-
 
1845
        cmp     [mididp], 0
1889
        mov     dx, word [mididp]
1846
        jnz     sm0
-
 
1847
        mov     [esp+36], dword 1
-
 
1848
        ret
-
 
1849
sm0:
-
 
1850
        and     [esp+36], dword 0
-
 
1851
        dec     ebx
-
 
1852
        jnz     smn1
-
 
1853
 ;    call setuart
-
 
1854
su1:
-
 
1855
        call    is_output
-
 
1856
        test    al, al
-
 
1857
        jnz     su1
-
 
1858
        mov     dx, word [midisp]
-
 
1859
        mov     al, 0xff
-
 
1860
        out     dx, al
-
 
1861
su2:
-
 
1862
        mov     dx, word [midisp]
-
 
1863
        mov     al, 0xff
-
 
1864
        out     dx, al
-
 
1865
        call    is_input
-
 
1866
        test    al, al
-
 
1867
        jnz     su2
-
 
1868
        call    get_mpu_in
-
 
1869
        cmp     al, 0xfe
-
 
1870
        jnz     su2
-
 
1871
su3:
-
 
1872
        call    is_output
-
 
1873
        test    al, al
-
 
1874
        jnz     su3
-
 
1875
        mov     dx, word [midisp]
-
 
1876
        mov     al, 0x3f
-
 
1877
        out     dx, al
-
 
1878
        ret
-
 
1879
smn1:
-
 
1880
        dec     ebx
-
 
1881
        jnz     smn2
-
 
1882
sm10:
-
 
1883
        call    get_mpu_in
-
 
1884
        call    is_output
-
 
1885
        test    al, al
-
 
1886
        jnz     sm10
-
 
1887
        mov     al, bl
1890
        out     dx, al
1888
        call    put_mpu_out
-
 
1889
        smn2:
1891
        pop     edx
1890
        ret
1892
        ret
1891
 
1893
 
1892
sys_end:
1894
;-----------------------------------------------------------------------------
1893
;--------------------------------------
1895
sys_end:
Line 2026... Line 2028...
2026
        cmp     ecx, edx
2028
        cmp     ecx, edx
2027
        ja      .noprocessterminate
2029
        ja      .noprocessterminate
2028
        mov     eax, [thread_count]
2030
        mov     eax, [thread_count]
2029
        shl     ecx, BSF sizeof.APPDATA
2031
        shl     ecx, BSF sizeof.APPDATA
2030
        add     ecx, SLOT_BASE
2032
        add     ecx, SLOT_BASE
-
 
2033
 
2031
        mov     edx, [ecx + APPDATA.tid]
2034
        mov     edx, [ecx + APPDATA.tid]
2032
        cmp     byte [ecx + APPDATA.state], TSTATE_FREE
2035
        cmp     byte [ecx + APPDATA.state], TSTATE_FREE
2033
        jz      .noprocessterminate
2036
        jz      .noprocessterminate
2034
        push    eax
2037
        push    eax
2035
        mov     eax, ecx
2038
        mov     eax, ecx
Line 2052... Line 2055...
2052
        cmp     [_display.select_cursor], 0
2055
        cmp     [_display.select_cursor], 0
2053
        je      .restore_end
2056
        je      .restore_end
2054
; restore default cursor before killing
2057
; restore default cursor before killing
2055
        pusha
2058
        pusha
2056
        mov     ecx, [esp+32]
2059
        mov     ecx, [esp+32]
2057
        shl     ecx, 8
2060
        shl     ecx, BSF sizeof.APPDATA
2058
        add     ecx, SLOT_BASE
2061
        add     ecx, SLOT_BASE
2059
        mov     eax, [def_cursor]
2062
        mov     eax, [def_cursor]
2060
        cmp     [ecx + APPDATA.cursor], eax
2063
        cmp     [ecx + APPDATA.cursor], eax
2061
        je      @f
2064
        je      @f
2062
        call    restore_default_cursor_before_killing
2065
        call    restore_default_cursor_before_killing
Line 2076... Line 2079...
2076
.noprocessterminate:
2079
.noprocessterminate:
2077
        add     esp, 4
2080
        add     esp, 4
2078
        ret
2081
        ret
2079
;------------------------------------------------------------------------------
2082
;------------------------------------------------------------------------------
2080
sysfn_terminate2:
2083
sysfn_terminate2:
2081
;lock application_table_status mutex
-
 
2082
.table_status:
-
 
2083
        call    lock_application_table
2084
        call    lock_application_table
2084
        mov     eax, ecx
2085
        mov     eax, ecx
2085
        call    pid_to_slot
2086
        call    pid_to_slot
2086
        test    eax, eax
2087
        test    eax, eax
2087
        jz      .not_found
2088
        jz      .not_found
Line 2245... Line 2246...
2245
        ret
2246
        ret
2246
;------------------------------------------------------------------------------
2247
;------------------------------------------------------------------------------
2247
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2248
sysfn_sound_flag:       ; 18.8 = get/set sound_flag
2248
;     cmp  ecx,1
2249
;     cmp  ecx,1
2249
        dec     ecx
2250
        dec     ecx
2250
        jnz     nogetsoundflag
2251
        jnz     .set_flag
2251
        movzx   eax, byte [sound_flag]; get sound_flag
2252
        movzx   eax, byte [sound_flag]; get sound_flag
2252
        mov     [esp + SYSCALL_STACK.eax], eax
2253
        mov     [esp + SYSCALL_STACK.eax], eax
2253
        ret
2254
        ret
2254
 nogetsoundflag:
2255
.set_flag:
2255
;     cmp  ecx,2
2256
;     cmp  ecx,2
2256
        dec     ecx
2257
        dec     ecx
2257
        jnz     nosoundflag
2258
        jnz     .err
2258
        xor     byte [sound_flag], 1
2259
        xor     byte [sound_flag], 1
2259
 nosoundflag:
2260
.err:
2260
        ret
2261
        ret
2261
;------------------------------------------------------------------------------
2262
;------------------------------------------------------------------------------
2262
sysfn_minimize:         ; 18.10 = minimize window
2263
sysfn_minimize:         ; 18.10 = minimize window
2263
        mov     [window_minimize], 1
2264
        mov     [window_minimize], 1
2264
        call    wakeup_osloop
2265
        call    wakeup_osloop
Line 2293... Line 2294...
2293
        mov     dword [esp + SYSCALL_STACK.eax], -1
2294
        mov     dword [esp + SYSCALL_STACK.eax], -1
2294
        ret   
2295
        ret   
2295
;------------------------------------------------------------------------------
2296
;------------------------------------------------------------------------------
2296
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2297
sysfn_waitretrace:     ; 18.14 = sys wait retrace
2297
     ;wait retrace functions
2298
        ;wait retrace functions
2298
 sys_wait_retrace:
-
 
2299
        mov     edx, 0x3da
2299
        mov     edx, 0x3da
2300
 WaitRetrace_loop:
2300
.loop:
2301
        in      al, dx
2301
        in      al, dx
2302
        test    al, 1000b
2302
        test    al, 1000b
2303
        jz      WaitRetrace_loop
2303
        jz      .loop
2304
        and     [esp + SYSCALL_STACK.eax], dword 0
2304
        and     [esp + SYSCALL_STACK.eax], dword 0
2305
        ret
2305
        ret
2306
;------------------------------------------------------------------------------
2306
;------------------------------------------------------------------------------
2307
align 4
2307
align 4
2308
sysfn_centermouse:      ; 18.15 = mouse centered
2308
sysfn_centermouse:      ; 18.15 = mouse centered
Line 2488... Line 2488...
2488
        ret
2488
        ret
2489
.no_floppy_save:
2489
.no_floppy_save:
2490
        mov     [esp + SYSCALL_STACK.eax], dword 1
2490
        mov     [esp + SYSCALL_STACK.eax], dword 1
2491
        ret
2491
        ret
2492
;------------------------------------------------------------------------------
2492
;------------------------------------------------------------------------------
2493
 
-
 
2494
align 4
-
 
2495
sys_getkey:
-
 
2496
        mov     [esp + SYSCALL_STACK.eax], dword 1
-
 
2497
        ; test main buffer
-
 
2498
        mov     ebx, [current_slot_idx]                          ; TOP OF WINDOW STACK
-
 
2499
        movzx   ecx, word [WIN_STACK + ebx * 2]
-
 
2500
        mov     edx, [thread_count]
-
 
2501
        cmp     ecx, edx
-
 
2502
        jne     .finish
-
 
2503
        cmp     [KEY_COUNT], byte 0
-
 
2504
        je      .finish
-
 
2505
        movzx   ax, byte [KEY_BUFF + 120 + 2]
-
 
2506
        shl     eax, 8
-
 
2507
        mov     al, byte [KEY_BUFF]
-
 
2508
        shl     eax, 8
-
 
2509
        push    eax
-
 
2510
        dec     byte [KEY_COUNT]
-
 
2511
        and     byte [KEY_COUNT], 127
-
 
2512
        movzx   ecx, byte [KEY_COUNT]
-
 
2513
        add     ecx, 2
-
 
2514
        mov     eax, KEY_BUFF + 1
-
 
2515
        mov     ebx, KEY_BUFF
-
 
2516
        call    memmove
-
 
2517
        add     eax, 120 + 2
-
 
2518
        add     ebx, 120 + 2
-
 
2519
        call    memmove
-
 
2520
        pop     eax
-
 
2521
;--------------------------------------
-
 
2522
align 4
-
 
2523
.ret_eax:
-
 
2524
        mov     [esp + SYSCALL_STACK.eax], eax
-
 
2525
        ret
-
 
2526
;--------------------------------------
-
 
2527
align 4
-
 
2528
.finish:
-
 
2529
; test hotkeys buffer
-
 
2530
        mov     ecx, hotkey_buffer
-
 
2531
;--------------------------------------
-
 
2532
align 4
-
 
2533
@@:
-
 
2534
        cmp     [ecx], ebx
-
 
2535
        jz      .found
-
 
2536
        add     ecx, 8
-
 
2537
        cmp     ecx, hotkey_buffer + 120 * 8
-
 
2538
        jb      @b
-
 
2539
        ret
-
 
2540
;--------------------------------------
-
 
2541
align 4
-
 
2542
.found:
-
 
2543
        mov     ax, [ecx + 6]
-
 
2544
        shl     eax, 16
-
 
2545
        mov     ah, [ecx + 4]
-
 
2546
        mov     al, 2
-
 
2547
        and     dword [ecx + 4], 0
-
 
2548
        and     dword [ecx], 0
-
 
2549
        jmp     .ret_eax
-
 
2550
;------------------------------------------------------------------------------
-
 
2551
align 4
-
 
2552
sys_getbutton:
-
 
2553
        mov     ebx, [current_slot_idx]                         ; TOP OF WINDOW STACK
-
 
2554
        mov     [esp + SYSCALL_STACK.eax], dword 1
-
 
2555
        movzx   ecx, word [WIN_STACK + ebx * 2]
-
 
2556
        mov     edx, [thread_count] ; less than 256 processes
-
 
2557
        cmp     ecx, edx
-
 
2558
        jne     .exit
-
 
2559
        movzx   eax, byte [BTN_COUNT]
-
 
2560
        test    eax, eax
-
 
2561
        jz      .exit
-
 
2562
        mov     eax, [BTN_BUFF]
-
 
2563
        and     al, 0xFE                                    ; delete left button bit
-
 
2564
        mov     [BTN_COUNT], byte 0
-
 
2565
        mov     [esp + SYSCALL_STACK.eax], eax
-
 
2566
;--------------------------------------
-
 
2567
align 4
-
 
2568
.exit:
-
 
2569
        ret
-
 
2570
;------------------------------------------------------------------------------
-
 
2571
align 4
2493
align 4
2572
sys_cpuusage:
2494
sys_cpuusage:
Line 2573... Line 2495...
2573
 
2495
 
2574
;  RETURN:
2496
;  RETURN:
Line 3306... Line 3228...
3306
        mov     edi, [_display.win_map]              ; set os to use all pixels
3228
        mov     edi, [_display.win_map]              ; set os to use all pixels
3307
        mov     eax, 0x01010101
3229
        mov     eax, 0x01010101
3308
        mov     ecx, [_display.win_map_size]
3230
        mov     ecx, [_display.win_map_size]
3309
        shr     ecx, 2
3231
        shr     ecx, 2
3310
        rep stosd
3232
        rep stosd
3311
        mov     byte[window_data + 32 + WDATA.z_modif], ZPOS_DESKTOP
3233
        mov     byte[window_data + sizeof.WDATA + WDATA.z_modif], ZPOS_DESKTOP
3312
        mov     [REDRAW_BACKGROUND], 0
3234
        mov     [REDRAW_BACKGROUND], 0
3313
        ret
3235
        ret
3314
;-----------------------------------------------------------------------------
3236
;-----------------------------------------------------------------------------
3315
uglobal
3237
uglobal
3316
  imax    dd 0x0
3238
  imax    dd 0x0
Line 4035... Line 3957...
4035
;.forced:
3957
;.forced:
4036
;        call    vesa20_drawbar
3958
;        call    vesa20_drawbar
4037
;        call    [draw_pointer]
3959
;        call    [draw_pointer]
4038
;        ret
3960
;        ret
4039
;-----------------------------------------------------------------------------
3961
;-----------------------------------------------------------------------------
4040
align 4
-
 
4041
kb_write_wait_ack:
-
 
4042
 
-
 
4043
        push    ecx edx
-
 
4044
 
-
 
4045
        mov     dl, al
-
 
4046
        mov     ecx, 0x1ffff; last 0xffff, new value in view of fast CPU's
-
 
4047
.wait_output_ready:
-
 
4048
        in      al, 0x64
-
 
4049
        test    al, 2
-
 
4050
        jz      @f
-
 
4051
        loop    .wait_output_ready
-
 
4052
        mov     ah, 1
-
 
4053
        jmp     .nothing
-
 
4054
@@:
-
 
4055
        mov     al, dl
-
 
4056
        out     0x60, al
-
 
4057
        mov     ecx, 0xfffff; last 0xffff, new value in view of fast CPU's
-
 
4058
.wait_ack:
-
 
4059
        in      al, 0x64
-
 
4060
        test    al, 1
-
 
4061
        jnz     @f
-
 
4062
        loop    .wait_ack
-
 
4063
        mov     ah, 1
-
 
4064
        jmp     .nothing
-
 
4065
@@:
-
 
4066
        in      al, 0x60
-
 
4067
        xor     ah, ah
-
 
4068
 
-
 
4069
.nothing:
-
 
4070
        pop     edx ecx
-
 
4071
 
-
 
4072
        ret
-
 
4073
;-----------------------------------------------------------------------------
-
 
4074
 
-
 
4075
if used _rdtsc
3962
if used _rdtsc
4076
_rdtsc:
3963
_rdtsc:
4077
        bt      [cpu_caps], CAPS_TSC
3964
        bt      [cpu_caps], CAPS_TSC
4078
        jnc     .ret_rdtsc
3965
        jnc     .ret_rdtsc
4079
        rdtsc
3966
        rdtsc
Line 4240... Line 4127...
4240
        mov     [esp + SYSCALL_STACK.eax], edx
4127
        mov     [esp + SYSCALL_STACK.eax], edx
4241
        mov     [esp + SYSCALL_STACK.ebx], 1
4128
        mov     [esp + SYSCALL_STACK.ebx], 1
4242
        ret
4129
        ret
Line 4243... Line 4130...
4243
 
4130
 
4244
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4245
;; 66 sys function.                                                ;;
-
 
4246
;; in eax=66,ebx in [0..5],ecx,edx                                 ;;
-
 
4247
;; out eax                                                         ;;
-
 
4248
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
4249
iglobal
-
 
4250
align 4
-
 
4251
f66call:
-
 
4252
           dd sys_process_def.1   ; 1 = set keyboard mode
-
 
4253
           dd sys_process_def.2   ; 2 = get keyboard mode
-
 
4254
           dd sys_process_def.3   ; 3 = get keyboard ctrl, alt, shift
-
 
4255
           dd sys_process_def.4   ; 4 = set system-wide hotkey
-
 
4256
           dd sys_process_def.5   ; 5 = delete installed hotkey
-
 
4257
           dd sys_process_def.6   ; 6 = disable input, work only hotkeys
-
 
4258
           dd sys_process_def.7   ; 7 = enable input, opposition to f.66.6
-
 
4259
endg
-
 
4260
;-----------------------------------------------------------------------------
-
 
4261
align 4
-
 
4262
sys_process_def:
-
 
4263
        dec     ebx
-
 
4264
        cmp     ebx, 7
-
 
4265
        jae     .not_support    ;if >=8 then or eax,-1
-
 
4266
 
-
 
4267
        mov     edi, [current_slot]
-
 
4268
        jmp     dword [f66call + ebx*4]
-
 
4269
 
-
 
4270
.not_support:
-
 
4271
        or      [esp + SYSCALL_STACK.eax], -1
-
 
4272
        ret
-
 
4273
;-----------------------------------------------------------------------------
-
 
4274
align 4
-
 
4275
.1:
-
 
4276
        mov     [edi + APPDATA.keyboard_mode], cl
-
 
4277
        ret
-
 
4278
;-----------------------------------------------------------------------------
-
 
4279
align 4
-
 
4280
.2:                             ; 2 = get keyboard mode
-
 
4281
        movzx   eax, byte [edi + APPDATA.keyboard_mode]
-
 
4282
        mov     [esp + SYSCALL_STACK.eax], eax
-
 
4283
        ret
-
 
4284
;-----------------------------------------------------------------------------
-
 
4285
align 4
-
 
4286
.3:                             ;3 = get keyboard ctrl, alt, shift
-
 
4287
        mov     eax, [kb_state]
-
 
4288
        mov     [esp + SYSCALL_STACK.eax], eax
-
 
4289
        ret
-
 
4290
;-----------------------------------------------------------------------------
-
 
4291
align 4
-
 
4292
.4:
-
 
4293
        mov     edi, [current_slot_idx]
-
 
4294
        mov     eax, hotkey_list
-
 
4295
@@:
-
 
4296
        cmp     dword [eax + 8], 0
-
 
4297
        jz      .found_free
-
 
4298
        add     eax, 16
-
 
4299
        cmp     eax, hotkey_list+16*256
-
 
4300
        jb      @b
-
 
4301
        mov     dword [esp + SYSCALL_STACK.eax], 1
-
 
4302
        ret
-
 
4303
.found_free:
-
 
4304
        mov     [eax + 8], edi
-
 
4305
        mov     [eax + 4], edx
-
 
4306
        movzx   ecx, cl
-
 
4307
        lea     ecx, [hotkey_scancodes+ecx*4]
-
 
4308
        mov     edx, [ecx]
-
 
4309
        mov     [eax], edx
-
 
4310
        mov     [ecx], eax
-
 
4311
        mov     [eax + 12], ecx
-
 
4312
        test    edx, edx
-
 
4313
        jz      @f
-
 
4314
        mov     [edx + 12], eax
-
 
4315
@@:
-
 
4316
        and     dword [esp + SYSCALL_STACK.eax], 0
-
 
4317
        ret
-
 
4318
;-----------------------------------------------------------------------------
-
 
4319
align 4
-
 
4320
.5:
-
 
4321
        mov     edi, [current_slot_idx]
-
 
4322
        movzx   ebx, cl
-
 
4323
        lea     ebx, [hotkey_scancodes+ebx*4]
-
 
4324
        mov     eax, [ebx]
-
 
4325
.scan:
-
 
4326
        test    eax, eax
-
 
4327
        jz      .notfound
-
 
4328
        cmp     [eax + 8], edi
-
 
4329
        jnz     .next
-
 
4330
        cmp     [eax + 4], edx
-
 
4331
        jz      .found
-
 
4332
.next:
-
 
4333
        mov     eax, [eax]
-
 
4334
        jmp     .scan
-
 
4335
.notfound:
-
 
4336
        mov     dword [esp + SYSCALL_STACK.eax], 1
-
 
4337
        ret
-
 
4338
.found:
-
 
4339
        mov     ecx, [eax]
-
 
4340
        jecxz   @f
-
 
4341
        mov     edx, [eax + 12]
-
 
4342
        mov     [ecx + 12], edx
-
 
4343
@@:
-
 
4344
        mov     ecx, [eax + 12]
-
 
4345
        mov     edx, [eax]
-
 
4346
        mov     [ecx], edx
-
 
4347
        xor     edx, edx
-
 
4348
        mov     [eax + 4], edx
-
 
4349
        mov     [eax + 8], edx
-
 
4350
        mov     [eax + 12], edx
-
 
4351
        mov     [eax], edx
-
 
4352
        mov     [esp + SYSCALL_STACK.eax], edx
-
 
4353
        ret
-
 
4354
;-----------------------------------------------------------------------------
-
 
4355
align 4
-
 
4356
.6:
-
 
4357
        pushfd
-
 
4358
        cli
-
 
4359
        mov     eax, [PID_lock_input]
-
 
4360
        test    eax, eax
-
 
4361
        jnz     @f
-
 
4362
; get current PID
-
 
4363
        mov     eax, [current_slot]
-
 
4364
        mov     eax, [eax + APPDATA.tid]
-
 
4365
; set current PID for lock input
-
 
4366
        mov     [PID_lock_input], eax
-
 
4367
@@:
-
 
4368
        popfd
-
 
4369
        ret
-
 
4370
;-----------------------------------------------------------------------------
-
 
4371
align 4
-
 
4372
.7:
-
 
4373
        mov     eax, [PID_lock_input]
-
 
4374
        test    eax, eax
-
 
4375
        jz      @f
-
 
4376
; get current PID
-
 
4377
        mov     ebx, [current_slot]
-
 
4378
        mov     ebx, [ebx + APPDATA.tid]
-
 
4379
; compare current lock input with current PID
-
 
4380
        cmp     ebx, eax
-
 
4381
        jne     @f
-
 
4382
 
-
 
4383
        xor     eax, eax
-
 
4384
        mov     [PID_lock_input], eax
-
 
4385
@@:
-
 
4386
        ret
-
 
4387
;-----------------------------------------------------------------------------
-
 
4388
uglobal
-
 
4389
  PID_lock_input dd 0x0
-
 
4390
endg
-
 
4391
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4131
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4392
;; 61 sys function.                                                ;;
4132
;; 61 sys function.                                                ;;
4393
;; in eax=61,ebx in [1..3]                                         ;;
4133
;; in eax=61,ebx in [1..3]                                         ;;
4394
;; out eax                                                         ;;
4134
;; out eax                                                         ;;
4395
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4135
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 4735... Line 4475...
4735
        cmp     word [apm_vf], ax       ; Check APM BIOS enable
4475
        cmp     word [apm_vf], ax       ; Check APM BIOS enable
4736
        jne     @f
4476
        jne     @f
4737
        inc     eax
4477
        inc     eax
4738
        or      dword [esp + 44], eax   ; error
4478
        or      dword [esp + 44], eax   ; error
4739
        add     eax, 7
4479
        add     eax, 7
4740
        mov     dword [esp + 32], eax   ; 32-bit protected-mode interface not supported
4480
        mov     dword [esp + SYSCALL_STACK.eax], eax   ; 32-bit protected-mode interface not supported
4741
        ret
4481
        ret
Line 4742... Line 4482...
4742
 
4482
 
4743
@@:
4483
@@:
4744
;       xchg    eax, ecx
4484
;       xchg    eax, ecx
Line 4745... Line 4485...
4745
;       xchg    ebx, ecx
4485
;       xchg    ebx, ecx
4746
 
4486
 
4747
        cmp     dx, 3
4487
        cmp     dx, 3
4748
        ja      @f
4488
        ja      @f
4749
        and     [esp + 44], byte 0xfe    ; emulate func 0..3 as func 0
4489
        and     [esp + 44], byte 0xfe    ; emulate func 0..3 as func 0
4750
        mov     eax, [apm_vf]
4490
        mov     eax, [apm_vf]
4751
        mov     [esp + 32], eax
4491
        mov     [esp + SYSCALL_STACK.eax], eax
4752
        shr     eax, 16
4492
        shr     eax, 16
Line 4753... Line 4493...
4753
        mov     [esp + 28], eax
4493
        mov     [esp + SYSCALL_STACK.ecx], eax
Line 4754... Line 4494...
4754
        ret
4494
        ret
Line 4767... Line 4507...
4767
        mov     [master_tab], eax
4507
        mov     [master_tab], eax
4768
        mov     eax, cr3
4508
        mov     eax, cr3
4769
        mov     cr3, eax
4509
        mov     cr3, eax
4770
        pop     eax
4510
        pop     eax
Line 4771... Line 4511...
4771
 
4511
 
4772
        mov     [esp + 4 ], edi
4512
        mov     [esp + SYSCALL_STACK.edi], edi
4773
        mov     [esp + 8], esi
4513
        mov     [esp + SYSCALL_STACK.esi], esi
4774
        mov     [esp + 20], ebx
4514
        mov     [esp + SYSCALL_STACK.ebx], ebx
4775
        mov     [esp + 24], edx
4515
        mov     [esp + SYSCALL_STACK.edx], edx
4776
        mov     [esp + 28], ecx
4516
        mov     [esp + SYSCALL_STACK.ecx], ecx
4777
        mov     [esp + 32], eax
4517
        mov     [esp + SYSCALL_STACK.eax], eax
4778
        setc    al
4518
        setc    al
4779
        and     [esp + 44], byte 0xfe
4519
        and     [esp + 44], byte 0xfe
4780
        or      [esp + 44], al
4520
        or      [esp + 44], al
4781
        ret
4521
        ret