home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Audio 4.94 - Over 11,000 Files
/
audio-11000.iso
/
msdos
/
sndbords
/
proaudio
/
pcmtlsrc
/
pcmtlsrc.arj
/
PCM.ARJ
/
_I94F91.INC
< prev
next >
Wrap
Text File
|
1992-08-31
|
10KB
|
510 lines
;$Author: BCRANE $
;$Date: 31 Aug 1992 09:34:28 $
;$Header: X:/sccs/sdkapp/_i94f91.inv 1.1 31 Aug 1992 09:34:28 BCRANE $
;$Log: X:/sccs/sdkapp/_i94f91.inv $
;
; Rev 1.1 31 Aug 1992 09:34:28 BCRANE
;added support for 16-bit
;
; Rev 1.0 29 Jul 1992 16:57:24 BCRANE
;Initial revision.
;$Logfile: X:/sccs/sdkapp/_i94f91.inv $
;$Modtimes$
;$Revision: 1.1 $
;$Workfile: _i94f91.inc $
;; shark functions
;; dx:ax can be used to return values
;; si can be trashed
;; no other precautions taken
if VERBOSE
align 256
db '_i94f91.inc: copyright Media Vision, Inc., 1992', 00h
endif
DOINT21 equ 1
iobf91 struc
f00r dd 0 ; hardware state table returned from InitMVSound
f01r dw 0 ; library code version returned from InitPCM
f02c1 dd 0 ; samplerate passed to PCMInfo
f02c2 dw 0 ; mono/stero flag passed to PCMInfo
f02r dw 0 ; -1 returned by PCMInfo if error, else (?)
f04c dd 0 ; address of interrupt function or index to internals
f04r dd 0 ; 0 returned by UserFunc if error, else (?)
f11c1 dd 0 ; not used at present FindDMABuffer
f11c2 dw 0 ; not used at present FindDMABuffer
f11r dd 0 ; not used at present FindDMABuffer
f03c1 dd 0 ; DMA buffer passed to DMABuffer
f03c2 dw 0 ; size of DMA buffer in kilobytes passed to DMABuffer
f03c3 dw 0 ; number of partitions of DMA buffer passed to DMABuffer
f03r dd 0 ; 0 returned by DMABuffer if error, else (?)
f10r dw 0 ; returned by RemovePCM
f05r dw 0 ; returned by PCMPlay
f07r dw 0 ; returned by PausePCM
stat dd 0 ; address of variable to be decremented each DMA pass
fh dw 0 ; file handle for input file
sbsize dw 0 ; size of each partition
f02c3 dw 0 ; compression
f02c4 dw 0 ; datasize
iobf91 ends
MAXUSERFUNC equ 3 ; Used for ANDing, must be 2^X-1!
uf dw offset uf0, offset uf0, offset uf0, offset uf0
iuf dw 0, 0, 0, 0
iufproc dw 0
align 16
;; f00 -FP f01 -FP f02 FP,i-FP f04 FP-i
;; f11 FP,i-FP f03 FP,i,i-FP f10 -i f05 -i f07 -i
f91state iobf91 <0, 0, 0,0,0, 0,0, 0,0,0, 0,0,0,0, 0, 0, 0>
align 2
;; i94f91() - perform all initialization code
;; es:bx points to iobf91 struct
;; returns status in iobf91 struct
_i94f91 proc
push ds
push cs
pop ds
push es
push di
push cx
push ax
mov ax, cs
mov es, ax
mov di, offset f91state
mov cx, type f91state / 2
xor ax, ax
rep stosw
pop ax
pop cx
pop di
pop es
f91_00:
push es ; save before call
push bx
call InitMVSound
pop bx ; restore
pop es
mov word ptr es:[bx].f00r[0], ax ; save returned HW State Table
mov word ptr es:[bx].f00r[2], dx
or dx, ax
jnz f91_01
pop ds
ret
f91_01:
push es ; save before call
push bx
call InitPCM
pop bx ; restore
pop es
mov es:[bx].f01r, ax
or ax, ax
jnz f91_02
pop ds
ret
f91_02:
push es ; save before call
push bx
mov ax, es:[bx].f02c4
cmp ax, 8
jz @F
cmp ax, 16
jz @F
cmp ax, 12
jz @F
cmp ax, 24
jz @F
mov ax, 8
@@: push ax
mov ax, es:[bx].f02c3
cmp ax, 1
jz @F
cmp ax, 0
jz @F
cmp ax, 2
jz @F
xor ax, ax
@@: push ax
mov ax, es:[bx].f02c2
push ax
mov ax, word ptr es:[bx].f02c1[2]
push ax
mov ax, word ptr es:[bx].f02c1[0]
push ax
call PCMInfo
add sp, 10
pop bx ; restore
pop es
mov es:[bx].f02r, ax
inc ax
jnz f91_04
push es ; save before call
push bx
call RemovePCM
pop bx ; restore
pop es
pop ds
ret
f91_04:
push es ; save before call
push bx
mov ax, word ptr es:[bx].f04c[2] ; segment of user function
or ax, ax ; non-zero means function
jnz f91_04a ; skip ahead
mov ax, cs ; our code segment
push ax
mov bx, word ptr es:[bx].f04c[0] ; index to internal routines
and bx, MAXUSERFUNC ; no out of bounds!
shl bx, 1 ; word table
mov ax, cs:uf[bx] ; get offset from table
mov cs:iufproc, 0 ; set to zero
cmp cs:iuf[bx], 0 ; is there an initializer?
jz @F
mov dx, cs:iuf[bx]
mov cs:iufproc, dx ; set for later use
@@: jmp short f91_uf
f91_04a:
push ax
mov ax, word ptr es:[bx].f04c[0]
f91_uf:
push ax
call UserFunc
add sp, 4
pop bx ; restore
pop es
mov word ptr es:[bx].f04r[2], dx
mov word ptr es:[bx].f04r[0], ax
or dx, ax
jnz f91getdmabuf
push es ; save before call
push bx
call RemovePCM
pop bx ; restore
pop es
pop ds
ret
f91getdmabuf:
mov ax, word ptr es:[bx].f03c1[2] ; if OURDMABUF set
or ax, word ptr es:[bx].f03c1[0]
jnz f91_03 ; skip straight to it
push es ; save before call
push bx
call RemovePCM
pop bx ; restore
pop es
pop ds
ret ; else fail for now
f91_03:
push es ; save before call
push bx
mov ax, es:[bx].f03c3 ; number of partitions
push ax
mov ax, es:[bx].f03c2 ; size of DMA in KB
push ax
mov ax, word ptr es:[bx].f03c1[2] ; segment of DMA buffer
push ax
mov ax, word ptr es:[bx].f03c1[0] ; offset of DMA buffer
push ax
call DMABuffer
add sp, 8
pop bx ; restore
pop es
mov word ptr es:[bx].f03r[2], dx ; save return value
mov word ptr es:[bx].f03r[0], ax
or dx, ax
jnz f91_sbsize
push es ; save before call
push bx
call RemovePCM
pop bx ; restore
pop es
pop ds
ret
f91_sbsize:
mov ax, es:[bx].f03c2 ; ax= number of partitions
xor dx, dx ; zero for division
mov cx, es:[bx].f03c3
xor ch, ch ; no overflows
or cl, cl ; no divide by zero crash
jnz @F
mov cl, 2
@@: div cx ; div ax by cx
test byte ptr es:[bx].f03c2[1], 0FFh ; was dmasize in KB
jnz @F ; no, skip ahead
shl al, 1 ; * 2
shl al, 1 ; * 4
mov ah, al ; * 100h
xor al, al ; = amount in bytes
@@: mov es:[bx].sbsize, ax ; save partition size in bytes
f91_05:
push es ; save before call
push bx
call PCMPlay
pop bx ; restore
pop es
mov es:[bx].f05r, ax
push es ; save before call
push bx
call PausePCM
pop bx ; restore
pop es
mov es:[bx].f05r, ax
push ds
push si
push es
push di
push cx
push ax
mov ax, es
mov ds, ax
mov si, bx ;; ds:si has es:bx
mov ax, cs
mov es, ax
mov di, offset f91state ;; es:di has &iobf91
mov cx, type f91state / 2 ;; cx has word count
rep movsw ;; copy current to our
pop ax
pop cx
pop di
pop es
pop si
pop ds
cmp cs:iufproc, 0 ; is there initialization>
jz @F ; no, skip
call cs:iufproc ; yes, perform it
@@:
pop ds
ret
_i94f91 endp
;; User Interrupt Functions
uf0 proc far
push bx ; save
push es
push ax ; save temporarily
mov ax, word ptr cs:[f91state].stat[2]; get segment address of stat flag
mov es, ax ; point to stat flag with es:bx
mov bx, word ptr cs:[f91state].stat[0]; get offset address of stat flag
or ax, bx ; is the address 0?
pop ax ; restore temporary save
jz @F ; yes, zero, don't affect
dec byte ptr es:[bx] ; decrement
jns @F ; if not negative, skip
mov byte ptr es:[bx], 0 ; make zero
@@: pop es ; restore
pop bx
retf
uf0 endp
;;; removed for time being
if 0
uf1addedsome dw 0
uf1currentblock dw 0
uf1 proc far
push bx ; save
push es
push ax
mov ax, word ptr cs:[f91state].stat[2]; get segment address of stat flag
mov es, ax ; point to stat flag with es:bx
mov bx, word ptr cs:[f91state].stat[0]; get offset address of stat flag
or ax, bx ; is the address 0?
jnz @F
jmp uf1_full ; yes, zero, don't affect
@@:
inc word ptr cs:uf1currentblock
mov ax, cs:[f91state].f03c3
dec ax
and cs:[uf1currentblock], ax
dec byte ptr es:[bx] ; decrement
jns @F ; if not negative, skip
mov byte ptr es:[bx], 0 ; make zero
@@: mov ax, es:[bx] ; get current flag count
inc ax ; adjust for zero base
cmp ax, cs:[f91state].f03c3
jnb uf1_full ; DMA buffers are full!
dec ax ; unadjust
pushall ; save state
mov bx, cs:[f91state].fh ; get file handle
mov cx, cs:[f91state].sbsize ; amount to read in KB
mov ax, cs:[uf1currentblock]
xchg ax, cx ; ax= sbsize, cx= partition number
mov dx, word ptr cs:[f91state].f03c1[2]
mov ds, dx
mov dx, word ptr cs:[f91state].f03c1[0] ; dx:dx= DMAbuffer
jcxz uf1_atp0 ; if partition # is 0, skip ahead
@@: add dx, ax ; point to next partition
loop @B
uf1_atp0:
xchg ax, cx ; cx= size to read in bytes
ifdef DOINT21
@@: call chkindos
jnz @B
mov ah, 3Fh
int 21h
else
mov ax, cx
clc
endif
jnc @F ; no error, skip ahead
xor ax, ax ; else zero bytes read
@@: add dx, ax ; skip into buffer
mov cs:[uf1addedsome], ax ; 0= no more to read
sub cx, ax ; count to set to silence
jz @F ; buffer was filled, ignore
mov ax, ds
mov es, ax
mov di, dx
mov al, 080h
rep stosb ; filled with silence
@@:
cmp cs:[uf1addedsome], 0
jz @F
push es
push bx
mov bx, word ptr cs:[f91state].stat[2]
mov es, bx
mov bx, word ptr cs:[f91state].stat[0]
inc byte ptr es:[bx]
pop bx
pop es
@@: popall ; restore state
uf1_full:
pop ax
pop es
pop bx ; restore
retf
uf1 endp
;; iuf1 - initialize internal user function 1
;; es:bx= iobf91 struct pointer
;; read from fh into dmabuf to fill it up
iuf1pc dw 0
iuf1 proc near
pushall
mov di, bx
mov ax, es:[di].f03c3 ; count of partitions in DMA buf
mov cs:[iuf1pc], ax
mov dx, word ptr es:[di].f03c1[2]
mov ds, dx ; ds:dx = read buffer
mov dx, word ptr es:[di].f03c1[0]
iuf1_read:
mov cx, es:[di].sbsize ; size of dma partition in bytes
push cx ; save
mov bx, es:[di].fh ; file handle
ifdef DOINT21
@@: call chkindos
jnz @B
mov ah, 03Fh
int 021h
else
xor ax, ax
clc
endif
jnc @F
xor ax, ax
@@: sub cx, ax
jz @F
push es
push di
mov ax, ds
mov es, ax
mov di, dx
rep stosb
pop di
pop es
@@: pop cx ; restore partition size
add dx, cx ; next partition
push es
push bx
mov bx, word ptr cs:[f91state].stat[2]
mov es, bx
mov bx, word ptr cs:[f91state].stat[0]
inc byte ptr es:[bx]
pop bx
pop es
dec cs:[iuf1pc]
jnz iuf1_read
popall
ret
iuf1 endp
uf2 proc far
retf
uf2 endp
uf3 proc far
retf
uf3 endp
chkindos proc near
push es
push bx
mov bx, word ptr cs:[indos][2]
mov es, bx
mov bx, word ptr cs:[indos][0]
cmp byte ptr es:[bx], 0
pop bx
pop es
ret
chkindos endp
endif
;; end of remove for time being