Rev 129 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 129 | Rev 384 | ||
---|---|---|---|
1 | sys_cd_audio: |
1 | sys_cd_audio: |
2 | 2 | ||
3 | cmp word [cdbase],word 0 |
3 | cmp word [cdbase],word 0 |
4 | jnz @f |
4 | jnz @f |
5 | mov eax,1 |
5 | mov eax,1 |
6 | ret |
6 | ret |
7 | @@: |
7 | @@: |
8 | 8 | ||
9 | ; eax=1 cdplay at ebx 0x00FFSSMM |
9 | ; eax=1 cdplay at ebx 0x00FFSSMM |
10 | ; eax=2 get tracklist size of ecx to [ebx] |
10 | ; eax=2 get tracklist size of ecx to [ebx] |
11 | ; eax=3 stop/pause playing |
11 | ; eax=3 stop/pause playing |
12 | 12 | ||
13 | cmp eax,1 |
13 | cmp eax,1 |
14 | jnz nocdp |
14 | jnz nocdp |
15 | call sys_cdplay |
15 | call sys_cdplay |
16 | ret |
16 | ret |
17 | nocdp: |
17 | nocdp: |
18 | 18 | ||
19 | cmp eax,2 |
19 | cmp eax,2 |
20 | jnz nocdtl |
20 | jnz nocdtl |
21 | mov edi,[0x3010] |
21 | mov edi,[TASK_BASE] |
22 | add edi,TASKDATA.mem_start |
22 | add edi,TASKDATA.mem_start |
23 | add ebx,[edi] |
23 | add ebx,[edi] |
24 | call sys_cdtracklist |
24 | call sys_cdtracklist |
25 | ret |
25 | ret |
26 | nocdtl: |
26 | nocdtl: |
27 | 27 | ||
28 | cmp eax,3 |
28 | cmp eax,3 |
29 | jnz nocdpause |
29 | jnz nocdpause |
30 | call sys_cdpause |
30 | call sys_cdpause |
31 | ret |
31 | ret |
32 | nocdpause: |
32 | nocdpause: |
33 | 33 | ||
34 | mov eax,0xffffff01 |
34 | mov eax,0xffffff01 |
35 | ret |
35 | ret |
36 | 36 | ||
37 | 37 | ||
38 | 38 | ||
39 | sys_cd_atapi_command: |
39 | sys_cd_atapi_command: |
40 | 40 | ||
41 | pushad |
41 | pushad |
42 | 42 | ||
43 | mov dx,word [cdbase] |
43 | mov dx,word [cdbase] |
44 | add dx,6 |
44 | add dx,6 |
45 | mov ax,word [cdid] |
45 | mov ax,word [cdid] |
46 | out dx,al |
46 | out dx,al |
47 | mov esi,10 |
47 | mov esi,10 |
48 | call delay_ms |
48 | call delay_ms |
49 | mov dx,word [cdbase] |
49 | mov dx,word [cdbase] |
50 | add dx,7 |
50 | add dx,7 |
51 | in al,dx |
51 | in al,dx |
52 | and al,0x80 |
52 | and al,0x80 |
53 | cmp al,0 |
53 | cmp al,0 |
54 | jnz res |
54 | jnz res |
55 | jmp cdl6 |
55 | jmp cdl6 |
56 | res: |
56 | res: |
57 | mov dx,word [cdbase] |
57 | mov dx,word [cdbase] |
58 | add dx,7 |
58 | add dx,7 |
59 | mov al,0x8 |
59 | mov al,0x8 |
60 | out dx,al |
60 | out dx,al |
61 | mov dx,word [cdbase] |
61 | mov dx,word [cdbase] |
62 | add dx,0x206 |
62 | add dx,0x206 |
63 | mov al,0xe |
63 | mov al,0xe |
64 | out dx,al |
64 | out dx,al |
65 | mov esi,1 |
65 | mov esi,1 |
66 | call delay_ms |
66 | call delay_ms |
67 | mov dx,word [cdbase] |
67 | mov dx,word [cdbase] |
68 | add dx,0x206 |
68 | add dx,0x206 |
69 | mov al,0x8 |
69 | mov al,0x8 |
70 | out dx,al |
70 | out dx,al |
71 | mov esi,30 |
71 | mov esi,30 |
72 | call delay_ms |
72 | call delay_ms |
73 | xor cx,cx |
73 | xor cx,cx |
74 | cdl5: |
74 | cdl5: |
75 | inc cx |
75 | inc cx |
76 | cmp cx,10 |
76 | cmp cx,10 |
77 | jz cdl6 |
77 | jz cdl6 |
78 | mov dx,word [cdbase] |
78 | mov dx,word [cdbase] |
79 | add dx,7 |
79 | add dx,7 |
80 | in al,dx |
80 | in al,dx |
81 | and al,0x88 |
81 | and al,0x88 |
82 | cmp al,0x00 |
82 | cmp al,0x00 |
83 | jz cdl5 |
83 | jz cdl5 |
84 | mov esi,100 |
84 | mov esi,100 |
85 | call delay_ms |
85 | call delay_ms |
86 | jmp cdl5 |
86 | jmp cdl5 |
87 | cdl6: |
87 | cdl6: |
88 | mov dx,word [cdbase] |
88 | mov dx,word [cdbase] |
89 | add dx,4 |
89 | add dx,4 |
90 | mov al,0 |
90 | mov al,0 |
91 | out dx,al |
91 | out dx,al |
92 | mov dx,word [cdbase] |
92 | mov dx,word [cdbase] |
93 | add dx,5 |
93 | add dx,5 |
94 | mov al,0 |
94 | mov al,0 |
95 | out dx,al |
95 | out dx,al |
96 | mov dx,word [cdbase] |
96 | mov dx,word [cdbase] |
97 | add dx,7 |
97 | add dx,7 |
98 | mov al,0xec |
98 | mov al,0xec |
99 | out dx,al |
99 | out dx,al |
100 | mov esi,5 |
100 | mov esi,5 |
101 | call delay_ms |
101 | call delay_ms |
102 | mov dx,word [cdbase] |
102 | mov dx,word [cdbase] |
103 | add dx,1 |
103 | add dx,1 |
104 | mov al,0 |
104 | mov al,0 |
105 | out dx,al |
105 | out dx,al |
106 | add dx,1 |
106 | add dx,1 |
107 | mov al,0 |
107 | mov al,0 |
108 | out dx,al |
108 | out dx,al |
109 | add dx,1 |
109 | add dx,1 |
110 | mov al,0 |
110 | mov al,0 |
111 | out dx,al |
111 | out dx,al |
112 | add dx,1 |
112 | add dx,1 |
113 | mov al,0 |
113 | mov al,0 |
114 | out dx,al |
114 | out dx,al |
115 | add dx,1 |
115 | add dx,1 |
116 | mov al,128 |
116 | mov al,128 |
117 | out dx,al |
117 | out dx,al |
118 | add dx,2 |
118 | add dx,2 |
119 | mov al,0xa0 |
119 | mov al,0xa0 |
120 | out dx,al |
120 | out dx,al |
121 | xor cx,cx |
121 | xor cx,cx |
122 | mov dx,word [cdbase] |
122 | mov dx,word [cdbase] |
123 | add dx,7 |
123 | add dx,7 |
124 | cdl1: |
124 | cdl1: |
125 | inc cx |
125 | inc cx |
126 | cmp cx,100 |
126 | cmp cx,100 |
127 | jz cdl2 |
127 | jz cdl2 |
128 | in al,dx |
128 | in al,dx |
129 | and ax,0x88 |
129 | and ax,0x88 |
130 | cmp al,0x8 |
130 | cmp al,0x8 |
131 | jz cdl2 |
131 | jz cdl2 |
132 | mov esi,2 |
132 | mov esi,2 |
133 | call delay_ms |
133 | call delay_ms |
134 | jmp cdl1 |
134 | jmp cdl1 |
135 | cdl2: |
135 | cdl2: |
136 | 136 | ||
137 | popad |
137 | popad |
138 | ret |
138 | ret |
139 | 139 | ||
140 | 140 | ||
141 | sys_cdplay: |
141 | sys_cdplay: |
142 | 142 | ||
143 | mov ax,5 |
143 | mov ax,5 |
144 | push ax |
144 | push ax |
145 | push ebx |
145 | push ebx |
146 | cdplay: |
146 | cdplay: |
147 | call sys_cd_atapi_command |
147 | call sys_cd_atapi_command |
148 | cli |
148 | cli |
149 | mov dx,word [cdbase] |
149 | mov dx,word [cdbase] |
150 | mov ax,0x0047 |
150 | mov ax,0x0047 |
151 | out dx,ax |
151 | out dx,ax |
152 | mov al,1 |
152 | mov al,1 |
153 | mov ah,[esp+0] ; min xx |
153 | mov ah,[esp+0] ; min xx |
154 | out dx,ax |
154 | out dx,ax |
155 | mov ax,[esp+1] ; fr sec |
155 | mov ax,[esp+1] ; fr sec |
156 | out dx,ax |
156 | out dx,ax |
157 | mov ax,256+99 |
157 | mov ax,256+99 |
158 | out dx,ax |
158 | out dx,ax |
159 | mov ax,0x0001 |
159 | mov ax,0x0001 |
160 | out dx,ax |
160 | out dx,ax |
161 | mov ax,0x0000 |
161 | mov ax,0x0000 |
162 | out dx,ax |
162 | out dx,ax |
163 | mov esi,10 |
163 | mov esi,10 |
164 | call delay_ms |
164 | call delay_ms |
165 | sti |
165 | sti |
166 | add dx,7 |
166 | add dx,7 |
167 | in al,dx |
167 | in al,dx |
168 | test al,1 |
168 | test al,1 |
169 | jz cdplayok |
169 | jz cdplayok |
170 | mov ax,[esp+4] |
170 | mov ax,[esp+4] |
171 | dec ax |
171 | dec ax |
172 | mov [esp+4],ax |
172 | mov [esp+4],ax |
173 | cmp ax,0 |
173 | cmp ax,0 |
174 | jz cdplayfail |
174 | jz cdplayfail |
175 | jmp cdplay |
175 | jmp cdplay |
176 | cdplayfail: |
176 | cdplayfail: |
177 | cdplayok: |
177 | cdplayok: |
178 | pop ebx |
178 | pop ebx |
179 | pop ax |
179 | pop ax |
180 | xor eax, eax |
180 | xor eax, eax |
181 | ret |
181 | ret |
182 | 182 | ||
183 | 183 | ||
184 | sys_cdtracklist: |
184 | sys_cdtracklist: |
185 | 185 | ||
186 | push ebx |
186 | push ebx |
187 | tcdplay: |
187 | tcdplay: |
188 | call sys_cd_atapi_command |
188 | call sys_cd_atapi_command |
189 | mov dx,word [cdbase] |
189 | mov dx,word [cdbase] |
190 | mov ax,0x43+2*256 |
190 | mov ax,0x43+2*256 |
191 | out dx,ax |
191 | out dx,ax |
192 | mov ax,0x0 |
192 | mov ax,0x0 |
193 | out dx,ax |
193 | out dx,ax |
194 | mov ax,0x0 |
194 | mov ax,0x0 |
195 | out dx,ax |
195 | out dx,ax |
196 | mov ax,0x0 |
196 | mov ax,0x0 |
197 | out dx,ax |
197 | out dx,ax |
198 | mov ax,200 |
198 | mov ax,200 |
199 | out dx,ax |
199 | out dx,ax |
200 | mov ax,0x0 |
200 | mov ax,0x0 |
201 | out dx,ax |
201 | out dx,ax |
202 | in al,dx |
202 | in al,dx |
203 | mov cx,1000 |
203 | mov cx,1000 |
204 | mov dx,word [cdbase] |
204 | mov dx,word [cdbase] |
205 | add dx,7 |
205 | add dx,7 |
206 | cld |
206 | cld |
207 | cdtrnwewait: |
207 | cdtrnwewait: |
208 | mov esi,10 |
208 | mov esi,10 |
209 | call delay_ms |
209 | call delay_ms |
210 | in al,dx |
210 | in al,dx |
211 | and al,128 |
211 | and al,128 |
212 | cmp al,0 |
212 | cmp al,0 |
213 | jz cdtrl1 |
213 | jz cdtrl1 |
214 | loop cdtrnwewait |
214 | loop cdtrnwewait |
215 | cdtrl1: |
215 | cdtrl1: |
216 | ; read the result |
216 | ; read the result |
217 | mov ecx,[esp+0] |
217 | mov ecx,[esp+0] |
218 | mov dx,word [cdbase] |
218 | mov dx,word [cdbase] |
219 | cdtrread: |
219 | cdtrread: |
220 | add dx,7 |
220 | add dx,7 |
221 | in al,dx |
221 | in al,dx |
222 | and al,8 |
222 | and al,8 |
223 | cmp al,8 |
223 | cmp al,8 |
224 | jnz cdtrdone |
224 | jnz cdtrdone |
225 | sub dx,7 |
225 | sub dx,7 |
226 | in ax,dx |
226 | in ax,dx |
227 | mov [ecx],ax |
227 | mov [ecx],ax |
228 | add ecx,2 |
228 | add ecx,2 |
229 | jmp cdtrread |
229 | jmp cdtrread |
230 | cdtrdone: |
230 | cdtrdone: |
231 | pop ecx |
231 | pop ecx |
232 | xor eax, eax |
232 | xor eax, eax |
233 | ret |
233 | ret |
234 | 234 | ||
235 | 235 | ||
236 | sys_cdpause: |
236 | sys_cdpause: |
237 | 237 | ||
238 | call sys_cd_atapi_command |
238 | call sys_cd_atapi_command |
239 | 239 | ||
240 | mov dx,word [cdbase] |
240 | mov dx,word [cdbase] |
241 | mov ax,0x004B |
241 | mov ax,0x004B |
242 | out dx,ax |
242 | out dx,ax |
243 | mov ax,0 |
243 | mov ax,0 |
244 | out dx,ax |
244 | out dx,ax |
245 | mov ax,0 |
245 | mov ax,0 |
246 | out dx,ax |
246 | out dx,ax |
247 | mov ax,0 |
247 | mov ax,0 |
248 | out dx,ax |
248 | out dx,ax |
249 | mov ax,0 |
249 | mov ax,0 |
250 | out dx,ax |
250 | out dx,ax |
251 | mov ax,0 |
251 | mov ax,0 |
252 | out dx,ax |
252 | out dx,ax |
253 | 253 | ||
254 | mov esi,10 |
254 | mov esi,10 |
255 | call delay_ms |
255 | call delay_ms |
256 | add dx,7 |
256 | add dx,7 |
257 | in al,dx |
257 | in al,dx |
258 | 258 | ||
259 | xor eax, eax |
259 | xor eax, eax |
260 | ret |
260 | ret |