from Nable: Sound Blaster driver

git-svn-id: svn://kolibrios.org@802 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Sergey Semyonov (Serge) 2008-06-09 12:12:09 +00:00
parent e080f21757
commit 77a4ede567
26 changed files with 875 additions and 852 deletions

View File

@ -22,12 +22,15 @@ proc set_kernel_conf
locals locals
par db 30 dup(?) par db 30 dup(?)
endl endl
pushad pushad
;[gui] ;[gui]
;mouse_speed ;mouse_speed
lea eax,[par] lea eax,[par]
push eax push eax
invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed, eax,30, ugui_mouse_speed_def invoke ini.get_str,conf_fname, ugui, ugui_mouse_speed,\
eax,30, ugui_mouse_speed_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
mov [mouse_speed_factor], ax mov [mouse_speed_factor], ax
@ -35,35 +38,12 @@ endl
;mouse_delay ;mouse_delay
lea eax,[par] lea eax,[par]
push eax push eax
invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay, eax,30, ugui_mouse_delay_def invoke ini.get_str,conf_fname, ugui, ugui_mouse_delay,\
eax,30, ugui_mouse_delay_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
mov [mouse_delay], eax mov [mouse_delay], eax
;[dev]
;sb16
lea eax,[par]
push eax
invoke ini.get_str,conf_fname, udev, udev_sb16, eax,30, udev_sb16_def
pop eax
stdcall strtoint,eax
cmp eax, 0x100
jb @f
cmp eax, 0x10000
jae @f
mov [sb16], eax
@@:
;sound_dma
lea eax,[par]
push eax
invoke ini.get_str,conf_fname, udev, udev_sound_dma, eax,30, udev_sound_dma_def
pop eax
stdcall strtoint,eax
cmp eax, 3
ja @f
mov [sound_dma], eax
@@:
;midibase ;midibase
lea eax,[par] lea eax,[par]
@ -71,6 +51,7 @@ endl
invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
pop eax pop eax
stdcall strtoint,eax stdcall strtoint,eax
cmp eax, 0x100 cmp eax, 0x100
jb @f jb @f
cmp eax, 0x10000 cmp eax, 0x10000
@ -80,7 +61,6 @@ endl
inc eax inc eax
mov [midisp], eax mov [midisp], eax
@@: @@:
popad popad
ret ret
endp endp
@ -92,10 +72,6 @@ ugui_mouse_delay db 'mouse_delay',0
ugui_mouse_delay_def db '0x00A',0 ugui_mouse_delay_def db '0x00A',0
udev db 'dev',0 udev db 'dev',0
udev_sb16 db 'sb16',0
udev_sb16_def db '0x220',0
udev_sound_dma db 'sound_dma',0
udev_sound_dma_def db '1',0
udev_midibase db 'midibase',0 udev_midibase db 'midibase',0
udev_midibase_def db '0x320',0 udev_midibase_def db '0x320',0

View File

@ -37,15 +37,11 @@ proc attach_int_handler stdcall, irq:dword, handler:dword, access_rights:dword
mov eax, [access_rights] mov eax, [access_rights]
mov [irq_rights + 4 * ebx], eax mov [irq_rights + 4 * ebx], eax
;push eax
;mov eax, [TASK_BASE]
;mov eax, [eax + TASKDATA.pid] ; faster or smaller? :)
;call get_pid
mov [irq_owner + 4 * ebx], PID_KERNEL ;eax mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel
;pop eax
stdcall enable_irq, [irq] stdcall enable_irq, [irq]
mov eax, 1
ret ret
.err: .err:
xor eax, eax xor eax, eax

View File

@ -15,7 +15,6 @@ $Revision$
align 32 align 32
irq0: irq0:
; pushfd
pushad pushad
mov ax, app_data ; mov ax, app_data ;
mov ds, ax mov ds, ax
@ -42,7 +41,6 @@ irq0:
mov [DONT_SWITCH], byte 0 mov [DONT_SWITCH], byte 0
popad popad
; popfd
iretd iretd
.change_task: .change_task:
@ -227,9 +225,6 @@ do_change_task:
@@: @@:
mov eax, [ebx+APPDATA.saved_esp0] mov eax, [ebx+APPDATA.saved_esp0]
mov [tss._esp0], eax mov [tss._esp0], eax
; mov eax, [ebx+APPDATA.pl0_stack]
; add eax, RING0_STACK_SIZE
; mov [tss._esp0], eax
mov ax, graph_data mov ax, graph_data
mov gs, ax mov gs, ax

View File

@ -128,10 +128,10 @@ iglobal
dd sys_settime ; 22-setting date,time,clock and alarm-clock dd sys_settime ; 22-setting date,time,clock and alarm-clock
dd 0 dd 0
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd sys_sb16 ; 25-SetSb16 dd 0 ;
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd 0 dd 0
dd sys_sb16II ; 28-SetSb16 dd 0 ;
dd 0 dd 0
dd sys_current_directory ; 30-Get/SetCurrentDirectory dd sys_current_directory ; 30-Get/SetCurrentDirectory
dd 0 dd 0
@ -208,10 +208,10 @@ iglobal
dd cross_order ; 22-setting date,time,clock and alarm-clock dd cross_order ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist dd cross_order ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd cross_order ; 25-SetSb16 dd undefined_syscall ; 25-reserved
dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,. dd cross_order ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd undefined_syscall ; 27-reserved dd undefined_syscall ; 27-reserved
dd cross_order ; 28-SetSb16 dd undefined_syscall ; 28-reserved
dd sys_date ; 29-GetDate dd sys_date ; 29-GetDate
dd cross_order ; 30-Get/SetCurrentDirectory dd cross_order ; 30-Get/SetCurrentDirectory
dd undefined_syscall ; 31-reserved dd undefined_syscall ; 31-reserved

View File

@ -90,6 +90,7 @@ szHwMouse db 'ATI2D',0
szPS2MDriver db 'PS2MOUSE',0 szPS2MDriver db 'PS2MOUSE',0
szCOM_MDriver db 'COM_MOUSE',0 szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0 szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0
szSTART db 'START',0 szSTART db 'START',0
szEXPORTS db 'EXPORTS',0 szEXPORTS db 'EXPORTS',0
@ -146,7 +147,6 @@ putpixel dd __sys_putpixel
align 4 align 4
keyboard dd 1 keyboard dd 1
sound_dma dd 1
syslang dd 1 syslang dd 1
boot_y dd 10 boot_y dd 10
@ -283,7 +283,9 @@ irq_tab rd 16
mem_block_map rb 512 mem_block_map rb 512
event_map rb 64 event_map rb 64
mem_block_list rd 64 mem_block_list rd 64
large_block_list rd 31
mem_block_mask rd 2 mem_block_mask rd 2
large_block_mask rd 1
mem_used.fd rd 1 mem_used.fd rd 1
mem_used.bk rd 1 mem_used.bk rd 1
@ -364,8 +366,6 @@ hdpos rd 1 ; for boot 0x1
fat32part rd 1 ; for boot 0x1 fat32part rd 1 ; for boot 0x1
cdpos rd 1 cdpos rd 1
sb16 rd 1
;CPUID information ;CPUID information
cpu_vendor rd 3 cpu_vendor rd 3
cpu_sign rd 1 cpu_sign rd 1

View File

@ -1133,18 +1133,7 @@ dd 638
====================================================================== ======================================================================
== ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 4 - γαβ ­®Ά¨βμ ΅ §®Άλ© ―®ΰβ Sound Blaster. = == ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 4 - γαβ ­®Ά¨βμ ΅ §®Άλ© ―®ΰβ Sound Blaster. =
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* eax = 21 - ­®¬¥à ä㭪樨
* ebx = 4 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­®¬¥à ¡ §®¢®£® ¯®àâ 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = -1 - ®è¨¡®ç­ë© ­®¬¥à ¯®àâ 
‡ ¬¥ç ­¨ï:
* <20>®¬¥à ¯®àâ  ¤®«¦¥­ 㤮¢«¥â¢®àïâì ãá«®¢¨ï¬ 0x100<=ecx<=0xFFFF.
* “áâ ­®¢ª  ¡ §ë ­ã¦­  ¤«ï à ¡®âë ä㭪権 25, 28, 55.
* <20>®«ãç¨âì ãáâ ­®¢«¥­­ë© ¡ §®¢ë© ¯®àâ ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 26.
====================================================================== ======================================================================
========= ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 5 - γαβ ­®Ά¨βμ ο§λ<C2A7> α¨α⥬λ. ======== ========= ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 5 - γαβ ­®Ά¨βμ ο§λ<C2A7> α¨α⥬λ. ========
@ -1212,18 +1201,7 @@ dd 638
====================================================================== ======================================================================
===== ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 10 - γαβ ­®Ά¨βμ <20> ­ « DMA ¤«ο §Άγ<CE86> . ==== ===== ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 10 - γαβ ­®Ά¨βμ <20> ­ « DMA ¤«ο §Άγ<CE86> . ====
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:
* eax = 21 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­®¬¥à ª ­ «  (®â 0 ¤® 3 ¢ª«îç¨â¥«ì­®)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = -1 - ­¥¢¥à­ë© ­®¬¥à ª ­ « 
‡ ¬¥ç ­¨ï:
* <20>®¬¥à ª ­ «  DMA ¨á¯®«ì§ã¥âáï ¢
¯®¤ä㭪樨 1 ä㭪樨 55.
* <20>®«ãç¨âì ª ­ « DMA ¤«ï §¢ãª  ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 10 ä㭪樨 26.
====================================================================== ======================================================================
====================== ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 11 ===================== ====================== ”γ­<CEB3>ζ¨ο 21, ―®¤δγ­<CEB3>ζ¨ο 11 =====================
@ -1521,22 +1499,7 @@ dd 638
====================================================================== ======================================================================
============== ”γ­<CEB3>ζ¨ο 25 - γαβ ­®Ά¨βμ £ΰ®¬<C2AE>®αβμ SBPro. ============== ============== ”γ­<CEB3>ζ¨ο 25 - γαβ ­®Ά¨βμ £ΰ®¬<C2AE>®αβμ SBPro. ==============
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* eax = 25 - ­®¬¥à ä㭪樨
* ebx = çâ® ãáâ ­ ¢«¨¢ âì:
* 1 - ãáâ ­®¢¨âì ®¡éãî £à®¬ª®áâì
* 2 - ãáâ ­®¢¨âì £à®¬ª®áâì CD-audio
* cl = ã஢¥­ì £à®¬ª®áâ¨: áâ à訥 4 ¡¨â  ¤«ï «¥¢®© ª®«®­ª¨,
¬« ¤è¨¥ 4 - ¤«ï ¯à ¢®©
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = 1 - ­¥ ®¯à¥¤¥«¥­  ¡ §  SB
* eax = 2 - ­¥¢¥à­ ï ¯®¤äã­ªæ¨ï
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ­ã¦­® ®¯à¥¤¥«¨âì ¡ §®¢ë© ¯®àâ SB ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 21.
* ‘¬®âਠ⠪¦¥ äã­ªæ¨î 28
ãáâ ­®¢ª¨ §¢ãª  ¤«ï ¡®«¥¥ ¯®§¤­¥£® áâ ­¤ àâ  SB16.
====================================================================== ======================================================================
===== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 1 - ―®«γη¨βμ ΅ §®Άλ© ―®ΰβ MPU MIDI. ===== ===== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 1 - ―®«γη¨βμ ΅ §®Άλ© ―®ΰβ MPU MIDI. =====
@ -1603,14 +1566,7 @@ dd 638
====================================================================== ======================================================================
=== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 4 - ―®«γη¨βμ ΅ §®Άλ© ―®ΰβ Sound Blaster. == === ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 4 - ―®«γη¨βμ ΅ §®Άλ© ―®ΰβ Sound Blaster. ==
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* eax = 26 - ­®¬¥à ä㭪樨
* ebx = 4 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ­®¬¥à ¡ §®¢®£® ¯®àâ 
‡ ¬¥ç ­¨ï:
* “áâ ­®¢ª  ¡ §ë ­ã¦­  ¤«ï à ¡®âë ä㭪権 25, 55.
* “áâ ­®¢¨âì ¡ §®¢ë© ¯®àâ ¬®¦­® ¢ë§®¢®¬ ¯®¤ä㭪樨 4 ä㭪樨 21.
====================================================================== ======================================================================
========== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 5 - ―®«γη¨βμ ο§λ<C2A7> α¨α⥬λ. ========= ========== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 5 - ―®«γη¨βμ ο§λ<C2A7> α¨α⥬λ. =========
@ -1679,15 +1635,7 @@ dd 638
====================================================================== ======================================================================
====== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 10 - ―®«γη¨βμ <20> ­ « DMA ¤«ο §Άγ<CE86> . ===== ====== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 10 - ―®«γη¨βμ <20> ­ « DMA ¤«ο §Άγ<CE86> . =====
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* eax = 26 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ­®¬¥à ª ­ «  (®â 0 ¤® 3 ¢ª«îç¨â¥«ì­®)
‡ ¬¥ç ­¨ï:
* <20>®¬¥à ª ­ «  DMA ¨á¯®«ì§ã¥âáï ¢ ¯®¤ä㭪樨 1 ä㭪樨 55.
* “áâ ­®¢¨âì ª ­ « DMA ¤«ï §¢ãª  ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 10 ä㭪樨 21.
====================================================================== ======================================================================
====================== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 11 ===================== ====================== ”γ­<CEB3>ζ¨ο 26, ―®¤δγ­<CEB3>ζ¨ο 11 =====================
@ -1721,21 +1669,7 @@ dd 638
====================================================================== ======================================================================
=============== ”γ­<CEB3>ζ¨ο 28 - γαβ ­®Ά¨βμ £ΰ®¬<C2AE>®αβμ SB16. ============== =============== ”γ­<CEB3>ζ¨ο 28 - γαβ ­®Ά¨βμ £ΰ®¬<C2AE>®αβμ SB16. ==============
====================================================================== ======================================================================
<EFBFBD> à ¬¥âàë: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* eax = 28 - ­®¬¥à ä㭪樨
* ebx = çâ® ãáâ ­ ¢«¨¢ âì:
* 1 - ãáâ ­®¢¨âì ®¡éãî £à®¬ª®áâì
* 2 - ãáâ ­®¢¨âì £à®¬ª®áâì CD-audio
* cl = ã஢¥­ì £à®¬ª®á⨠(0=off, 0xFF=max)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = 1 - ­¥ ®¯à¥¤¥«¥­  ¡ §  SB
* eax = 2 - ­¥¢¥à­ ï ¯®¤äã­ªæ¨ï
‡ ¬¥ç ­¨ï:
* <20>।¢ à¨â¥«ì­® ­ã¦­® ®¯à¥¤¥«¨âì ¡ §®¢ë© ¯®àâ SB ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 21.
* <20>â  äã­ªæ¨ï ¯à¥¤®áâ ¢«ï¥â ¡®«ìè¥ ¢ à¨ ­â®¢ ¤«ï £à®¬ª®áâ¨,
祬 äã­ªæ¨ï 25.
====================================================================== ======================================================================
================ ”γ­<CEB3>ζ¨ο 29 - ―®«γη¨βμ α¨α⥬­γξ ¤ βγ. =============== ================ ”γ­<CEB3>ζ¨ο 29 - ―®«γη¨βμ α¨α⥬­γξ ¤ βγ. ===============

View File

@ -1128,18 +1128,7 @@ Remarks:
====================================================================== ======================================================================
====== Function 21, subfunction 4 - set Sound Blaster base port. ===== ====== Function 21, subfunction 4 - set Sound Blaster base port. =====
====================================================================== ======================================================================
Parameters: Removed
* eax = 21 - function number
* ebx = 4 - subfunction number
* ecx = number of the base port
Returned value:
* eax = 0 - success
* eax = -1 - erratic port number
Remarks:
* Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
* The installation of the base is necessary for
functions 25, 28, 55.
* To get base port use subfunction 4 of function 26.
====================================================================== ======================================================================
========== Function 21, subfunction 5 - set system language. ========= ========== Function 21, subfunction 5 - set system language. =========
@ -1204,16 +1193,7 @@ Remarks:
====================================================================== ======================================================================
======== Function 21, subfunction 10 - set sound DMA channel. ======== ======== Function 21, subfunction 10 - set sound DMA channel. ========
====================================================================== ======================================================================
Parameters: Removed
* eax = 21 - function number
* ebx = 10 - subfunction number
* ecx = number of channel (from 0 up to 3 inclusively)
Returned value:
* eax = 0 - success
* eax = -1 - incorrect channel number
Remarks:
* Number of DMA channel is used in subfunction 1 of function 55.
* To get sound DMA channel use subfunction 10 of function 26.
====================================================================== ======================================================================
Function 21, subfunction 11 - enable/disable low-level access to HD. Function 21, subfunction 11 - enable/disable low-level access to HD.
@ -1505,22 +1485,7 @@ Remarks:
====================================================================== ======================================================================
=================== Function 25 - set SBPro volume. ================== =================== Function 25 - set SBPro volume. ==================
====================================================================== ======================================================================
Parameters: Removed
* eax = 25 - function number
* ebx = what to set:
* 1 - set common volume
* 2 - set CD-audio volume
* cl = volume level: high 4 bits for the left column,
low 4 bits for the right one
Returned value:
* eax = 0 - success
* eax = 1 - SB base is not defined
* eax = 2 - incorrect subfunction
Remarks:
* Previously SB base port must be defined by
subfunction 4 of function 21.
* See also function 28 which sets
volume for the later standard SB16.
====================================================================== ======================================================================
======== Function 26, subfunction 1 - get MPU MIDI base port. ======== ======== Function 26, subfunction 1 - get MPU MIDI base port. ========
@ -1584,14 +1549,7 @@ Remarks:
====================================================================== ======================================================================
====== Function 26, subfunction 4 - get Sound Blaster base port. ===== ====== Function 26, subfunction 4 - get Sound Blaster base port. =====
====================================================================== ======================================================================
Parameters: Removed
* eax = 26 - function number
* ebx = 4 - subfunction number
Returned value:
* eax = base port number
Remarks:
* Bae port is used by functions 25, 55.
* To set base port use subfunction 4 of function 21.
====================================================================== ======================================================================
========== Function 26, subfunction 5 - get system language. ========= ========== Function 26, subfunction 5 - get system language. =========
@ -1658,14 +1616,7 @@ Remarks:
====================================================================== ======================================================================
======== Function 26, subfunction 10 - get sound DMA channel. ======== ======== Function 26, subfunction 10 - get sound DMA channel. ========
====================================================================== ======================================================================
Parameters: Removed
* eax = 26 - function number
* ebx = 10 - subfunction number
Returned value:
* eax = number of the channel (from 0 to 3 inclusive)
Remarks:
* Number of the DMA channel is used by subfunction 1 of function 55.
* To set the sound DMA channel use subfunction 10 of function 21.
====================================================================== ======================================================================
===================== Function 26, subfunction 11 ==================== ===================== Function 26, subfunction 11 ====================
@ -1697,20 +1648,7 @@ Remarks:
====================================================================== ======================================================================
=================== Function 28 - set SB16 volume. =================== =================== Function 28 - set SB16 volume. ===================
====================================================================== ======================================================================
Parameters: Removed
* eax = 28 - function number
* ebx = what to install:
* 1 - install common volume
* 2 - install CD-audio volume
* cl = volume level (0=off, 0xFF=max)
Returned value:
* eax = 0 - success
* eax = 1 - SB base is not defined
* eax = 2 - incorrect subfunction
Remarks:
* Previously SB base port must be defined by
subfunction 4 of function 21.
* This function gives more variants for volume, that function 25.
====================================================================== ======================================================================
=================== Function 29 - get system date. =================== =================== Function 29 - get system date. ===================

View File

@ -7,6 +7,8 @@
format MS COFF format MS COFF
DEBUG equ 1
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'
@ -14,8 +16,6 @@ R500_HW2D equ 0
API_VERSION equ 0x01000100 API_VERSION equ 0x01000100
DEBUG equ 1
STRIDE equ 8 STRIDE equ 8
VID_ATI equ 0x1002 VID_ATI equ 0x1002

View File

@ -11,14 +11,12 @@
format MS COFF format MS COFF
API_VERSION equ 5 ;debug DEBUG equ 0
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'
OS_BASE equ 0x80000000; API_VERSION equ 5 ;debug
new_app_base equ 0x0
PROC_BASE equ OS_BASE+0x0080000
struc IOCTL struc IOCTL
{ .handle dd ? { .handle dd ?
@ -36,7 +34,6 @@ end virtual
public START public START
public version public version
DEBUG equ 0
DRV_ENTRY equ 1 DRV_ENTRY equ 1
DRV_EXIT equ -1 DRV_EXIT equ -1

View File

@ -9,12 +9,12 @@
format MS COFF format MS COFF
DEBUG equ 1
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'
DEBUG equ 1
REMAP_IRQ equ 0 REMAP_IRQ equ 0
;irq 0,1,2,8,12,13 íåäîñòóïíû ;irq 0,1,2,8,12,13 íåäîñòóïíû

View File

@ -6,8 +6,10 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro kernel_export [name]{ macro kernel_export [name]{
forward forward
;display `name,#13,#10
if used name if used name
if DEBUG
display 'uses: ',`name,#13,#10
end if
extrn name extrn name
end if end if
} }
@ -19,6 +21,7 @@ kernel_export \
GetService,\ GetService,\
ServiceHandler,\ ServiceHandler,\
AttachIntHandler,\ AttachIntHandler,\
GetIntHandler,\
FpuSave,\ FpuSave,\
FpuRestore,\ FpuRestore,\
ReservePortArea,\ ReservePortArea,\

View File

@ -10,6 +10,13 @@
format MS COFF format MS COFF
DEBUG equ 1
include 'proc32.inc'
include 'main.inc'
include 'imports.inc'
CURRENT_API equ 0x0101 ;1.01 CURRENT_API equ 0x0101 ;1.01
COMPATIBLE_API equ 0x0100 ;1.00 COMPATIBLE_API equ 0x0100 ;1.00
@ -18,13 +25,6 @@ API_VERSION equ (COMPATIBLE_API shl 16) or CURRENT_API
SOUND_VERSION equ CURRENT_API SOUND_VERSION equ CURRENT_API
include 'proc32.inc'
;include 'system.inc'
include 'main.inc'
include 'imports.inc'
FORCE_MMX equ 0 ;set to 1 to force use mmx or FORCE_MMX equ 0 ;set to 1 to force use mmx or
FORCE_MMX_128 equ 0 ;integer sse2 extensions FORCE_MMX_128 equ 0 ;integer sse2 extensions
;and reduce driver size ;and reduce driver size
@ -33,9 +33,6 @@ FORCE_MMX_128 equ 0 ;integer sse2 extensions
USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default
DEBUG equ 1
OS_BASE equ 0x80000000 OS_BASE equ 0x80000000
CAPS_SSE2 equ 26 CAPS_SSE2 equ 26
@ -1209,7 +1206,7 @@ resampler_params:
;r_size r_dt resampler_func ;r_size r_dt resampler_func
dd 0,0,0 ; 0 PCM_ALL dd 0,0,0 ; 0 PCM_ALL
dd 16384, 0, copy_stream ; 1 PCM_2_16_48 dd 16384, 0, copy_stream ; 1 PCM_2_16_48
dd 16384, 0, m16_stereo ; 2 PCM_1_16_48 dd 8192, 0, m16_stereo ; 2 PCM_1_16_48
dd 16384, 30109, resample_2 ; 3 PCM_2_16_44 dd 16384, 30109, resample_2 ; 3 PCM_2_16_44
dd 8192, 30109, resample_1 ; 4 PCM_1_16_44 dd 8192, 30109, resample_1 ; 4 PCM_1_16_44

View File

@ -71,7 +71,7 @@ macro epiloguedef procname,flag,parmbytes,localbytes,reglist
if parmbytes | localbytes if parmbytes | localbytes
leave leave
end if end if
if (flag and 10000b) | (parmbytes=0) if flag and 10000b
retn retn
else else
retn parmbytes retn parmbytes

View File

@ -1,5 +1,7 @@
format MS COFF format MS COFF
DEBUG equ 0
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'

View File

@ -0,0 +1,41 @@
;flags------------------------------------------------------------
DEBUG equ 1 ;show messages at debug board
use_cli_sti equ 1 ;driver come more stable (theoretically)
;constants--------------------------------------------------------
API_VERSION equ 0 ;debug
OS_BASE equ 0x80000000
new_app_base equ 0x0
PROC_BASE equ (OS_BASE+0x080000)
SB16Buffer equ (OS_BASE+0x2A0000)
SB16_Status equ (OS_BASE+0x2B0000)
DMAPage equ ((SB16Buffer-OS_BASE) shr 16)
SB16Buffer0 equ SB16Buffer
SB16Buffer1 equ (SB16Buffer+16384)
SB16Buffer2 equ (SB16Buffer+(2*16384))
SB16Buffer3 equ (SB16Buffer+(3*16384))
sb_irq_num equ 5
sb_dma_num equ 5
sb_buffer_size equ 32768 ;really it needs code modifications to change
;buffer size
sb_out_rate equ 44100
;time constant for cards older than SB16
sb_tc equ (256-(1000000/(sb_out_rate*2)))
SRV_GETVERSION equ 0
DEV_PLAY equ 1
DEV_STOP equ 2
DEV_CALLBACK equ 3
DEV_SET_BUFF equ 4
DEV_NOTIFY equ 5
DEV_SET_MASTERVOL equ 6
DEV_GET_MASTERVOL equ 7
DEV_GET_INFO equ 8
DRV_ENTRY equ 1
DRV_EXIT equ -1

View File

@ -0,0 +1,239 @@
;--------------------------------
; program dma
;--------------------------------
sb_set_dma:
mov ebx,[sound_dma]
lea eax,[ebx+4] ;mask required channel
cmp bl,4
ja .use_second_dma_controller
jb @f
.dma_setup_error:
if DEBUG
mov esi,msgErrDMAsetup
call SysMsgBoardStr
end if
mov dword[esp],START.stop
ret
@@:
if use_cli_sti
cli ;here to minimize time with disabled ints
end if
out 0xA,al ;mask required channel
xor eax,eax
out 0xC,al ;clear byte pointer flip-flop register
lea eax,[ebx+0x58] ;auto-init mode for channel (ebx)
out 0xB,al ;DMA channel 0-3 mode register
movzx edx,byte[ebx+dma_table] ;page register
mov al,DMAPage
out dx,al
lea edx,[ebx*2] ;DMA channel 0-3 base address
mov al,0 ;LSB is 0
out dx,al
; mov al,0 ;MSB is 0 too
out dx,al
inc edx ;DMA channel 0-3 byte count
mov al,((sb_buffer_size-1) and 0xff)
out dx,al
mov al,((sb_buffer_size-1) shr 8) ;it is the same
out dx,al
mov eax,ebx ;unmask DMA channel
out 0xA,al
if use_cli_sti
sti
end if
ret
.use_second_dma_controller:
cmp bl,7
ja .dma_setup_error
sub bl,4
sub al,4
if use_cli_sti
cli ;here to minimize time with disabled ints
end if
out 0xD4,al ;mask required channel
xor eax,eax
out 0xD8,al ;clear byte pointer flip-flop register
lea eax,[ebx+0x58] ;auto-init mode for channel (ebx+4)
out 0xD6,al ;DMA channel 4-7 mode register
movzx edx,byte[ebx+dma_table+4] ;page register
mov al,DMAPage
out dx,al
lea edx,[ebx*4+0xC0] ;DMA channel 4-7 base address
mov al,0 ;LSB is 0 ;for 16bit DMA this contains
out dx,al ;A1-A8 lines of address bus, A0 is zero
; mov al,0 ;MSB is 0 too ;for 16bit DMA this contains
out dx,al ;A9-A16 lines of address bus
inc edx
inc edx ;DMA channel 4-7 16bit word count
mov al,(((sb_buffer_size/2)-1) and 0xff)
out dx,al
mov al,(((sb_buffer_size/2)-1) shr 8)
out dx,al
mov eax,ebx ;unmask DMA channel
out 0xD4,al
if use_cli_sti
sti
end if
ret
;-------------------------------------------------------------------------------
; out byte to SB DSP's write port
;-------------------------------------------------------------------------------
macro sb_out data_to_out {
@@:
in al,dx
test al,al ;is DSP busy?
js @b ;it's busy
mov al,data_to_out ;it's free
out dx,al
}
;-------------------------------------------------------------------------------
; stop playing
;-------------------------------------------------------------------------------
proc sb_stop
mov edx,[sb_base_port]
add dl,0xC
sb_out 0xD3 ;turn the speaker off
sb_out 0xDA ;exit 8bit DMA
sb_out 0xD9 ;exit 16bit DMA
ret
endp
;-------------------------------------------------------------------------------
; start playing
;-------------------------------------------------------------------------------
proc sb_play
and [int_flip_flop],0
mov edx,[sb_base_port]
add dl,0xC
sb_out 0xD1 ;turn speaker on
; sb_out 0x48 ;set DSP transfer size ;for older cards
; mov ax,32767 ;(64k)/2-1
;@@: ;out the low byte...
; in al,dx
; test al,al ;is DSP busy?
; js @b ;it's busy
; out dx,al
; mov al,ah ;...then the high byte
;@@:
; in al,dx
; test al,al ;is DSP busy?
; js @b ;it's busy
; out dx,al
; sb_out 0x1C ;auto-init 8bit playback
; 0xBXh - 16 bit DMA mode
; ||||
sb_out 10110110b ;bCommand
; ||||
; |||+-reserved
; ||+--turn FIFO on (0 for off)
; |+---auto-init mode on (0 for off)
; +----A/D: 0-output, 1-input
; +------stereo on
; |+-----unsigned (1 for signed)
; ||
sb_out 00110000b ;bMode
; || ||||
; ---------reserved
;wSize is a number of 16bit samples less 1. For auto-init mode each half
;buffer is (64k)/2 bytes long and, obviously, contains ((64k)/2)/2 bytes
sb_out (((sb_buffer_size/2/2)-1) and 0xFF) ;wSize.LowByte
sb_out (((sb_buffer_size/2/2)-1) shr 8) ;wSize.HighByte
ret
endp
;-------------------------------------------------------------------------------
; reset DSP
;-------------------------------------------------------------------------------
proc sb_reset
and [int_flip_flop],0
mov edx,[sb_base_port]
add dl,6
mov al,1 ;start DSP reset
if use_cli_sti
cli ;here to minimize time with disabled ints
end if
out dx,al
mov ecx,40 ;wait at least 3 microsec.
@@:
in al,dx
loop @b
xor eax,eax ;stop DSP reset
if use_cli_sti
sti
end if
out dx,al
ret
endp
;-------------------------------------------------------------------------------
; set the rate for playing, enable stereo
;-------------------------------------------------------------------------------
proc sb_setup
mov edx,[sb_base_port]
add dl,0xC
sb_out 40h ;set time constant, this is for old cards
sb_out sb_tc
sb_out 41h ;set sound rate, this can only SB16
sb_out (sb_out_rate shr 8) ;first high byte (MSB)
sb_out (sb_out_rate and 0xff) ;then low byte (LSB)
; mov al,0xE
; sub dl,(0xC-4) ;talk to SB's mixer
; out dx,al ;select this register of the mixer
; mov ecx,6 ;wait for the chip
;@@:
; in al,dx
; loop @b
; inc edx ;now read the data port
; in al,dx
; or al,22h ;turn on stereo
; mov ah,al
; mov al,0xE
; dec edx ;talk to SB's mixer
; out dx,al ;select this register of the mixer
; mov ecx,6 ;wait for the chip
;@@:
; in al,dx
; loop @b
; inc edx ;now send data to the data port
; mov al,ah
; out dx,al
; dec edx
; mov ecx,35 ;wait for the chip
;@@:
; in al,dx
; loop @b
ret
endp

View File

@ -0,0 +1,375 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
format MS COFF
include 'config.inc'
;structs----------------------------------------------------------
struc IOCTL
{ .handle dd ?
.io_code dd ?
.input dd ?
.inp_size dd ?
.output dd ?
.out_size dd ?
}
virtual at 0
IOCTL IOCTL
end virtual
;something--------------------------------------------------------
public START
public service_proc
public version
include '..\proc32.inc'
include '..\imports.inc'
section '.flat' code readable align 16
include 'sb16.inc'
;-------------------------------------------------------------------------------
proc START stdcall, state:dword
cmp [state], 1
jne .stop
.entry:
if DEBUG
mov esi, msgInit
call SysMsgBoardStr
end if
call detect ;returns DSP version or zero if
test eax,eax ;SB card not found
jz .exit
if DEBUG
movzx eax,al ;major version
dec eax
jz .sb_say_about_found_dsp
mov dword[sb_DSP_description],'2.x '
dec eax
jz .sb_say_about_found_dsp
mov dword[sb_DSP_description],'Pro '
dec eax
jz .sb_say_about_found_dsp
mov dword[sb_DSP_description],'16 '
.sb_say_about_found_dsp:
mov esi,msgDSPFound
call SysMsgBoardStr
end if
xor eax,eax
mov ebx,[sb_base_port]
lea ecx,[ebx+0xF]
call ReservePortArea ;these ports must be mine!
if DEBUG
dec eax
jnz @f
mov esi,msgErrRsrvPorts
call SysMsgBoardStr
@@:
end if
call sb_setup ;clock it, etc
stdcall AttachIntHandler, sb_irq_num, sb_irq, 0
if DEBUG
test eax,eax
jnz @f
mov esi,msgErrAtchIRQ
call SysMsgBoardStr
stdcall GetIntHandler, sb_irq_num
call SysMsgBoardNum
jmp .stop
@@:
mov esi,msgSucAtchIRQ
call SysMsgBoardStr
end if
stdcall RegService, my_service, service_proc
ret
.stop:
call sb_reset
.exit:
if DEBUG
mov esi,msgExit
call SysMsgBoardStr
end if
xor eax, eax
ret
endp
;-------------------------------------------------------------------------------
handle equ IOCTL.handle
io_code equ IOCTL.io_code
input equ IOCTL.input
inp_size equ IOCTL.inp_size
output equ IOCTL.output
out_size equ IOCTL.out_size
align 4
proc service_proc stdcall, ioctl:dword
mov edi,[ioctl]
mov eax,[edi+io_code]
cmp eax,SRV_GETVERSION
jne @F
mov eax,[edi+output]
cmp [edi+out_size],4
jne .fail
mov [eax],dword API_VERSION
xor eax,eax
ret
@@:
cmp eax,DEV_PLAY
jne @f
if DEBUG
mov esi,msgPlay
call SysMsgBoardStr
end if
call sb_stop ;to play smth new we must stop smth old
call pre_fill_data ;fill first and second half of the buffer
call pre_fill_data ;
call sb_set_dma ;is it really needed here? Paranoia.
call sb_play
xor eax,eax
ret
;@@: ;all this commented stuff in service proc
; cmp eax,DEV_STOP ;is never used. Mixer do this virtually,
; jne @f ;e.g. instead of stopping driver it
;if DEBUG ;outputs silence
; mov esi,msgStop
; call SysMsgBoardStr
;end if
; call sb_stop
; xor eax,eax
; ret
@@:
cmp eax,DEV_CALLBACK
jne @f
if DEBUG
mov esi,msgCallback
call SysMsgBoardStr
end if
mov edi,[edi+input]
mov eax,[edi]
mov [callback],eax
if DEBUG
call SysMsgBoardNum
end if
ret
@@:
; cmp eax,DEV_SET_MASTERVOL
; jne @F
;if DEBUG
; mov esi,msgSetVol
; call SysMsgBoardStr
;end if
; mov eax,[edi+input]
; mov eax,[eax]
; mov [sb_master_vol],eax
; ret
;@@:
; cmp eax,DEV_GET_MASTERVOL
; jne @F
;if DEBUG
; mov esi,msgGetVol
; call SysMsgBoardStr
;end if
; mov eax,[edi+output]
; mov edx,[sb_master_vol]
; mov [eax],edx
; ret
.fail:
or eax, -1
ret
endp
restore handle
restore io_code
restore input
restore inp_size
restore output
restore out_size
;-------------------------------------------------------------------------------
align 4
proc sb_irq
mov edx,[sb_base_port] ;tell the DSP that we have processed IRQ
add dl,0xF ;0xF for 16 bit sound, 0xE for 8 bit sound
in al,dx ;for non-stop sound
pre_fill_data:
mov eax,int_flip_flop
not dword[eax]
mov eax,[eax]
test eax,eax
jns .fill_second_half
stdcall [callback],SB16Buffer0 ;for 32k buffer
; stdcall [callback],SB16Buffer0 ;for 64k buffer
; stdcall [callback],SB16Buffer1 ;for 64k buffer
xor eax,eax
ret
.fill_second_half:
stdcall [callback],SB16Buffer1 ;for 32k buffer
; stdcall [callback],SB16Buffer2 ;for 64k buffer
; stdcall [callback],SB16Buffer3 ;for 64k buffer
xor eax,eax
ret
endp
;-------------------------------------------------------------------------------
align 4
proc detect
.sb_detect_next_port:
if DEBUG
inc dword[port_second_digit_num]
end if
mov edx,sb_base_port
add byte[edx],10h
cmp byte[edx],80h
jbe .sb_try_to_detect_at_specified_port
;error - no SB card detected
.sb_not_found_err:
xor eax, eax
ret
.sb_try_to_detect_at_specified_port:
call sb_reset
add dl,8
mov ecx,100
.sb_check_port:
in al,dx
test al,al ;is DSP port ready to be read?
jns .sb_port_not_ready
sub dl,4
in al,dx ;check for AAh response
add dl,4
cmp al,0xAA
jne .sb_port_not_ready
.sb_card_found:
and dl,0xF0
add dl,0xC
sb_out 0xE1 ;get DSP version
add dl,2
@@:
in al,dx
test al,al ;is DSP port ready to be read?
jns @b
sub dl,4
in al,dx ;get major version
ror eax,16
add dl,4
@@:
in al,dx
test al,al ;is DSP port ready to be read?
jns @b
sub dl,4
in al,dx ;get minor version
xor edx,edx
mov dl,10
div dl
ror eax,16
xor ah,ah
if DEBUG
add [sb_DSP_version],eax
end if
ret
.sb_port_not_ready:
loop .sb_check_port ;100 retries (~100 microsec.)
jmp .sb_detect_next_port
endp
;-------------------------------------------------------------------------------
if DEBUG
proc SysMsgBoardNum
mov ebx,eax
mov ecx,8
mov esi,(number_to_out+1)
.1:
mov eax,ebx
and eax,0xF
add al,'0'
cmp al,(10+'0')
jb @f
add al,('A'-'0'-10)
@@:
mov [esi+ecx],al
shr ebx,4
loop .1
dec esi
call SysMsgBoardStr
ret
endp
end if
;all initialized data place here
align 4
version dd (5 shl 16) or (API_VERSION and 0xFFFF)
sb_base_port: dd 200h
;pTempBuf dd 0
callback dd 0
int_flip_flop dd 0
sound_dma dd sb_dma_num
;note that 4th DMA channel doesn't exist, it is used for cascade
;plugging the first DMA controler to the second
dma_table db 0x87,0x83,0x81,0x82,0xFF,0x8B,0x89,0x8A
;sb_master_vol dd 0
my_service db 'SOUND',0 ;max 16 chars include zero
if DEBUG
number_to_out db '0x00000000',13,10,0
msgInit db 'detecting hardware...',13,10,0
msgExit db 'exiting... May be some problems found?',13,10,0
msgPlay db 'start play',13,10,0
;msgStop db 'stop play',13,10,0
msgCallback db 'set_callback received from the mixer!',13,10
db 'callback handler is: ',0
msgErrAtchIRQ db 'failed to attach IRQ',(sb_irq_num+'0'),13,10
db 'owner',39,'s handler: ',0
msgSucAtchIRQ db 'succesfully attached IRQ',(sb_irq_num+'0')
db ' as hardcoded',13,10,0
msgErrRsrvPorts db 'failed to reserve needed ports.',13,10
db 'Driver may work unstable',13,10,0
;msgSetVol db 'DEV_SET_MASTERVOL call came',13,10,0
;msgGetVol db 'DEV_GET_MASTERVOL call came',13,10,0
msgErrDMAsetup db 'failed to setup DMA - bad channel',13,10,0
;-------------------------------------------------------------------------------
msgDSPFound db 'DSP found at port 2'
label port_second_digit_num dword at $
db '00h',13,10,'DSP version '
sb_DSP_version: db '0.00 - SB'
sb_DSP_description: db 32,32,32,32,13,10,0
;-------------------------------------------------------------------------------
end if
;section '.data' data readable writable align 16
;all uninitialized data place here

View File

@ -9,6 +9,8 @@
format MS COFF format MS COFF
DEBUG equ 1
API_VERSION equ 0 ;debug API_VERSION equ 0 ;debug
include 'proc32.inc' include 'proc32.inc'
@ -35,8 +37,6 @@ public START
public service_proc public service_proc
public version public version
DEBUG equ 1
DRV_ENTRY equ 1 DRV_ENTRY equ 1
DRV_EXIT equ -1 DRV_EXIT equ -1
STRIDE equ 4 ;size of row in devices table STRIDE equ 4 ;size of row in devices table

View File

@ -7,12 +7,13 @@
format MS COFF format MS COFF
DEBUG equ 1
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'
API_VERSION equ 0x01000100 API_VERSION equ 0x01000100
DEBUG equ 1
DEBUG_IRQ equ 0 DEBUG_IRQ equ 0
USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices

View File

@ -7,13 +7,13 @@
format MS COFF format MS COFF
DEBUG equ 1
include 'proc32.inc' include 'proc32.inc'
include 'imports.inc' include 'imports.inc'
API_VERSION equ 0x01000100 API_VERSION equ 0x01000100
DEBUG equ 1
DEBUG_IRQ equ 0 DEBUG_IRQ equ 0
USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices

View File

@ -114,29 +114,25 @@ save_draw_mouse:
movzx edx, byte [display_data+ebx+eax] movzx edx, byte [display_data+ebx+eax]
shl edx, 8 shl edx, 8
mov ecx, [edx+SLOT_BASE+APPDATA.cursor] mov esi, [edx+SLOT_BASE+APPDATA.cursor]
cmp ecx, [current_cursor] cmp esi, [current_cursor]
je .draw je .draw
cmp [ecx+CURSOR.magic], 'CURS' ; cmp [esi+CURSOR.magic], 'CURS'
jne .fail
push ecx
call [select_hw_cursor]
mov [current_cursor], ecx
; cmp [ecx+CURSOR.size], CURSOR_SIZE
; jne .fail ; jne .fail
push esi
call [select_hw_cursor]
mov [current_cursor], esi
.draw: .draw:
stdcall [set_hw_cursor], ecx stdcall [set_hw_cursor], esi
popad popad
ret ret
.fail: .fail:
mov ecx, [def_cursor] mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax
popad popad
ret ret

View File

@ -345,8 +345,6 @@ high_code:
mov al,[BOOT_VAR+0x9000] ; bpp mov al,[BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al mov [ScreenBPP],al
xchg bx, bx
movzx eax,word [BOOT_VAR+0x900A] ; X max movzx eax,word [BOOT_VAR+0x900A] ; X max
dec eax dec eax
mov [Screen_Max_X],eax mov [Screen_Max_X],eax
@ -1032,7 +1030,6 @@ reserve_irqs_ports:
mov [irq_owner+4*0], 1 ; timer mov [irq_owner+4*0], 1 ; timer
;mov [irq_owner+4*1], 1 ; keyboard ;mov [irq_owner+4*1], 1 ; keyboard
mov [irq_owner+4*5], 1 ; sound blaster
mov [irq_owner+4*6], 1 ; floppy diskette mov [irq_owner+4*6], 1 ; floppy diskette
mov [irq_owner+4*13], 1 ; math co-pros mov [irq_owner+4*13], 1 ; math co-pros
mov [irq_owner+4*14], 1 ; ide I mov [irq_owner+4*14], 1 ; ide I
@ -1104,7 +1101,6 @@ set_variables:
mov [MOUSE_X],eax mov [MOUSE_X],eax
pop eax pop eax
mov byte [SB16_Status],0 ; Minazzi Paolo
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
;!! IP 04.02.2005: ;!! IP 04.02.2005:
@ -1183,106 +1179,6 @@ sys_outport:
mov [esp+24],eax mov [esp+24],eax
ret ret
align 4
sys_sb16:
cmp word [sb16],word 0
jnz sb16l1
mov [esp+36],dword 1
ret
sb16l1:
mov [esp+36],dword 0
cmp eax,1 ; set volume - main
jnz sb16l2
mov dx,word [sb16]
add dx,4
mov al,0x22
out dx,al
mov esi,1
call delay_ms
mov eax,ebx
inc edx
out dx,al
ret
sb16l2:
cmp eax,2 ; set volume - cd
jnz sb16l3
mov dx,word [sb16]
add dx,4
mov al,0x28
out dx,al
mov esi,1
call delay_ms
mov eax,ebx
add edx,1
out dx,al
ret
sb16l3:
mov [esp+36],dword 2
ret
align 4
sys_sb16II:
cmp word [sb16],word 0
jnz IIsb16l1
mov [esp+36],dword 1
ret
IIsb16l1:
cmp eax,1 ; set volume - main
jnz IIsb16l2
; L
mov dx,word [sb16]
add dx,4
mov al,0x30
out dx,al
mov eax,ebx
inc edx
out dx,al
; R
mov dx,word [sb16]
add dx,4
mov al,0x31
out dx,al
mov eax,ebx
inc edx
out dx,al
mov [esp+36],dword 0
ret
IIsb16l2:
cmp eax,2 ; set volume - cd
jnz IIsb16l3
; L
mov dx,word [sb16]
add dx,4
mov al,0x36
out dx,al
mov eax,ebx
inc edx
out dx,al
; R
mov dx,word [sb16]
add dx,4
mov al,0x37
out dx,al
mov eax,ebx
inc edx
out dx,al
mov [esp+36],dword 0
ret
IIsb16l3:
mov [esp+36],dword 2
ret
display_number: display_number:
; eax = print type, al=0 -> ebx is number ; eax = print type, al=0 -> ebx is number
@ -1472,7 +1368,6 @@ sys_setup:
; 1=roland mpu midi base , base io address ; 1=roland mpu midi base , base io address
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 4=sb16 base , base io address
; 5=system language, 1eng 2fi 3ger 4rus ; 5=system language, 1eng 2fi 3ger 4rus
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 8=fat32 partition in hd ; 8=fat32 partition in hd
@ -1543,7 +1438,7 @@ endg
ret ret
nsyse2: nsyse2:
cmp eax,3 ; CD cmp eax,3 ; CD
jnz nsyse3 jnz nsyse4
test ebx,ebx test ebx,ebx
jz nosesl jz nosesl
cmp ebx, 4 cmp ebx, 4
@ -1573,17 +1468,6 @@ endg
cd_base db 0 cd_base db 0
nsyse3:
cmp eax,4 ; SB
jnz nsyse4
cmp ebx,0x100
jb nsyse4
mov edx,65535
cmp edx,ebx
jb nsyse4
mov word [sb16],bx
ret
nsyse4: nsyse4:
cmp eax,5 ; SYSTEM LANGUAGE cmp eax,5 ; SYSTEM LANGUAGE
@ -1652,23 +1536,15 @@ endg
popa popa
mov [hd1_status],0 ; free mov [hd1_status],0 ; free
ret ret
nsyse8: nsyse8:
cmp eax,10 ; SOUND DMA CHANNEL
jne no_set_sound_dma
cmp ebx,3
ja sys_setup_err
mov [sound_dma],ebx
ret
no_set_sound_dma:
cmp eax,11 ; ENABLE LBA READ cmp eax,11 ; ENABLE LBA READ
jne no_set_lba_read jne no_set_lba_read
and ebx,1 and ebx,1
mov [lba_read_enabled],ebx mov [lba_read_enabled],ebx
ret ret
no_set_lba_read:
no_set_lba_read:
cmp eax,12 ; ENABLE PCI ACCESS cmp eax,12 ; ENABLE PCI ACCESS
jne no_set_pci_access jne no_set_pci_access
and ebx,1 and ebx,1
@ -1691,7 +1567,6 @@ sys_getsetup:
; 1=roland mpu midi base , base io address ; 1=roland mpu midi base , base io address
; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus ; 2=keyboard 1, base kaybap 2, shift keymap, 9 country 1eng 2fi 3ger 4rus
; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave ; 3=cd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 4=sb16 base , base io address
; 5=system language, 1eng 2fi 3ger 4rus ; 5=system language, 1eng 2fi 3ger 4rus
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave ; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 8=fat32 partition in hd ; 8=fat32 partition in hd
@ -1749,14 +1624,6 @@ sys_getsetup:
mov [esp+36],eax mov [esp+36],eax
ret ret
ngsyse3: ngsyse3:
cmp eax,4
jne ngsyse4
mov eax,[sb16]
mov [esp+36],eax
ret
ngsyse4:
cmp eax,5 cmp eax,5
jnz ngsyse5 jnz ngsyse5
mov eax,[syslang] mov eax,[syslang]
@ -1781,12 +1648,6 @@ sys_getsetup:
mov [esp+36],eax mov [esp+36],eax
ret ret
ngsyse9: ngsyse9:
cmp eax,10
jnz ngsyse10
mov eax,[sound_dma]
mov [esp+36],eax
ret
ngsyse10:
cmp eax,11 cmp eax,11
jnz ngsyse11 jnz ngsyse11
mov eax,[lba_read_enabled] mov eax,[lba_read_enabled]
@ -2528,7 +2389,9 @@ nosb6:
and dword [page_tabs+eax*4], 0 and dword [page_tabs+eax*4], 0
mov edx, eax mov edx, eax
shl edx, 12 shl edx, 12
push eax
invlpg [edx] invlpg [edx]
pop eax
inc eax inc eax
loop @b loop @b
pop eax pop eax

View File

@ -207,7 +207,6 @@ include "fs/iso9660.inc" ; read for iso9660 filesystem CD
; sound ; sound
include "sound/sb16.inc" ; playback for Sound Blaster 16
include "sound/playnote.inc" ; player Note for Speaker PC include "sound/playnote.inc" ; player Note for Speaker PC
; display ; display

View File

@ -18,7 +18,29 @@
$Revision$ $Revision$
align 4
sound_interface:
cmp eax, edi ; this is subfunction #55 ?
jne retFunc55 ; if no then return.
cmp byte [sound_flag],0
jne retFunc55
movzx eax, byte [countDelayNote]
or al, al ; player is busy ?
jnz retFunc55 ; return counter delay Note
mov [memAdrNote],edx
call get_pid
mov [pidProcessNote],eax
xor eax, eax ; Ok! EAX = 0
retFunc55:
mov [esp+36], eax ; return value EAX for application
ret
iglobal
align 4
kontrOctave dw 0x4742, 0x4342, 0x3F7C, 0x3BEC, 0x388F, 0x3562 kontrOctave dw 0x4742, 0x4342, 0x3F7C, 0x3BEC, 0x388F, 0x3562
dw 0x3264, 0x2F8F, 0x2CE4, 0x2A5F, 0x2802, 0x25BF dw 0x3264, 0x2F8F, 0x2CE4, 0x2A5F, 0x2802, 0x25BF
memAdrNote dd 0 memAdrNote dd 0
@ -27,6 +49,7 @@ slotProcessNote dd 0
count_timer_Note dd 1 count_timer_Note dd 1
mem8253r42 dw 0 mem8253r42 dw 0
countDelayNote db 0 countDelayNote db 0
endg
playNote: playNote:
; jmp NotPlayNotes ; jmp NotPlayNotes

View File

@ -1,354 +0,0 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; ;;
;; Copyright (C) KolibriOS team 2004-2007. All rights reserved. ;;
;; Distributed under terms of the GNU General Public License ;;
;; ;;
;; SB16.INC ;;
;; ;;
;; Sound Blaster 16 functions for MenuetOS ;;
;; ;;
;; Copyright 2002 Paolo Minazzi, paolo.minazzi@inwind.it ;;
;; ;;
;; See file COPYING for details ;;
;; ;;
;; - 11.07.2002 8 bit stereo mode - Ville Turjanmaa ;;
;; ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
$Revision$
SB16_load_music equ 0xc0000000
SB16_play_music equ 0xc0000001
DMAPage equ 0x2A
Rate equ 44100
;SB16_Status equ SB16Buffer+65536
iglobal
sound_data_format dd 0x1
sound_data_length dd 65536
sound_data_freq dd 44100
endg
sound_interface:
cmp eax,0 ; Load data
jne no_SB16_load_music
mov edi,[TASK_BASE]
add edi,TASKDATA.mem_start
add ebx,[edi]
call code_SB16_load_music
ret
no_SB16_load_music:
cmp eax,1 ; Play data
jne no_SB16_play_music
call code_SB16_play_music
ret
no_SB16_play_music:
cmp eax,2 ; Set data formats
jne no_SB16_data_format
cmp ebx,0 ; ebx=0 play format
jne no_sound_format
mov [sound_data_format],ecx ; 1=8b mono, 2=8b stereo
ret
no_sound_format:
cmp ebx,1 ; ebx=1 data length
jne no_sound_length
mov [sound_data_length],ecx ;
ret
no_sound_length:
cmp ebx,2 ; ebx=2 sound data frequency
jne no_sound_freq
mov [sound_data_freq],ecx
ret
no_sound_freq:
ret
no_SB16_data_format:
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
cmp eax, edi ; this is subfunction #55 ?
jne retFunc55 ; if no then return.
cmp byte [sound_flag],0
jne retFunc55
movzx eax, byte [countDelayNote]
or al, al ; player is busy ?
jnz retFunc55 ; return counter delay Note
; mov eax, [TASK_BASE]
; mov eax, [eax+0x10] ; address application im memory
; add eax, edx ; add offset Delay-Note string
; mov [memAdrNote], eax
mov [memAdrNote],edx
mov eax,[TASK_BASE]
mov eax,[eax+TASKDATA.pid]
mov [pidProcessNote],eax
xor eax, eax ; Ok! EAX = 0
retFunc55:
mov [esp+36], eax ; return value EAX for application
;!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
ret
code_SB16_play_music:
cmp [sound_data_format],1
jne no_sound_8bm
call sb_play_8b_mono
ret
no_sound_8bm:
cmp [sound_data_format],2
jne no_sound_8bs
call sb_play_8b_stereo
ret
no_sound_8bs:
ret
Blaster_command:
push eax
push ecx
push edx
mov dx,word [sb16]
add dx,0xc
mov cx,1000
bcl1:
in al,dx
and al,128
jz bcl2
loop bcl1
bcl2:
mov al,[esp+8]
mov dx,[esp+0]
add dx,word [sb16]
out dx,al
pop edx
pop ecx
pop eax
ret
sb_play_8b_stereo:
pusha
call sb_set_dma
call sb_set_stereo
mov dx,0xc
mov al,0xa8
call Blaster_command
mov al,0x40
call Blaster_command
mov al,245
call Blaster_command
mov al,0x48
call Blaster_command
mov al,0xff
call Blaster_command
call Blaster_command
mov al,0x91
call Blaster_command
popa
ret
sb_set_stereo:
push eax
push edx
call sb_wait
mov dx,word [sb16]
add dx,0x4
mov al,0xe
out dx,al
inc dx
in al,dx
and al,253
or al,2 ; stereo
out dx,al
pop edx
pop eax
ret
code_SB16_load_music:
cmp byte [SB16_Status],1
je nol
mov edi,SB16Buffer
mov esi,ebx
mov ecx,65536/4
cld
rep movsd
nol: ret
iglobal
dma_table db 0x87,0x83,0x81,0x82
endg
;--------------------------------
; program dma
;--------------------------------
sb_set_dma:
pusha
mov eax,[sound_dma]
add eax,4
out 0xa,al
mov al,0
out 0xc,al
mov eax,[sound_dma]
add eax,0x48
out 0xb,al
mov edx,[sound_dma]
shl edx,1
mov al,0
out dx,al
mov al,0
out dx,al
mov edx,[sound_dma]
add edx,dma_table
movzx edx,byte [edx]
mov al,DMAPage
out dx,al
mov edx,[sound_dma]
shl edx,1
inc edx
mov eax,[sound_data_length]
dec eax
and eax,0xff
; mov al,(DataLength-1) and 0xff
out dx,al
mov eax,[sound_data_length]
dec eax
shr eax,8
; mov al,(DataLength-1) shr 8
out dx,al
mov eax,[sound_dma] ; DMA
out 0xa,al
popa
ret
sb_play_8b_mono:
call sb_set_dma
cmp byte [SB16_Status],1
jne contsb16
jmp retserve
contsb16:
mov dx,word [sb16]
add dx,4
mov ecx,[sound_dma]
mov ax,0x01
shl ax,cl
shl ax,8
add ax,0x81
out dx,ax
mov ax,0f280h ;enable irq5
out dx,ax
adr1_SB: mov dx,word [sb16]
add dx,0ch
in al,dx
and al,080h
jnz adr1_SB
call sb_set_stereo
mov al,0d1h
out dx,al
mov dx,word [sb16]
add dx,0ch
call sb_wait
mov al,40h ; Rate
out dx,al
call sb_wait
mov al,256-1000000/Rate
out dx,al
call sb_wait
mov al,14h ; Datalength
out dx,al
call sb_wait
mov eax,[sound_data_length]
dec eax
and eax,0xff
;mov al,(DataLength-1) and 0xff
out dx,al
call sb_wait
mov eax,[sound_data_length]
dec eax
shr eax,8
;mov al,(DataLength-1) shr 8
out dx,al
retserve:
ret
sb_wait: in al,dx ;wait
and al,080h
jnz sb_wait
ret
;****************************************
; END CODE SB16 by Minazzi Paolo
;***************************************

View File

@ -468,6 +468,8 @@ proc init_cursors
.init: .init:
mov [cur_def_interl], ebx mov [cur_def_interl], ebx
; stdcall load_pe_driver, szAtiHW
stdcall load_driver, szHwMouse stdcall load_driver, szHwMouse
mov [hw_cursor], eax mov [hw_cursor], eax
test eax, eax test eax, eax