-
Notifications
You must be signed in to change notification settings - Fork 8
/
SOUNDRV.INC
137 lines (116 loc) · 3.47 KB
/
SOUNDRV.INC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
ISCOM equ 1
ISEXE equ 0
DIG_ADLIB equ 0 ; Build 1
DIG_CVXSND equ 0 ; Build 2
DIG_VMSND equ 0 ; Build 3
DIG_SMSND equ 0 ; Build 4
DIG_IBMSND equ 0 ; Build 5
DIG_DIGISP equ 0 ; Build 6
DIG_TANEXTX equ 0 ; Build 7
DIG_TANSLTL equ 0 ; Build 8
DIG_SBLASTER equ 0 ; Build 9
DIG_SOURCE equ 0 ; Build 10
DIG_ECHOII equ 0 ; Build 11
DIG_LANTSND equ 0 ; Build 12
DIG_IBMBAK equ 0 ; Build 13
DIG_IBM1BIT equ 0 ; Build 14
DIG_PAUDIO equ 0 ; Build 15
DIG_BIGMOUTH equ 0 ; Build 16
DIG_MASTER equ 0 ; BUild 17
DIG_ADLIBG equ 0 ; Build 18
DIG_T2500 equ 0 ; Build 19
DIG_ARIA equ 0
BACKFILL equ 0 ; DMA backfill support is 0 by default.
MILLIKEN equ 0
PLAYBACK equ 1 ;0
MASSAGE equ 2 ;1
FIXEDFREQ equ 4 ;2
USESTIMER equ 8 ;3
SHARESTIMER equ 16 ;4 True if supports timer sharing.
LOOPEND equ 32 ;5 Supports looping,and pending sounds.
STEREOPAN equ 64 ;6 supports stereo panning.
STEREOPLAY equ 128 ;7 Supports stereo playback!
AUDIORECORD equ 256 ;8 support digital sound recording.
DMABACKFILL equ 512 ;9 supports DMA backfilling.
PCM16 equ 1024 ;10 supports 16 bit PCM!
PCM16STEREO equ 2048 ;11 supports 16 bit Stereo PCM!
TIMER0 equ 40h ; port address of timer 0
portTIMER2 equ 42h ; port address of timer 2
TIME_CNTRL equ 43h ; 8253 control register port
Struc SOUNDSPEC
PLAYADR FARPTR <> ; Address of sound sample to be played.
PLAYLEN dw ? ; Length of sound sample to be played.
ISPLAYING FARPTR <> ; Address of our playing sample semephore.
FREQUENCY dw ? ; Frequency to play it at.
Ends
Macro IN_TSR
push ds
push es
push si
push di
mov ax,cs
mov ds,ax
mov es,ax
endm
Macro OUT_TSR
pop di
pop si
pop es
pop ds
endm
Macro WaitSound
LOCAL @@WT
@@WT: mov ax,689h
int 66h
or ax,ax
jnz @@WT
endm
Macro Dally
jmp $+2
endm
PCM_8_MONO equ 0
PCM_8_STEREO equ 1
PCM_16_MONO equ 2
PCM_16_STEREO equ 3
;; Set's the DIGPAK semaphore
Macro SetSemaphore
mov [cs:INDIGPAK],1
endm
;; Clear's the semaphore, and does an IRET
Macro ClearSemaphoreIRET
mov [cs:INDIGPAK],0
iret
endm
Macro ClearSemaphore
mov [cs:INDIGPAK],0
endm
;; This macro checks the DPMI compliant FLAG
;; If DPMI is on, then the address of the SoundStructure passed is
;; in ESI instead of DS:SI. First make certain it is in the low 1mb
;; of address space. If not, clearsemaphoreiret. Otherwise set DS:SI
;; equal to that address.
Macro ConvertDPMI seg,indx
LOCAL @@HOP
cmp [cs:DPMI],0 ; In 32 bit DPMI mode?
je @@HOP
push eax ; Save EAX
mov eax,indx ; Get the entire 32 bit flat-model address.
shr eax,4 ; leave just the segment portion.
mov seg,ax ; place the segment into DS
and indx,0Fh ; leave just the offset portion.
pop eax
@@HOP:
endm
Macro GET20BIT
call makelinear
;;; PUSH CX
;;; MOV CL,4
;;; ROL DX,CL
;;; MOV CX,DX
;;; AND DX,0FH
;;; XOR CX,DX
;;; ADD AX,CX
;;; ADC DX,0
;;; POP CX
endm
KINT equ 66h