home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Sound Sensations!
/
sound_sensations.iso
/
demos
/
promidi7
/
sda_user.arc
/
SDA_USER.ASM
< prev
next >
Wrap
Assembly Source File
|
1986-12-16
|
6KB
|
351 lines
page
name SDA_USER_ROUTINES
code segment public 'code'
assume cs:code,ds:code
;******************************************************************
;*
;* See companion file 'SDA_USER.DOC' for more information on
;* these subroutines.
;*
;******************************************************************
;******************************************************************
;*
;* This software is intended to provide access to a running
;* Promidi system from co-resident software which receives
;* control via INT 16 (function 1). Two prerequisites are
;* necessary before the service routines may be called:
;* 1. The interrupting routine must immediately save the Promid's
;* DS register in _SDA_DSEG.
;* 2. The routine _CHECK4_SDA must be called successfully
;* (RET = 1). This routine binds the two programs together.
;*
;* If it is desired to have Promidi continue to read from the disk
;* (as when playing a file/track), the routine _SDA_EXEC must be
;* called periodically.
;*
;******************************************************************
;*************************************************************************
;*
;* The source file 'SDA_USER.ASM' is provided free of charge by Systems
;* Design Associates, Inc. SDA does not in any way warranty this software
;* nor is it liable for any damages resulting from its use.
;*
;*************************************************************************
PUBLIC _SDA_DSEG
_SDA_DSEG DW 0 ; SDA's Data Segment
; Must be saved by the user upon
; entrance via INT 16.
SDA_SS DW 0 ; SAVED IN SDAKI BEFORE THE INT 16.
SDA_SP DW 0
SDA_BP DW 0
SDA_SI DW 0
SDA_DI DW 0
USER_SS DW 0 ; SAVED IN THE USER ROUTINES
USER_DS DW 0 ; THAT CALL EXEC.
USER_SP DW 0
USER_BP DW 0
USER_DI DW 0
USER_ES DW 0
IRLOC2 dw (8 + 2) * 4 ; Interrupt locations.
IRLOC7 dw (8 + 7) * 4
IRLOC5 dw (8 + 5) * 4
IRLOC4 dw (8 + 4) * 4
PUBLIC _CHECK4_SDA,_SDA_GETB,_SDA_PUTB,_SDA_EXEC,_SDA_RECON
PUBLIC _SDA_RECOFF
page
; _CHECK4_SDA
;
; *** DANGER *** THIS ROUTINE MUST BE CALLED SUCCESSFULLY (RET = 1)
; IN ORDER TO USE ANY OF THE SDA USER FUNCTIONS.
;
; If SDA interface (Midicard) interrupt handler is
; in place, this routine fills SDA_SEG & SDA_OFST with the
; addr. of USER_CALL.
;
; Returns: ax = 0 Handler not present.
; ax = 1 Is present - data filled.
;
; Regs altered - ax,bx,dx
_CHECK4_SDA proc far
push es
push si
push bp
mov si,[IRLOC2]
call SDA_MATCH
cmp ax,1
je GOT_MATCH
mov si,[IRLOC7]
call SDA_MATCH
cmp ax,1
je GOT_MATCH
mov si,[IRLOC5]
call SDA_MATCH
cmp ax,1
je GOT_MATCH
mov si,[IRLOC4]
call SDA_MATCH
cmp ax,1
je GOT_MATCH
xor ax,ax ; No match - don't use card.
jmp CHKRET
GOT_MATCH:
; si = int. vector offset.
xor ax,ax
mov es,ax
mov ax,es:[si + 2] ; Get segment of int. rout.
mov bx,es:[si] ; Get offset " "
sub bx,8 ; minus 8.
mov es,ax
mov ax,es:[bx + 2] ; Get USER_CALL segment
mov dx,es:[bx] ; Get offset.
mov cs:[SDA_SEG],ax
mov cs:[SDA_OFST],dx
mov ax,1
CHKRET:
pop bp
pop si
pop es
ret
_CHECK4_SDA endp
; SDA_MATCH
;
; This routine looks for the string "SDA " above the interrupt
; location indicated by the vector offset in 'si'.
;
; Returns: ax = 0 No match
; ax = 1 Match
;
; Regs altered ax,bx,es
SDA_MATCH proc near
xor ax,ax
mov es,ax
mov bx,si
mov ax, word ptr es:[bx] + 2
mov bx, word ptr es:[bx]
mov es,ax
cmp byte ptr es:[bx] - 4,'S'
jne matret
cmp byte ptr es:[bx] - 3,'D'
jne matret
cmp byte ptr es:[bx] - 2,'A'
jne matret
cmp byte ptr es:[bx] - 1,' '
jne matret
mov ax,1
matret:
ret
SDA_MATCH endp
; _SDA_GETB - If in sda record mode, get a byte from midi in.
;
; c call c = sda_getb();
;
; asm call call _sda_getb ; Byte or ret. code in ax.
; (far)
;
; RETURNS: byte
; 100H Buffer empty
; 2nnH Buffer overflow (byte in LSB).
;
; Regs Altered: ax,bx,cx,dx
_SDA_GETB proc far
push si
mov si,1
call DOUC
pop si
ret
_SDA_GETB endp
; _SDA_PUTB - send a byte (of a complete midi msg.) out midi out.
;
; c call sda_putb(c);
;
; asm call push ax ; Push byte on stack
; (far) call _sda_putb
; add sp,2
;
; Regs Altered: ax,bx,cx,dx
_SDA_PUTB proc far
push bp
mov bp,sp
push si
mov cx,[bp+6] ; Get parameter.
mov si,2
call DOUC
pop si
pop bp
ret
_SDA_PUTB endp
; _SDA_RECON - Go into SDA record mode.
;
; c call sda_recon();
;
; asm call call _sda_recon
; (far)
;
; Returns: non-0 No. of bytes allocated to receive buffer.
; 0 Fail - already recording or
; not enough memory.
;
; Regs Altered: ax,bx,cx,dx
_SDA_RECON proc far
push si
mov si,3
call DOUC
pop si
ret
_SDA_RECON endp
; _SDA_RECOFF - Leave SDA record mode.
;
; c call sda_recoff();
;
; asm call call _sda_recoff
; (far)
;
; Regs Altered: ax,bx,cx,dx
_SDA_RECOFF proc far
push si
mov si,4
call DOUC
pop si
ret
_SDA_RECOFF endp
; _SDA_EXEC - Call Promidi's multi-tasking exec.
; This gives Promidi a chance to replenish
; its disk buffers when playing.
;
; c call sda_exec();
;
; asm call call _sda_exec
; (far)
;
; Regs Altered: ax,bx,cx,dx
_SDA_EXEC proc far
push si
mov si,5
call DOUC
pop si
ret
_SDA_EXEC endp
; The DOUC sub-routine vectors into the Promidi software.
; The 2-word address must have been set up via a successful
; call to _check4_sda.
DOUC proc near
mov ax,[_SDA_DSEG] ; Get the SDA data seg.
db 9AH
SDA_OFST dw 0 ; USER_CALL offset.
SDA_SEG dw 0 ; USER_CALL segment.
ret
DOUC endp
code ends
END
successfully
;* (RET = 1). This routine binds the two programs together.
;*
;* If it is desired to h