[email protected] 多谢了,接着呢

解决方案 »

  1.   

    不好意思刚才忘了贴程序:procedure sound(dFreq:double;wLong:word); procedure TForm1.sound(dFreq: double; wLong: word);
    var wFreq:word;
    begin
      wFreq:=round(1192576/dFreq);
      asm
        push ax
        push bx
        push cx
        push dx
        push di
        mov al,0b6h
        out 43h,al
        mov dx,12h
        mov ax,wFreq
        out 42h,al
        mov al,ah
        out 42h,al
        in al,61h
        or al,3
        out 61h,al
      @wait1:mov cx,wLong
      @delay:loop @delay
        dec bx
        jnz @wait1
        mov al,0b6h
        out 43h,al
        mov al,ah
        out 61h,al
        pop di
        pop dx
        pop cx
        pop bx
        pop ax
      end;    
    end;procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word;
      Shift: TShiftState);
    begin
      case key of
        49,97:sound(261.7,8000);
        50,98:sound(293.7,8000);
        51,99:sound(329.6,8000);
        52,100:sound(349.2,8000);
        53,101:sound(392.0,8000);
        54,102:sound(440.0,8000);
        55,103:sound(493.7,8000);
        56,104:sound(561.7,8000);
      {  49,97:sound(261.7,8000);
        50,98:sound(293.7,8000);
        51,99:sound(329.6,8000);
        52,100:sound(349.2,8000);
        53,101:sound(392.0,8000);
        54,102:sound(440.0,8000);
        55,103:sound(493.7,8000);   }
     //   49,97:sound(261.7,8000);
      end;
    end;