[comp.sys.ibm.pc] program to click the speaker when harddisk is accessed

mdlawler@bsu-cs.UUCP (Mike Lawler) (03/28/89)

Checksum: 1166874052 verify with brik)

     I'm having the following problems with the code below.  It's
purpose is to intercept activity of the hard drive and click the
speaker.  It locks up my machine with Norton's SI version 4.50
when I use the "C:" option.  It also causes the sound of the
speaker when the keyboard buffer is full to be a click instead of
a beep.  Also It compiles with MASM version 5.1, but not with
MASM version 4.0 or TASM.  Please email comments or suggested
changes to the source code.  Thanks for any replies.

Cut here.

cseg         segment  para public 'CODE'
             org      100h
             assume   cs:cseg,ds:cseg

start:       jmp     initit

old_disk      dd      ?

disk_init     proc    far
              sti
              pushf
              assume  ds:nothing
;       check if this request is for a diskette drive instead of for
;       a hard disk.  if it is, we aren't interested in it.
;
        TEST    DL,080H                 ; check if this is for hard disk
        JZ      no_bell                 ; exit if not
              call    bellon
              call    old_disk
              call    belloff
              jmp     disk_done
no_bell:      call    old_disk

disk_done:   iret
disk_init    endp

; This procedure produces a tone of a specified frequency
; Enter the frequency, in HERTZ, in DI (32 to 65000)
;
bellon       proc     near
             push     ax
             push     di
             push     dx

             mov      al,0b6h      ;write timer mode reg
             out      43h,al

             mov      di,32       ; freq

             mov      dx,14h
             mov      ax,4f38h
             div      di
             out      42h,al       ; write timer 2 count low byte
             mov      al,ah
             out      42h,al       ; write timer 2 count high byte
             in       al,61h       ; get current port setting
             or       al,3         ; turn speaker on
             out      61h,al
             pop      dx
             pop      di
             pop      ax
             ret
bellon       endp

belloff      proc      near
             push      ax
             in        al,61h
             and       al,0fch
             out       61h,al
             pop       ax
             ret
belloff      endp


initit:       assume  cs:cseg,ds:cseg
              mov     bx,cs
              mov     ds,bx
              mov     al,13h
              mov     ah,35h
              int     21h
              mov     old_disk,bx
              mov     old_disk[2],es

clockstart:   mov     dx,offset disk_init
              mov     al,13h
              mov     ah,25h
              int     21h
              mov     dx,offset initit
              int     27h


cseg          ends
              end     start

	      Cut here.



-- 
Mike Lawler         UUCP:  <backbones>!{iuvax,pur-ee}!bsu-cs!mdlawler
                    ARPA:  mdlawler@bsu-cs.bsu.edu