Subversion Repositories Kolibri OS

Compare Revisions

No changes between revisions

Regard whitespace Rev 801 → Rev 802

/kernel/trunk/core/conf_lib.inc
22,12 → 22,15
locals
par db 30 dup(?)
endl
 
pushad
;[gui]
;mouse_speed
 
lea eax,[par]
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
stdcall strtoint,eax
mov [mouse_speed_factor], ax
35,36 → 38,13
;mouse_delay
lea eax,[par]
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
stdcall strtoint,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
lea eax,[par]
push eax
71,6 → 51,7
invoke ini.get_str,conf_fname, udev, udev_midibase, eax,30, udev_midibase_def
pop eax
stdcall strtoint,eax
 
cmp eax, 0x100
jb @f
cmp eax, 0x10000
80,7 → 61,6
inc eax
mov [midisp], eax
@@:
popad
ret
endp
92,10 → 72,6
ugui_mouse_delay_def db '0x00A',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_def db '0x320',0
 
/kernel/trunk/core/dll.inc
37,15 → 37,11
 
mov eax, [access_rights]
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
;pop eax
mov [irq_owner + 4 * ebx], PID_KERNEL ; all handlers belong to a kernel
 
stdcall enable_irq, [irq]
mov eax, 1
ret
.err:
xor eax, eax
/kernel/trunk/core/sched.inc
15,7 → 15,6
 
align 32
irq0:
; pushfd
pushad
mov ax, app_data ;
mov ds, ax
42,7 → 41,6
mov [DONT_SWITCH], byte 0
 
popad
; popfd
iretd
 
.change_task:
227,9 → 225,6
@@:
mov eax, [ebx+APPDATA.saved_esp0]
mov [tss._esp0], eax
; mov eax, [ebx+APPDATA.pl0_stack]
; add eax, RING0_STACK_SIZE
; mov [tss._esp0], eax
mov ax, graph_data
mov gs, ax
 
/kernel/trunk/core/syscall.inc
128,10 → 128,10
dd sys_settime ; 22-setting date,time,clock and alarm-clock
dd 0
dd syscall_cdaudio ; 24-PlayCdTrack,StopCd and GetCdPlaylist
dd sys_sb16 ; 25-SetSb16
dd 0 ;
dd sys_getsetup ; 26-GetMidiBase,GetKeymap,GetShiftKeymap,.
dd 0
dd sys_sb16II ; 28-SetSb16
dd 0 ;
dd 0
dd sys_current_directory ; 30-Get/SetCurrentDirectory
dd 0
208,10 → 208,10
dd cross_order ; 22-setting date,time,clock and alarm-clock
dd sys_wait_event_timeout ; 23-TimeOutWaitForEvent
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 undefined_syscall ; 27-reserved
dd cross_order ; 28-SetSb16
dd undefined_syscall ; 28-reserved
dd sys_date ; 29-GetDate
dd cross_order ; 30-Get/SetCurrentDirectory
dd undefined_syscall ; 31-reserved
/kernel/trunk/data32.inc
90,6 → 90,7
szPS2MDriver db 'PS2MOUSE',0
szCOM_MDriver db 'COM_MOUSE',0
szUSB db 'USB',0
szAtiHW db '/rd/1/drivers/ati2d.drv',0
 
szSTART db 'START',0
szEXPORTS db 'EXPORTS',0
146,7 → 147,6
 
align 4
keyboard dd 1
sound_dma dd 1
syslang dd 1
 
boot_y dd 10
283,7 → 283,9
mem_block_map rb 512
event_map rb 64
mem_block_list rd 64
large_block_list rd 31
mem_block_mask rd 2
large_block_mask rd 1
 
mem_used.fd rd 1
mem_used.bk rd 1
364,8 → 366,6
fat32part rd 1 ; for boot 0x1
cdpos rd 1
 
sb16 rd 1
 
;CPUID information
cpu_vendor rd 3
cpu_sign rd 1
/kernel/trunk/docs/sysfuncr.txt
1133,18 → 1133,7
======================================================================
== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 4 - ãáâ ­®¢¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. =
======================================================================
 à ¬¥âàë:
* eax = 21 - ­®¬¥à ä㭪樨
* ebx = 4 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­®¬¥à ¡ §®¢®£® ¯®àâ 
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = -1 - ®è¨¡®ç­ë© ­®¬¥à ¯®àâ 
‡ ¬¥ç ­¨ï:
* ®¬¥à ¯®àâ  ¤®«¦¥­ 㤮¢«¥â¢®àïâì ãá«®¢¨ï¬ 0x100<=ecx<=0xFFFF.
* “áâ ­®¢ª  ¡ §ë ­ã¦­  ¤«ï à ¡®âë ä㭪権 25, 28, 55.
* ®«ãç¨âì ãáâ ­®¢«¥­­ë© ¡ §®¢ë© ¯®àâ ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 26.
“¤ «¥­ 
 
======================================================================
========= ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 5 - ãáâ ­®¢¨âì ï§ëª á¨á⥬ë. ========
1212,18 → 1201,7
======================================================================
===== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 10 - ãáâ ­®¢¨âì ª ­ « DMA ¤«ï §¢ãª . ====
======================================================================
 à ¬¥âàë:
* eax = 21 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
* ecx = ­®¬¥à ª ­ «  (®â 0 ¤® 3 ¢ª«îç¨â¥«ì­®)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = -1 - ­¥¢¥à­ë© ­®¬¥à ª ­ « 
‡ ¬¥ç ­¨ï:
* ®¬¥à ª ­ «  DMA ¨á¯®«ì§ã¥âáï ¢
¯®¤ä㭪樨 1 ä㭪樨 55.
* ®«ãç¨âì ª ­ « DMA ¤«ï §¢ãª  ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 10 ä㭪樨 26.
“¤ «¥­ :
 
======================================================================
====================== ”ã­ªæ¨ï 21, ¯®¤äã­ªæ¨ï 11 =====================
1521,22 → 1499,7
======================================================================
============== ”ã­ªæ¨ï 25 - ãáâ ­®¢¨âì £à®¬ª®áâì SBPro. ==============
======================================================================
 à ¬¥âàë:
* eax = 25 - ­®¬¥à ä㭪樨
* ebx = çâ® ãáâ ­ ¢«¨¢ âì:
* 1 - ãáâ ­®¢¨âì ®¡éãî £à®¬ª®áâì
* 2 - ãáâ ­®¢¨âì £à®¬ª®áâì CD-audio
* cl = ã஢¥­ì £à®¬ª®áâ¨: áâ à訥 4 ¡¨â  ¤«ï «¥¢®© ª®«®­ª¨,
¬« ¤è¨¥ 4 - ¤«ï ¯à ¢®©
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = 1 - ­¥ ®¯à¥¤¥«¥­  ¡ §  SB
* eax = 2 - ­¥¢¥à­ ï ¯®¤äã­ªæ¨ï
‡ ¬¥ç ­¨ï:
* à¥¤¢ à¨â¥«ì­® ­ã¦­® ®¯à¥¤¥«¨âì ¡ §®¢ë© ¯®àâ SB ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 21.
* ‘¬®âਠ⠪¦¥ äã­ªæ¨î 28
ãáâ ­®¢ª¨ §¢ãª  ¤«ï ¡®«¥¥ ¯®§¤­¥£® áâ ­¤ àâ  SB16.
“¤ «¥­ 
 
======================================================================
===== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 1 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ MPU MIDI. =====
1603,14 → 1566,7
======================================================================
=== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 4 - ¯®«ãç¨âì ¡ §®¢ë© ¯®àâ Sound Blaster. ==
======================================================================
 à ¬¥âàë:
* eax = 26 - ­®¬¥à ä㭪樨
* ebx = 4 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ­®¬¥à ¡ §®¢®£® ¯®àâ 
‡ ¬¥ç ­¨ï:
* “áâ ­®¢ª  ¡ §ë ­ã¦­  ¤«ï à ¡®âë ä㭪権 25, 55.
* “áâ ­®¢¨âì ¡ §®¢ë© ¯®àâ ¬®¦­® ¢ë§®¢®¬ ¯®¤ä㭪樨 4 ä㭪樨 21.
“¤ «¥­ 
 
======================================================================
========== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 5 - ¯®«ãç¨âì ï§ëª á¨á⥬ë. =========
1679,15 → 1635,7
======================================================================
====== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 10 - ¯®«ãç¨âì ª ­ « DMA ¤«ï §¢ãª . =====
======================================================================
 à ¬¥âàë:
* eax = 26 - ­®¬¥à ä㭪樨
* ebx = 10 - ­®¬¥à ¯®¤ä㭪樨
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = ­®¬¥à ª ­ «  (®â 0 ¤® 3 ¢ª«îç¨â¥«ì­®)
‡ ¬¥ç ­¨ï:
* ®¬¥à ª ­ «  DMA ¨á¯®«ì§ã¥âáï ¢ ¯®¤ä㭪樨 1 ä㭪樨 55.
* “áâ ­®¢¨âì ª ­ « DMA ¤«ï §¢ãª  ¬®¦­® ¢ë§®¢®¬
¯®¤ä㭪樨 10 ä㭪樨 21.
“¤ «¥­ 
 
======================================================================
====================== ”ã­ªæ¨ï 26, ¯®¤äã­ªæ¨ï 11 =====================
1721,21 → 1669,7
======================================================================
=============== ”ã­ªæ¨ï 28 - ãáâ ­®¢¨âì £à®¬ª®áâì SB16. ==============
======================================================================
 à ¬¥âàë:
* eax = 28 - ­®¬¥à ä㭪樨
* ebx = çâ® ãáâ ­ ¢«¨¢ âì:
* 1 - ãáâ ­®¢¨âì ®¡éãî £à®¬ª®áâì
* 2 - ãáâ ­®¢¨âì £à®¬ª®áâì CD-audio
* cl = ã஢¥­ì £à®¬ª®á⨠(0=off, 0xFF=max)
‚®§¢à é ¥¬®¥ §­ ç¥­¨¥:
* eax = 0 - ãᯥ譮
* eax = 1 - ­¥ ®¯à¥¤¥«¥­  ¡ §  SB
* eax = 2 - ­¥¢¥à­ ï ¯®¤äã­ªæ¨ï
‡ ¬¥ç ­¨ï:
* à¥¤¢ à¨â¥«ì­® ­ã¦­® ®¯à¥¤¥«¨âì ¡ §®¢ë© ¯®àâ SB ¢ë§®¢®¬
¯®¤ä㭪樨 4 ä㭪樨 21.
* â  äã­ªæ¨ï ¯à¥¤®áâ ¢«ï¥â ¡®«ìè¥ ¢ à¨ ­â®¢ ¤«ï £à®¬ª®áâ¨,
祬 äã­ªæ¨ï 25.
“¤ «¥­ 
 
======================================================================
================ ”ã­ªæ¨ï 29 - ¯®«ãç¨âì á¨á⥬­ãî ¤ âã. ===============
/kernel/trunk/docs/sysfuncs.txt
1128,18 → 1128,7
======================================================================
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
========== Function 21, subfunction 5 - set system language. =========
1204,16 → 1193,7
======================================================================
======== Function 21, subfunction 10 - set sound DMA channel. ========
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
Function 21, subfunction 11 - enable/disable low-level access to HD.
1505,22 → 1485,7
======================================================================
=================== Function 25 - set SBPro volume. ==================
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1584,14 → 1549,7
======================================================================
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
========== Function 26, subfunction 5 - get system language. =========
1658,14 → 1616,7
======================================================================
======== Function 26, subfunction 10 - get sound DMA channel. ========
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
===================== Function 26, subfunction 11 ====================
1697,20 → 1648,7
======================================================================
=================== Function 28 - set SB16 volume. ===================
======================================================================
Parameters:
* 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.
Removed
 
======================================================================
=================== Function 29 - get system date. ===================
/kernel/trunk/drivers/ati2d.asm
7,6 → 7,8
 
format MS COFF
 
DEBUG equ 1
 
include 'proc32.inc'
include 'imports.inc'
 
14,8 → 16,6
 
API_VERSION equ 0x01000100
 
DEBUG equ 1
 
STRIDE equ 8
 
VID_ATI equ 0x1002
/kernel/trunk/drivers/com_mouse.asm
11,14 → 11,12
 
format MS COFF
 
API_VERSION equ 5 ;debug
DEBUG equ 0
 
include 'proc32.inc'
include 'imports.inc'
 
OS_BASE equ 0x80000000;
new_app_base equ 0x0
PROC_BASE equ OS_BASE+0x0080000
API_VERSION equ 5 ;debug
 
struc IOCTL
{ .handle dd ?
36,7 → 34,6
public START
public version
 
DEBUG equ 0
 
DRV_ENTRY equ 1
DRV_EXIT equ -1
/kernel/trunk/drivers/ensoniq.asm
9,12 → 9,12
 
format MS COFF
 
DEBUG equ 1
 
 
include 'proc32.inc'
include 'imports.inc'
 
DEBUG equ 1
 
REMAP_IRQ equ 0
 
;irq 0,1,2,8,12,13 íåäîñòóïíû
/kernel/trunk/drivers/imports.inc
6,8 → 6,10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
macro kernel_export [name]{
forward
;display `name,#13,#10
if used name
if DEBUG
display 'uses: ',`name,#13,#10
end if
extrn name
end if
}
19,6 → 21,7
GetService,\
ServiceHandler,\
AttachIntHandler,\
GetIntHandler,\
FpuSave,\
FpuRestore,\
ReservePortArea,\
/kernel/trunk/drivers/infinity.asm
10,7 → 10,14
 
format MS COFF
 
DEBUG equ 1
 
 
include 'proc32.inc'
include 'main.inc'
include 'imports.inc'
 
 
CURRENT_API equ 0x0101 ;1.01
COMPATIBLE_API equ 0x0100 ;1.00
 
18,13 → 25,6
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_128 equ 0 ;integer sse2 extensions
;and reduce driver size
33,9 → 33,6
 
USE_SSE2_MIXER equ 0 ;floating point mixer. Disabled by default
 
DEBUG equ 1
 
 
OS_BASE equ 0x80000000
 
CAPS_SSE2 equ 26
1209,7 → 1206,7
;r_size r_dt resampler_func
dd 0,0,0 ; 0 PCM_ALL
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 8192, 30109, resample_1 ; 4 PCM_1_16_44
/kernel/trunk/drivers/proc32.inc
71,7 → 71,7
if parmbytes | localbytes
leave
end if
if (flag and 10000b) | (parmbytes=0)
if flag and 10000b
retn
else
retn parmbytes
/kernel/trunk/drivers/ps2mouse.asm
1,5 → 1,7
format MS COFF
 
DEBUG equ 0
 
include 'proc32.inc'
include 'imports.inc'
 
/kernel/trunk/drivers/sb16/CONFIG.INC
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
 
/kernel/trunk/drivers/sb16/SB16.INC
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
/kernel/trunk/drivers/sb16/sb16.asm
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
/kernel/trunk/drivers/sceletone.asm
9,6 → 9,8
 
format MS COFF
 
DEBUG equ 1
 
API_VERSION equ 0 ;debug
 
include 'proc32.inc'
35,8 → 37,6
public service_proc
public version
 
DEBUG equ 1
 
DRV_ENTRY equ 1
DRV_EXIT equ -1
STRIDE equ 4 ;size of row in devices table
/kernel/trunk/drivers/sis.asm
7,12 → 7,13
 
format MS COFF
 
 
DEBUG equ 1
 
include 'proc32.inc'
include 'imports.inc'
 
API_VERSION equ 0x01000100
 
DEBUG equ 1
DEBUG_IRQ equ 0
 
USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices
Property changes:
Deleted: svn:keywords
-Rev
\ No newline at end of property
/kernel/trunk/drivers/sound.asm
7,6 → 7,7
 
format MS COFF
 
DEBUG equ 1
 
include 'proc32.inc'
include 'imports.inc'
13,7 → 14,6
 
API_VERSION equ 0x01000100
 
DEBUG equ 1
DEBUG_IRQ equ 0
 
USE_COM_IRQ equ 0 ;make irq 3 and irq 4 available for PCI devices
Property changes:
Deleted: svn:keywords
-Rev
\ No newline at end of property
/kernel/trunk/hid/mousedrv.inc
114,29 → 114,25
 
movzx edx, byte [display_data+ebx+eax]
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
 
cmp [ecx+CURSOR.magic], 'CURS'
jne .fail
; cmp [esi+CURSOR.magic], 'CURS'
; jne .fail
 
push ecx
push esi
call [select_hw_cursor]
mov [current_cursor], ecx
 
; cmp [ecx+CURSOR.size], CURSOR_SIZE
; jne .fail
 
mov [current_cursor], esi
.draw:
stdcall [set_hw_cursor], ecx
stdcall [set_hw_cursor], esi
popad
ret
.fail:
mov ecx, [def_cursor]
mov [edx+SLOT_BASE+APPDATA.cursor], ecx
stdcall [set_hw_cursor], ecx
stdcall [set_hw_cursor], ecx ; stdcall: [esp]=ebx,eax
popad
ret
 
/kernel/trunk/kernel.asm
345,8 → 345,6
mov al,[BOOT_VAR+0x9000] ; bpp
mov [ScreenBPP],al
 
xchg bx, bx
 
movzx eax,word [BOOT_VAR+0x900A] ; X max
dec eax
mov [Screen_Max_X],eax
1032,7 → 1030,6
 
mov [irq_owner+4*0], 1 ; timer
;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*13], 1 ; math co-pros
mov [irq_owner+4*14], 1 ; ide I
1104,7 → 1101,6
mov [MOUSE_X],eax
pop eax
 
mov byte [SB16_Status],0 ; Minazzi Paolo
mov [BTN_ADDR],dword BUTTON_INFO ; address of button list
 
;!! IP 04.02.2005:
1183,106 → 1179,6
mov [esp+24],eax
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:
 
; eax = print type, al=0 -> ebx is number
1472,7 → 1368,6
; 1=roland mpu midi base , base io address
; 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
; 4=sb16 base , base io address
; 5=system language, 1eng 2fi 3ger 4rus
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 8=fat32 partition in hd
1543,7 → 1438,7
ret
nsyse2:
cmp eax,3 ; CD
jnz nsyse3
jnz nsyse4
test ebx,ebx
jz nosesl
cmp ebx, 4
1573,17 → 1468,6
 
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:
 
cmp eax,5 ; SYSTEM LANGUAGE
1652,23 → 1536,15
popa
mov [hd1_status],0 ; free
ret
 
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
jne no_set_lba_read
and ebx,1
mov [lba_read_enabled],ebx
ret
 
no_set_lba_read:
 
cmp eax,12 ; ENABLE PCI ACCESS
jne no_set_pci_access
and ebx,1
1691,7 → 1567,6
; 1=roland mpu midi base , base io address
; 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
; 4=sb16 base , base io address
; 5=system language, 1eng 2fi 3ger 4rus
; 7=hd base 1, pri.master 2, pri slave 3 sec master, 4 sec slave
; 8=fat32 partition in hd
1749,14 → 1624,6
mov [esp+36],eax
ret
ngsyse3:
 
cmp eax,4
jne ngsyse4
mov eax,[sb16]
mov [esp+36],eax
ret
ngsyse4:
 
cmp eax,5
jnz ngsyse5
mov eax,[syslang]
1781,12 → 1648,6
mov [esp+36],eax
ret
ngsyse9:
cmp eax,10
jnz ngsyse10
mov eax,[sound_dma]
mov [esp+36],eax
ret
ngsyse10:
cmp eax,11
jnz ngsyse11
mov eax,[lba_read_enabled]
2528,7 → 2389,9
and dword [page_tabs+eax*4], 0
mov edx, eax
shl edx, 12
push eax
invlpg [edx]
pop eax
inc eax
loop @b
pop eax
/kernel/trunk/kernel32.inc
207,7 → 207,6
 
; sound
 
include "sound/sb16.inc" ; playback for Sound Blaster 16
include "sound/playnote.inc" ; player Note for Speaker PC
 
; display
/kernel/trunk/sound/sb16.inc
File deleted
Property changes:
Deleted: svn:keywords
-Rev
\ No newline at end of property
/kernel/trunk/sound/playnote.inc
18,7 → 18,29
 
$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
dw 0x3264, 0x2F8F, 0x2CE4, 0x2A5F, 0x2802, 0x25BF
memAdrNote dd 0
27,6 → 49,7
count_timer_Note dd 1
mem8253r42 dw 0
countDelayNote db 0
endg
 
playNote:
; jmp NotPlayNotes
/kernel/trunk/video/cursors.inc
468,6 → 468,8
.init:
mov [cur_def_interl], ebx
 
; stdcall load_pe_driver, szAtiHW
 
stdcall load_driver, szHwMouse
mov [hw_cursor], eax
test eax, eax