C
Program demonstrativ de folosire muzicala a tastaturii pe post de orgaProgram Taste_muzicale_V2; Uses Crt,Dos; Const Nota_Do:array[1..4] of integer=(33,66,132,264); Raport:array[1..10]of real=(24/24,27/24,30/24,32/24,36/24,40/24,45/24, 48/24,51/24,54/24); Nota:array[1..10]of string[3]=('Do','Re','Mi','Fa','Sol','La','Si', 'Do','Re','Mi'); CodT:array[1..4]of byte=(44,30,16,2); Type Pixel=Record atrib:byte; car:char; end; Var tasta:byte;i:integer; KbdIntVec:procedure; ecran:array[1..25,1..80]of Pixel absolute $b800:0000; Procedure KeyClick; interrupt; begin Port[$20]:=$20; end; Begin ClrScr; GetIntVec($9,@KbdIntVec); SetIntVec($9,Addr(KeyClick)); tasta:=0; repeat repeat until tasta<>Port[$60]; tasta:=Port[$60]; if (tasta>=CodT[1])and(tasta<CodT[1]+10) then begin gotoxy(5*(tasta+1-CodT[1]),24);write(Nota[tasta+1-CodT[1]]); sound( Trunc( Raport[ tasta+1-CodT[1] ] * Nota_Do[1] ) ) end else if (tasta>=CodT[2])and(tasta<CodT[2]+10) then begin gotoxy(5*(tasta+1-CodT[2]),22);write(Nota[tasta+1-CodT[2]]); sound( Trunc( Raport[ tasta+1-CodT[2] ] * Nota_Do[2] ) ) end else if (tasta>=CodT[3])and(tasta<CodT[3]+10) then begin gotoxy(5*(tasta+1-CodT[3]),20);write(Nota[tasta+1-CodT[3]]); sound( Trunc( Raport[ tasta+1-CodT[3] ] * Nota_Do[3] ) ) end else if (tasta>=CodT[4])and(tasta<CodT[4]+10) then begin gotoxy(5*(tasta+1-CodT[4]),18);write(Nota[tasta+1-CodT[4]]); sound( Trunc( Raport[ tasta+1-CodT[4] ] * Nota_Do[4] ) ) end else nosound; until tasta=129; SetIntVec($9,@KbdIntVec); End.
|