home *** CD-ROM | disk | FTP | other *** search
- IFNDEF TP4
- PAGE 60,132
- ;----------------------------------------------------------------------------
- SUBTTL TesSeRact Revision Level 1
- ;-----------------------------------------------------------------------------
- ; TesSeRact(tm) -- A Library of Routines for Creating Ram-Resident (TSR)
- ; programs for the IBM PC and compatible Personal
- ; Computers.
- ;
- ;The software, documentation and source code are:
- ;
- ; Copyright (C) 1986, 1987, 1988 Tesseract Development Team
- ; All Rights Reserved
- ;
- ; c/o Chip Rabinowitz
- ; Innovative Data Concepts
- ; 2084 Woodlawn Avenue
- ; Glenside, PA 19038
- ; 1-215-884-3373
- ;
- ;-----------------------------------------------------------------------------
- ; This product supports the TesSeRact Standard for Ram-Resident Program
- ; Communication. For information about TesSeRact, contact the TesSeRact
- ; Development Team at:
- ; Compuserve: 70731,20
- ; MCIMAIL: 315-5415
- ; This MCIMAIL Account has been provided to the TesSeRact Development
- ; Team by Borland International, Inc. The TesSeRact Development Team
- ; is in no way associated with Borland International, Inc.
- ;-----------------------------------------------------------------------------
-
- INCLUDE TESS.INC
- INCLUDE mixed.inc
-
- .MODEL small
- .CODE
-
- ENDIF
-
- IFNDEF ASMCOM
-
- hProc <TESSBEEP FAR> <USES SI,DI>
- call error_beep
- hRet
- hEndp
-
- ENDIF
-
- ;*** ERROR_BEEP *************************************************************
- ; This routines sends a beep-beep to the speaker; it is called when *
- ; Ringmaster determines it cannot pop up for any reason whatsoever. *
- ; *
- ; Registers Modified: *
- ; AX, BX, CX, DX trashed; all others unmodified *
- ;************************************************************************CR*/
- IFDEF ASMCOM
-
- PUBLIC TESSBEEP
- TESSBEEP:
-
- ENDIF
-
- error_beep proc near
- pushf
- sti
- mov cx,420h ;start at high C
-
- sound_again:
- mov dx,12h
- mov ax,34dch
- div cx
- call speakeron
- s10:
- mov ax,1 ;put counter into delay loop
- call timer
-
- cmp cx,300h ;are we at middle C?
- je exit_sound
-
- sub cx,30h
-
- jmp short sound_again
-
- exit_sound:
- xor ax,ax
- call speakeron
-
- POPFF
- ret
- error_beep endp
-
- ;*** SPEAKERON **************************************************************
- ; Routine to turn the speaker on or off at the appropriate frequency *
- ; (passed in AX). If AX is zero (0), the speaker is turned off; *
- ; otherwise, the speaker is set to the appropriate pitch. *
- ; *
- ; Registers Modified: *
- ; AX trashed; all others unchanged *
- ;************************************************************************CR*/
- speakeron proc near
- push ax ;save frequency
- in al,61h ;get current port setting
- and al,0fch ;setting to turn off speaker
- out 61h,al ;turn off speaker
- mov al,10110110b
- out 43h,al
- pop ax ;recover frequency
- cmp ax,0 ;is it = 0?
- je sp10 ;if yes, just exit
- out 42h,al ;output low order byte to port first
- mov al,ah ;prepare high order byte for out instruction
- out 42h,al ;output high order byte to timer port
- in al,61h ;get current port setting
- or al,3 ;turn on two low order bits for speaker on
- ;under control of timer port
- out 61h,al ;turn speaker on
- sp10:
- ret
- speakeron endp
-
- ;*** TIMER ******************************************************************
- ; Provide a timed delay of 1/18.2 second intervals. Delay count is passed *
- ; to the function in the AX register. Maximum delay possible is *
- ; approximately 14 (255/18.2) seconds. *
- ; *
- ; Registers Modified: *
- ; AX, BX, DX trashed; All others preserved *
- ;************************************************************************CR*/
- timer proc near
- push di ; save registers
- push cx
- or ax,ax ; make sure we have a value
- jz tout
- mov di,ax ; save counter
- xor ah,ah ; see what ticker says first
- int 1Ah ; CX:DX is starting point.
- mov bx,dx ; save initial low order count
- tloop:
- xor ah,ah ; function to get timer
- int 1Ah ; get timer tiks to CX:DX
- cmp bx,dx ; see if low order has changed
- jz tloop ; if not get it again
- mov bx,dx ; update bx with new low order count
- dec di ; --interval
- jnz tloop ; if not down to 0
- tout:
- pop cx
- pop di
- ret
- timer endp
-
-
- ENDIT
-