Subversion Repositories Kolibri OS

Rev

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

Rev 6 Rev 8
Line 3... Line 3...
3
 
3
 
4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
4
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
5
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
5
;; IRQ0 HANDLER (TIMER INTERRUPT) ;;
Line 6... Line -...
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-
 
7
 
-
 
8
 
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
9
 
7
 
10
align 32
8
align 32
11
irq0:
9
irq0:
12
        cmp   [error_interrupt],-1
-
 
13
        je    no_error_in_previous_process
10
	pushad
14
 
-
 
15
        mov   [0xffff],byte 0
11
	push  ds es
16
 
-
 
17
        mov   [error_interrupt],-1
12
	mov   ax, os_data
Line 18... Line 13...
18
 
13
	mov   ds, ax
19
     no_error_in_previous_process:
14
	mov   es, ax
20
 
15
 
21
        mov   edi,[0x3000]
16
        mov   edi,[0x3000]
Line 22... Line 17...
22
        shl   edi, 3
17
        shl   edi, 3
Line 23... Line 18...
23
                         ; fields of TSS descriptor:
18
                         ; fields of TSS descriptor:
24
        mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
-
 
25
 
-
 
26
        inc   dword [timer_ticks]
-
 
27
 
-
 
28
        mov   eax, [timer_ticks]
19
        mov   [edi+gdts+ tss0 +5], word 01010000b *256 +11101001b
29
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
20
 
30
        call  playNote           ; <<<--- INSERT THIS LINE !!!!!!!!!!
21
        inc   dword [timer_ticks]
31
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
22
 
32
 
23
        mov   eax, [timer_ticks]
33
        cmp   eax,[next_usage_update]
24
        cmp   eax,[next_usage_update]
Line -... Line 25...
-
 
25
        jb    .nocounter
-
 
26
        add   eax,100
34
        jb    .nocounter
27
        mov   [next_usage_update],eax
Line 35... Line 28...
35
        add   eax,100
28
        call  updatecputimes
36
        mov   [next_usage_update],eax
29
     .nocounter:
37
        call  updatecputimes
30
 
38
     .nocounter:
31
        call  playNote           ; <<<--- Speaker driver
39
 
32
 
Line 40... Line 33...
40
        mov   edi, [0x3010]
33
        mov   edi, [0x3010]
Line 41... Line 34...
41
 
34
 
42
        mov   ebx, [edi+0x18] ; time stamp counter add
35
        mov   ebx, [edi+0x18] ; time stamp counter add
Line 43... Line 36...
43
        call  _rdtsc
36
        call  _rdtsc
44
        sub   eax, ebx
37
        sub   eax, ebx
45
        add   eax, [edi+0x14] ; counter sum
38
        add   eax, [edi+0x14] ; counter sum
46
        mov   [edi+0x14], eax
39
        mov   [edi+0x14], eax
Line 62... Line 55...
62
        je    .waiting_for_termination
55
        je    .waiting_for_termination
63
        cmp   al, 9
56
        cmp   al, 9
64
        je    .waiting_for_reuse
57
        je    .waiting_for_reuse
Line 65... Line 58...
65
 
58
 
66
        cmp   ebx,[0x3004]
59
        cmp   ebx,[0x3004]
67
        jbe   nsched0
60
        jbe   @f
68
        mov   ebx,1
61
        mov   ebx,1
69
        mov   edi,0x3020
-
 
70
 
62
        mov   edi,0x3020
Line 71... Line 63...
71
      nsched0:
63
       @@:
72
 
64
 
Line -... Line 65...
-
 
65
        mov   [0x3000],ebx
73
        mov   [0x3000],ebx
66
        mov   [0x3010],edi
-
 
67
 
-
 
68
        jmp   @f
Line 74... Line 69...
74
        mov   [0x3010],edi
69
     .do_not_change_task:
75
 
70
        mov   [noct], 1
Line 76... Line 71...
76
      do_not_change_task:
71
       @@:
77
 
72
 
78
        call  _rdtsc
73
        call  _rdtsc
79
        mov   [edi+0x18],eax
74
        mov   [edi+0x18],eax
Line 80... Line 75...
80
 
75
 
81
        cmp   [0xffff],byte 0
76
        cmp   [0xffff],byte 0
82
        je    nodecffff
77
        je    @f
83
        dec   byte [0xffff]
78
        dec   byte [0xffff]
84
      nodecffff:
79
       @@:
Line 85... Line 80...
85
 
80
 
86
 
81
 
87
        shl   ebx, 3
82
        shl   ebx, 3
-
 
83
        xor   eax, eax
-
 
84
        add   ebx, tss0
-
 
85
        mov   word  [0xB004], bx   ; selector
88
        xor   eax, eax
86
        mov   dword [0xB000], eax  ; offset
89
        add   ebx, tss0
87
 
90
        mov   word  [0xB004], bx   ; selector    ;mov   [tss_s],bx
88
        mov   al,0x20   ; send End Of Interrupt signal
-
 
89
        mov   dx,0x20
-
 
90
        out   dx,al
-
 
91
 
-
 
92
        cmp   [noct], 1
-
 
93
        je    @f
-
 
94
.switch:
-
 
95
        jmp   pword [0xB000]
Line 91... Line -...
91
        mov   dword [0xB000], eax  ; offset
-
 
Line 92... Line 96...
92
 
96
        inc [context_counter] ;noname & halyavin
93
        mov   al,0x20   ; send End Of Interrupt signal
97
       @@:
-
 
98
        mov   [noct], 0
94
        mov   dx,0x20
99
        
Line 95... Line 100...
95
        out   dx,al
100
        pop   es ds
96
.switch:
101
        popad