| Код | {$M $800,0,0} uses crt,dos; const nb=15; {kol-vo spec.klavish}
type Pbu = ^Tbu; {tip "spec.klavisha"} Tbu = record name: string; code: word; end; var b: array [0..nb] of Pbu; {massiv spec.klavish}
var OldCode,OldFlag:Procedure; {starie vectora prerivanii}
key,oldkey:word; flags,oldflags:word; y:integer;
procedure InitFuncButtons; {opisivaem tip dannix dlya spec.klavish} begin new(b[ 0]); b[ 0]^.name:='RightShift' ; b[ 0]^.code:=$0001; new(b[ 1]); b[ 1]^.name:='LeftShift' ; b[ 1]^.code:=$0002; new(b[ 2]); b[ 2]^.name:='AnyCtrl' ; b[ 2]^.code:=$0004; new(b[ 3]); b[ 3]^.name:='AnyAlt' ; b[ 3]^.code:=$0008; new(b[ 4]); b[ 4]^.name:='ScrollActive' ; b[ 4]^.code:=$0010; new(b[ 5]); b[ 5]^.name:='NumLockActive' ; b[ 5]^.code:=$0020; new(b[ 6]); b[ 6]^.name:='CapsLockActive'; b[ 6]^.code:=$0040; new(b[ 7]); b[ 7]^.name:='InsActive' ; b[ 7]^.code:=$0080; new(b[ 8]); b[ 8]^.name:='LeftCtrl' ; b[ 8]^.code:=$0100; new(b[ 9]); b[ 9]^.name:='LeftAlt' ; b[ 9]^.code:=$0200; new(b[10]); b[10]^.name:='SysReq' ; b[10]^.code:=$0400; new(b[11]); b[11]^.name:='PauseKey' ; b[11]^.code:=$0800; new(b[12]); b[12]^.name:='ScrollLock' ; b[12]^.code:=$1000; new(b[13]); b[13]^.name:='NumLock ' ; b[13]^.code:=$2000; new(b[14]); b[14]^.name:='CapsLock' ; b[14]^.code:=$4000; new(b[15]); b[15]^.name:='Insert' ; b[15]^.code:=$8000; end;
procedure Show; begin asm cli end;
for y:=0 to nb do begin if (flags and b[y]^.code)<>0 then begin textcolor(10); gotoxy(60,y+3); writeln(b[y]^.name:15,' ',b[y]^.code:5); textcolor(7); end else begin gotoxy(60,y+3); writeln(b[y]^.name:15,' ',b[y]^.code:5); textcolor(7); end; end;
gotoxy(1,3); write('OldCode ',oldkey:5,' Code ',key:5); gotoxy(1,4); write('OldFlag ',oldflags:5,' Flag ',flags:5); gotoxy(1,5);
asm sti end; end;
procedure CodeSound; begin asm cli end;
if key=oldkey+128 then begin Sound(5000); Delay(5000); Nosound; end;
asm cli end; end;
procedure Flag;interrupt; var y:integer; begin asm cli end;
oldflags:=flags; flags:=memW[$40:$17];
Show;
asm sti end; end;
procedure Code;Interrupt; var y:integer; begin asm cli end;
oldkey:=key; key:=memw[$40:$1C];
Show; CodeSound;
Inline($9C); {PUSHF} OldCode;
asm sti end; end;
begin clrscr; write('OS - lab1'); InitFuncButtons;
GetIntVec($9,@OldCode); {sozdaem novii obrabotchik prerivanii} SetIntVec($9,@Code); {perenaznachaem tekushii obrabotchic na novii}
GetIntVec($1C,@OldFlag); {sozdaem novii obrabotchik prerivanii} SetIntVec($1C,@Flag); {perenaznachaem tekushii obrabotchic na novii}
keep(0); end.
|
КНажимаю скомпилировать ctrl+F9, не компилируется выдает NOT ENOUGHT MEMORY. Нужно скомпилировать. |