2010-10-01 11:21:55 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
2012-03-15 13:41:29 +01:00
|
|
|
;; Copyright (C) KolibriOS team 2004-2011. All rights reserved. ;;
|
2010-10-01 11:21:55 +02:00
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
|
|
|
$Revision$
|
|
|
|
|
|
|
|
|
|
|
|
sys_cd_audio:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp word [cdbase], word 0
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz @f
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, 1
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
|
|
|
@@:
|
|
|
|
|
|
|
|
; eax=1 cdplay at ebx 0x00FFSSMM
|
|
|
|
; eax=2 get tracklist size of ecx to [ebx]
|
|
|
|
; eax=3 stop/pause playing
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp eax, 1
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz nocdp
|
|
|
|
call sys_cdplay
|
|
|
|
ret
|
|
|
|
nocdp:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp eax, 2
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz nocdtl
|
2012-03-08 09:33:38 +01:00
|
|
|
mov edi, [TASK_BASE]
|
|
|
|
add edi, TASKDATA.mem_start
|
|
|
|
add ebx, [edi]
|
2010-10-01 11:21:55 +02:00
|
|
|
call sys_cdtracklist
|
|
|
|
ret
|
|
|
|
nocdtl:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp eax, 3
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz nocdpause
|
|
|
|
call sys_cdpause
|
|
|
|
ret
|
|
|
|
nocdpause:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov eax, 0xffffff01
|
2010-10-01 11:21:55 +02:00
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_cd_atapi_command:
|
|
|
|
|
|
|
|
pushad
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 6
|
|
|
|
mov ax, word [cdid]
|
|
|
|
out dx, al
|
|
|
|
mov esi, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 0x80
|
|
|
|
cmp al, 0
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz res
|
|
|
|
jmp cdl6
|
|
|
|
res:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
mov al, 0x8
|
|
|
|
out dx, al
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 0x206
|
|
|
|
mov al, 0xe
|
|
|
|
out dx, al
|
|
|
|
mov esi, 1
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 0x206
|
|
|
|
mov al, 0x8
|
|
|
|
out dx, al
|
|
|
|
mov esi, 30
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
xor cx, cx
|
2010-10-01 11:21:55 +02:00
|
|
|
cdl5:
|
|
|
|
inc cx
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp cx, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdl6
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 0x88
|
|
|
|
cmp al, 0x00
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdl5
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, 100
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
|
|
|
jmp cdl5
|
|
|
|
cdl6:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 4
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 5
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
mov al, 0xec
|
|
|
|
out dx, al
|
|
|
|
mov esi, 5
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 1
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
add dx, 1
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
add dx, 1
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
add dx, 1
|
|
|
|
mov al, 0
|
|
|
|
out dx, al
|
|
|
|
add dx, 1
|
|
|
|
mov al, 128
|
|
|
|
out dx, al
|
|
|
|
add dx, 2
|
|
|
|
mov al, 0xa0
|
|
|
|
out dx, al
|
|
|
|
xor cx, cx
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
2010-10-01 11:21:55 +02:00
|
|
|
cdl1:
|
|
|
|
inc cx
|
2012-03-08 09:33:38 +01:00
|
|
|
cmp cx, 100
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdl2
|
2012-03-08 09:33:38 +01:00
|
|
|
in al, dx
|
|
|
|
and ax, 0x88
|
|
|
|
cmp al, 0x8
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdl2
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, 2
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
|
|
|
jmp cdl1
|
|
|
|
cdl2:
|
|
|
|
|
|
|
|
popad
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
sys_cdplay:
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ax, 5
|
2010-10-01 11:21:55 +02:00
|
|
|
push ax
|
|
|
|
push ebx
|
|
|
|
cdplay:
|
|
|
|
call sys_cd_atapi_command
|
|
|
|
cli
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
mov ax, 0x0047
|
|
|
|
out dx, ax
|
|
|
|
mov al, 1
|
|
|
|
mov ah, [esp+0]; min xx
|
|
|
|
out dx, ax
|
|
|
|
mov ax, [esp+1]; fr sec
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 256+99
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0001
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0000
|
|
|
|
out dx, ax
|
|
|
|
mov esi, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
|
|
|
sti
|
2012-03-08 09:33:38 +01:00
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
test al, 1
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdplayok
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ax, [esp+4]
|
2010-10-01 11:21:55 +02:00
|
|
|
dec ax
|
2012-03-08 09:33:38 +01:00
|
|
|
mov [esp+4], ax
|
|
|
|
cmp ax, 0
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdplayfail
|
|
|
|
jmp cdplay
|
|
|
|
cdplayfail:
|
|
|
|
cdplayok:
|
|
|
|
pop ebx
|
|
|
|
pop ax
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
sys_cdtracklist:
|
|
|
|
|
|
|
|
push ebx
|
|
|
|
tcdplay:
|
|
|
|
call sys_cd_atapi_command
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
mov ax, 0x43+2*256
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 200
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0x0
|
|
|
|
out dx, ax
|
|
|
|
in al, dx
|
|
|
|
mov cx, 1000
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
2010-10-01 11:21:55 +02:00
|
|
|
cld
|
|
|
|
cdtrnwewait:
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
in al, dx
|
|
|
|
and al, 128
|
|
|
|
cmp al, 0
|
2010-10-01 11:21:55 +02:00
|
|
|
jz cdtrl1
|
|
|
|
loop cdtrnwewait
|
|
|
|
cdtrl1:
|
|
|
|
; read the result
|
2012-03-08 09:33:38 +01:00
|
|
|
mov ecx, [esp+0]
|
|
|
|
mov dx, word [cdbase]
|
2010-10-01 11:21:55 +02:00
|
|
|
cdtrread:
|
2012-03-08 09:33:38 +01:00
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 8
|
|
|
|
cmp al, 8
|
2010-10-01 11:21:55 +02:00
|
|
|
jnz cdtrdone
|
2012-03-08 09:33:38 +01:00
|
|
|
sub dx, 7
|
|
|
|
in ax, dx
|
|
|
|
mov [ecx], ax
|
|
|
|
add ecx, 2
|
2010-10-01 11:21:55 +02:00
|
|
|
jmp cdtrread
|
|
|
|
cdtrdone:
|
|
|
|
pop ecx
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
|
|
|
|
|
|
|
|
|
|
|
sys_cdpause:
|
|
|
|
|
|
|
|
call sys_cd_atapi_command
|
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
mov ax, 0x004B
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0
|
|
|
|
out dx, ax
|
|
|
|
mov ax, 0
|
|
|
|
out dx, ax
|
2010-10-01 11:21:55 +02:00
|
|
|
|
2012-03-08 09:33:38 +01:00
|
|
|
mov esi, 10
|
2010-10-01 11:21:55 +02:00
|
|
|
call delay_ms
|
2012-03-08 09:33:38 +01:00
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
2010-10-01 11:21:55 +02:00
|
|
|
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
|
|
|
|