home *** CD-ROM | disk | FTP | other *** search
/ Power-Programmierung / CD1.mdf / batch / library / batutl2 / rebeep.asm < prev    next >
Assembly Source File  |  1988-04-20  |  1KB  |  66 lines

  1. TITLE    REBEEP    9-15-84    [4-16-88]
  2. ;Toad Hall Disassembly, tweak
  3.  
  4. LF    EQU    0AH
  5. CR    EQU    0DH
  6. ;
  7. ;INITIAL VALUES :    CS:IP    0000:0100
  8. ;            SS:SP    0000:FFFF
  9.  
  10. CodeSeg    SEGMENT
  11.     ASSUME DS:CodeSeg,SS:CodeSeg,CS:CodeSeg,ES:CodeSeg
  12.     ORG    100H
  13.  
  14. REBEEP    proc    near
  15.     mov    dx,offset prompt    ;'Press any key...'
  16.     MOV    AH,9            ;display string
  17.     INT    21H
  18.  
  19. ChekLoop:
  20.     MOV    AH,0BH            ;check kbd input status
  21.     INT    21H
  22.     CMP    AL,0FFH            ;anything there?
  23.     JZ    GotUser            ; yep, user's back
  24.      CALL    Beep            ;beep
  25.      CALL    Beep            ;beep
  26.      SUB    CX,CX            ;max delay time this loop
  27. Lup120:     NOP                ;delay a sec
  28.      LOOP    Lup120
  29.      JMP    SHORT    ChekLoop
  30.  
  31. GotUser:
  32.     MOV    AH,7            ;gobble user's keypress
  33.     INT    21H
  34. ;Just for laughs (and to add some utility), we'll return the user's
  35. ;keypress as Errorlevel.  (It's in AL right now)
  36.     mov    ah,4CH            ;terminate, Errorlevel 0
  37.     int    21H
  38. Rebeep    endp
  39.  
  40. Beep    proc    near
  41.     MOV    AL,0B6H
  42.     OUT    43H,AL
  43.     MOV    AX,06A0H
  44.     OUT    42H,AL        ;freq?
  45.     MOV    AL,AH
  46.     OUT    42H,AL        ;freq?
  47.     IN    AL,61H
  48.     MOV    AH,AL
  49.     OR    AL,3
  50.     OUT    61H,AL        ;sound on
  51.     SUB    CX,CX        ;max delay this loop
  52. Lup162:    LOOP    Lup162        ;sound on
  53.     MOV    AL,AH
  54.     OUT    61H,AL        ;sound off
  55.     mov    cx,4000H    ;delay a bit
  56. Lup18x:    nop
  57.     loop    Lup18x
  58.     RET
  59.  
  60. prompt    DB    CR,LF,10H,' Press any key to continue ...$'
  61.  
  62. Beep    endp
  63.  
  64.     CodeSeg    ENDS
  65.     END    REBEEP
  66.