Subversion Repositories Kolibri OS

Rev

Rev 2465 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2465 Rev 3555
Line 3... Line 3...
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
3
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
4
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa      ;;
5
;; Distributed under terms of the GNU General Public License    ;;
5
;; Distributed under terms of the GNU General Public License    ;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
6
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Line 7... Line 7...
7
 
7
 
Line 8... Line 8...
8
$Revision: 2465 $
8
$Revision: 3555 $
Line 9... Line 9...
9
 
9
 
10
 
10
 
11
sys_cd_audio:
11
sys_cd_audio:
12
 
12
 
13
        cmp     word [cdbase], word 0
13
        cmp     word [cdbase], word 0
Line 14... Line 14...
14
     jnz  @f
14
        jnz     @f
15
        mov     eax, 1
15
        mov     eax, 1
16
     ret
16
        ret
Line 17... Line 17...
17
   @@:
17
   @@:
18
 
18
 
19
     ; eax=1 cdplay at ebx 0x00FFSSMM
19
     ; eax=1 cdplay at ebx 0x00FFSSMM
20
     ; eax=2 get tracklist size of ecx to [ebx]
20
     ; eax=2 get tracklist size of ecx to [ebx]
21
     ; eax=3 stop/pause playing
21
     ; eax=3 stop/pause playing
Line 22... Line 22...
22
 
22
 
23
        cmp     eax, 1
23
        cmp     eax, 1
24
     jnz  nocdp
24
        jnz     nocdp
25
     call sys_cdplay
25
        call    sys_cdplay
26
     ret
26
        ret
27
   nocdp:
27
   nocdp:
28
 
28
 
29
        cmp     eax, 2
29
        cmp     eax, 2
Line 30... Line 30...
30
     jnz nocdtl
30
        jnz     nocdtl
31
        mov     edi, [TASK_BASE]
31
        mov     edi, [TASK_BASE]
32
        add     edi, TASKDATA.mem_start
32
        add     edi, TASKDATA.mem_start
33
        add     ebx, [edi]
33
        add     ebx, [edi]
34
     call sys_cdtracklist
34
        call    sys_cdtracklist
Line 35... Line 35...
35
     ret
35
        ret
36
   nocdtl:
36
   nocdtl:
Line 37... Line 37...
37
 
37
 
Line 38... Line 38...
38
        cmp     eax, 3
38
        cmp     eax, 3
Line 39... Line 39...
39
     jnz nocdpause
39
        jnz     nocdpause
40
     call sys_cdpause
40
        call    sys_cdpause
41
     ret
41
        ret
42
   nocdpause:
42
   nocdpause:
43
 
43
 
44
        mov     eax, 0xffffff01
44
        mov     eax, 0xffffff01
45
     ret
45
        ret
46
 
46
 
47
 
47
 
48
 
48
 
49
sys_cd_atapi_command:
49
sys_cd_atapi_command:
50
 
50
 
51
     pushad
51
        pushad
52
 
52
 
53
        mov     dx, word [cdbase]
53
        mov     dx, word [cdbase]
54
        add     dx, 6
54
        add     dx, 6
55
        mov     ax, word [cdid]
55
        mov     ax, word [cdid]
56
        out     dx, al
56
        out     dx, al
57
        mov     esi, 10
57
        mov     esi, 10
58
     call delay_ms
58
        call    delay_ms
59
        mov     dx, word [cdbase]
59
        mov     dx, word [cdbase]
60
        add     dx, 7
60
        add     dx, 7
61
        in      al, dx
61
        in      al, dx
62
        and     al, 0x80
62
        and     al, 0x80
63
        cmp     al, 0
63
        cmp     al, 0
64
     jnz  res
64
        jnz     res
65
     jmp  cdl6
65
        jmp     cdl6
66
   res:
66
   res:
67
        mov     dx, word [cdbase]
67
        mov     dx, word [cdbase]
68
        add     dx, 7
68
        add     dx, 7
69
        mov     al, 0x8
69
        mov     al, 0x8
70
        out     dx, al
70
        out     dx, al
71
        mov     dx, word [cdbase]
71
        mov     dx, word [cdbase]
72
        add     dx, 0x206
72
        add     dx, 0x206
73
        mov     al, 0xe
73
        mov     al, 0xe
74
        out     dx, al
74
        out     dx, al
75
        mov     esi, 1
75
        mov     esi, 1
76
     call delay_ms
76
        call    delay_ms
77
        mov     dx, word [cdbase]
77
        mov     dx, word [cdbase]
78
        add     dx, 0x206
78
        add     dx, 0x206
79
        mov     al, 0x8
79
        mov     al, 0x8
80
        out     dx, al
80
        out     dx, al
81
        mov     esi, 30
81
        mov     esi, 30
82
     call delay_ms
82
        call    delay_ms
83
        xor     cx, cx
83
        xor     cx, cx
84
   cdl5:
84
   cdl5:
85
     inc  cx
85
        inc     cx
86
        cmp     cx, 10
86
        cmp     cx, 10
87
     jz   cdl6
87
        jz      cdl6
Line 106... Line 106...
106
        mov     dx, word [cdbase]
106
        mov     dx, word [cdbase]
107
        add     dx, 7
107
        add     dx, 7
108
        mov     al, 0xec
108
        mov     al, 0xec
109
        out     dx, al
109
        out     dx, al
110
        mov     esi, 5
110
        mov     esi, 5
111
     call delay_ms
111
        call    delay_ms
112
        mov     dx, word [cdbase]
112
        mov     dx, word [cdbase]
113
        add     dx, 1
113
        add     dx, 1
114
        mov     al, 0
114
        mov     al, 0
115
        out     dx, al
115
        out     dx, al
116
        add     dx, 1
116
        add     dx, 1
Line 130... Line 130...
130
        out     dx, al
130
        out     dx, al
131
        xor     cx, cx
131
        xor     cx, cx
132
        mov     dx, word [cdbase]
132
        mov     dx, word [cdbase]
133
        add     dx, 7
133
        add     dx, 7
134
   cdl1:
134
   cdl1:
135
     inc  cx
135
        inc     cx
136
        cmp     cx, 100
136
        cmp     cx, 100
137
     jz   cdl2
137
        jz      cdl2
138
        in      al, dx
138
        in      al, dx
139
        and     ax, 0x88
139
        and     ax, 0x88
140
        cmp     al, 0x8
140
        cmp     al, 0x8
141
     jz   cdl2
141
        jz      cdl2
142
        mov     esi, 2
142
        mov     esi, 2
143
     call delay_ms
143
        call    delay_ms
144
     jmp  cdl1
144
        jmp     cdl1
145
   cdl2:
145
   cdl2:
Line 146... Line 146...
146
 
146
 
147
     popad
147
        popad
Line 148... Line 148...
148
     ret
148
        ret
Line 149... Line 149...
149
 
149
 
150
 
150
 
151
sys_cdplay:
151
sys_cdplay:
152
 
152
 
153
        mov     ax, 5
153
        mov     ax, 5
154
     push ax
154
        push    ax
155
     push ebx
155
        push    ebx
156
   cdplay:
156
   cdplay:
157
     call sys_cd_atapi_command
157
        call    sys_cd_atapi_command
158
     cli
158
        cli
159
        mov     dx, word [cdbase]
159
        mov     dx, word [cdbase]
Line 169... Line 169...
169
        mov     ax, 0x0001
169
        mov     ax, 0x0001
170
        out     dx, ax
170
        out     dx, ax
171
        mov     ax, 0x0000
171
        mov     ax, 0x0000
172
        out     dx, ax
172
        out     dx, ax
173
        mov     esi, 10
173
        mov     esi, 10
174
     call delay_ms
174
        call    delay_ms
175
     sti
175
        sti
176
        add     dx, 7
176
        add     dx, 7
177
        in      al, dx
177
        in      al, dx
178
        test    al, 1
178
        test    al, 1
179
     jz   cdplayok
179
        jz      cdplayok
180
        mov     ax, [esp+4]
180
        mov     ax, [esp+4]
181
     dec  ax
181
        dec     ax
182
        mov     [esp+4], ax
182
        mov     [esp+4], ax
183
        cmp     ax, 0
183
        cmp     ax, 0
184
     jz   cdplayfail
184
        jz      cdplayfail
185
     jmp  cdplay
185
        jmp     cdplay
186
   cdplayfail:
186
   cdplayfail:
187
   cdplayok:
187
   cdplayok:
188
     pop  ebx
188
        pop     ebx
189
     pop  ax
189
        pop     ax
190
     xor  eax, eax
190
        xor     eax, eax
191
     ret
191
        ret
Line 192... Line 192...
192
 
192
 
Line 193... Line 193...
193
 
193
 
194
sys_cdtracklist:
194
sys_cdtracklist:
195
 
195
 
196
     push ebx
196
        push    ebx
197
   tcdplay:
197
   tcdplay:
198
     call sys_cd_atapi_command
198
        call    sys_cd_atapi_command
199
        mov     dx, word [cdbase]
199
        mov     dx, word [cdbase]
200
        mov     ax, 0x43+2*256
200
        mov     ax, 0x43+2*256
Line 211... Line 211...
211
        out     dx, ax
211
        out     dx, ax
212
        in      al, dx
212
        in      al, dx
213
        mov     cx, 1000
213
        mov     cx, 1000
214
        mov     dx, word [cdbase]
214
        mov     dx, word [cdbase]
215
        add     dx, 7
215
        add     dx, 7
216
     cld
216
        cld
217
   cdtrnwewait:
217
   cdtrnwewait:
218
        mov     esi, 10
218
        mov     esi, 10
219
     call delay_ms
219
        call    delay_ms
220
        in      al, dx
220
        in      al, dx
221
        and     al, 128
221
        and     al, 128
222
        cmp     al, 0
222
        cmp     al, 0
223
     jz   cdtrl1
223
        jz      cdtrl1
224
     loop cdtrnwewait
224
        loop    cdtrnwewait
225
   cdtrl1:
225
   cdtrl1:
226
     ; read the result
226
     ; read the result
227
        mov     ecx, [esp+0]
227
        mov     ecx, [esp+0]
228
        mov     dx, word [cdbase]
228
        mov     dx, word [cdbase]
229
   cdtrread:
229
   cdtrread:
230
        add     dx, 7
230
        add     dx, 7
231
        in      al, dx
231
        in      al, dx
232
        and     al, 8
232
        and     al, 8
233
        cmp     al, 8
233
        cmp     al, 8
234
     jnz  cdtrdone
234
        jnz     cdtrdone
235
        sub     dx, 7
235
        sub     dx, 7
236
        in      ax, dx
236
        in      ax, dx
237
        mov     [ecx], ax
237
        mov     [ecx], ax
238
        add     ecx, 2
238
        add     ecx, 2
239
     jmp  cdtrread
239
        jmp     cdtrread
240
   cdtrdone:
240
   cdtrdone:
241
     pop  ecx
241
        pop     ecx
242
     xor  eax, eax
242
        xor     eax, eax
243
     ret
243
        ret
Line 244... Line 244...
244
 
244
 
Line 245... Line 245...
245
 
245
 
Line 246... Line 246...
246
sys_cdpause:
246
sys_cdpause:
247
 
247
 
248
     call sys_cd_atapi_command
248
        call    sys_cd_atapi_command
249
 
249
 
Line 260... Line 260...
260
        out     dx, ax
260
        out     dx, ax
261
        mov     ax, 0
261
        mov     ax, 0
262
        out     dx, ax
262
        out     dx, ax
Line 263... Line 263...
263
 
263
 
264
        mov     esi, 10
264
        mov     esi, 10
265
     call delay_ms
265
        call    delay_ms
266
        add     dx, 7
266
        add     dx, 7
Line 267... Line 267...
267
        in      al, dx
267
        in      al, dx
268
 
268