2009-09-17 13:55:38 +02:00
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
;; ;;
|
|
|
|
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
|
|
|
|
;; Copyright (C) MenuetOS 2000-2004 Ville Mikael Turjanmaa ;;
|
|
|
|
;; Distributed under terms of the GNU General Public License ;;
|
|
|
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
|
|
|
2009-10-12 16:39:59 +02:00
|
|
|
$Revision$
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
sys_cd_audio:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
cmp word [cdbase], word 0
|
|
|
|
jnz @f
|
|
|
|
mov eax, 1
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
@@:
|
|
|
|
|
|
|
|
; eax=1 cdplay at ebx 0x00FFSSMM
|
|
|
|
; eax=2 get tracklist size of ecx to [ebx]
|
|
|
|
; eax=3 stop/pause playing
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
cmp eax, 1
|
|
|
|
jnz nocdp
|
|
|
|
call sys_cdplay
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
nocdp:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
cmp eax, 2
|
|
|
|
jnz nocdtl
|
|
|
|
mov edi, [TASK_BASE]
|
|
|
|
add edi, TASKDATA.mem_start
|
|
|
|
add ebx, [edi]
|
|
|
|
call sys_cdtracklist
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
nocdtl:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
cmp eax, 3
|
|
|
|
jnz nocdpause
|
|
|
|
call sys_cdpause
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
nocdpause:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
mov eax, 0xffffff01
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sys_cd_atapi_command:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
pushad
|
2009-09-17 13:55:38 +02:00
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 6
|
|
|
|
mov ax, word [cdid]
|
|
|
|
out dx, al
|
|
|
|
mov esi, 10
|
|
|
|
call delay_ms
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 0x80
|
|
|
|
cmp al, 0
|
|
|
|
jnz res
|
|
|
|
jmp cdl6
|
2009-09-17 13:55:38 +02:00
|
|
|
res:
|
2012-02-22 17:06:05 +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
|
|
|
|
call delay_ms
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 0x206
|
|
|
|
mov al, 0x8
|
|
|
|
out dx, al
|
|
|
|
mov esi, 30
|
|
|
|
call delay_ms
|
|
|
|
xor cx, cx
|
2009-09-17 13:55:38 +02:00
|
|
|
cdl5:
|
2012-02-22 17:06:05 +01:00
|
|
|
inc cx
|
|
|
|
cmp cx, 10
|
|
|
|
jz cdl6
|
|
|
|
mov dx, word [cdbase]
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 0x88
|
|
|
|
cmp al, 0x00
|
|
|
|
jz cdl5
|
|
|
|
mov esi, 100
|
|
|
|
call delay_ms
|
|
|
|
jmp cdl5
|
2009-09-17 13:55:38 +02:00
|
|
|
cdl6:
|
2012-02-22 17:06:05 +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
|
|
|
|
call delay_ms
|
|
|
|
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
|
2009-09-17 13:55:38 +02:00
|
|
|
cdl1:
|
2012-02-22 17:06:05 +01:00
|
|
|
inc cx
|
|
|
|
cmp cx, 100
|
|
|
|
jz cdl2
|
|
|
|
in al, dx
|
|
|
|
and ax, 0x88
|
|
|
|
cmp al, 0x8
|
|
|
|
jz cdl2
|
|
|
|
mov esi, 2
|
|
|
|
call delay_ms
|
|
|
|
jmp cdl1
|
2009-09-17 13:55:38 +02:00
|
|
|
cdl2:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
popad
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
sys_cdplay:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
mov ax, 5
|
|
|
|
push ax
|
|
|
|
push ebx
|
2009-09-17 13:55:38 +02:00
|
|
|
cdplay:
|
2012-02-22 17:06:05 +01:00
|
|
|
call sys_cd_atapi_command
|
|
|
|
cli
|
|
|
|
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
|
|
|
|
call delay_ms
|
|
|
|
sti
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
test al, 1
|
|
|
|
jz cdplayok
|
|
|
|
mov ax, [esp+4]
|
|
|
|
dec ax
|
|
|
|
mov [esp+4], ax
|
|
|
|
cmp ax, 0
|
|
|
|
jz cdplayfail
|
|
|
|
jmp cdplay
|
2009-09-17 13:55:38 +02:00
|
|
|
cdplayfail:
|
|
|
|
cdplayok:
|
2012-02-22 17:06:05 +01:00
|
|
|
pop ebx
|
|
|
|
pop ax
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
sys_cdtracklist:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
push ebx
|
2009-09-17 13:55:38 +02:00
|
|
|
tcdplay:
|
2012-02-22 17:06:05 +01:00
|
|
|
call sys_cd_atapi_command
|
|
|
|
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
|
|
|
|
cld
|
2009-09-17 13:55:38 +02:00
|
|
|
cdtrnwewait:
|
2012-02-22 17:06:05 +01:00
|
|
|
mov esi, 10
|
|
|
|
call delay_ms
|
|
|
|
in al, dx
|
|
|
|
and al, 128
|
|
|
|
cmp al, 0
|
|
|
|
jz cdtrl1
|
|
|
|
loop cdtrnwewait
|
2009-09-17 13:55:38 +02:00
|
|
|
cdtrl1:
|
|
|
|
; read the result
|
2012-02-22 17:06:05 +01:00
|
|
|
mov ecx, [esp+0]
|
|
|
|
mov dx, word [cdbase]
|
2009-09-17 13:55:38 +02:00
|
|
|
cdtrread:
|
2012-02-22 17:06:05 +01:00
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
|
|
|
and al, 8
|
|
|
|
cmp al, 8
|
|
|
|
jnz cdtrdone
|
|
|
|
sub dx, 7
|
|
|
|
in ax, dx
|
|
|
|
mov [ecx], ax
|
|
|
|
add ecx, 2
|
|
|
|
jmp cdtrread
|
2009-09-17 13:55:38 +02:00
|
|
|
cdtrdone:
|
2012-02-22 17:06:05 +01:00
|
|
|
pop ecx
|
|
|
|
xor eax, eax
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|
|
|
|
|
|
|
|
sys_cdpause:
|
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
call sys_cd_atapi_command
|
2009-09-17 13:55:38 +02:00
|
|
|
|
2012-02-22 17:06:05 +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
|
2009-09-17 13:55:38 +02:00
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
mov esi, 10
|
|
|
|
call delay_ms
|
|
|
|
add dx, 7
|
|
|
|
in al, dx
|
2009-09-17 13:55:38 +02:00
|
|
|
|
2012-02-22 17:06:05 +01:00
|
|
|
xor eax, eax
|
|
|
|
ret
|
2009-09-17 13:55:38 +02:00
|
|
|
|