{ A simple File To Keyboard transfer program
Written by: 28-May-94
Andrei V. Goryankin
Department of Computer Science
Chuvash State University
15 Moscow ave.
Cheboksary 428015
Russia
andrei@adm.chci.chuvashia.su
}
{$A+,B-,D-,E-,F+,G+,I-,L-,N-,O-,R-,S-,V-,X-}
{$M $400,0,0}
uses dos;
var old8 : procedure;
s : string;
i, max : word;
m : array[1..maxint] of char;
procedure int5; interrupt;
begin
i := 1
end { int5 } ;
procedure int8; interrupt;
var reg : word;
begin
asm pushf end;
old8;
if i <= max then
begin
if m[i] = ^m { cr } then reg := $1C00 { 'cr' scan-code }
else reg := $3900; { 'space' scan-code }
reg := reg + word(m[i]); { scan-code and a char }
asm
mov cx, reg { char to feed }
mov ah, 5 { AT BIOS function }
int $16
or al, al { accepted ? }
jnz @skip { no, will try again }
inc i { yes, select next char }
@skip:
end { asm }
end { if }
end { int8 } ;
begin { main }
writeln('File To Keyboard transfer program');
writeln('Usage: ftk < filename');
max := 0;
while not eof do
begin
readln(s);
s := s + ^m;
for i := 1 to length(s) do
if max < maxint then
begin
inc(max);
m[max] := s[i]
end
else
begin
writeln('Buffer overflow');
halt(2)
end
end { while };
i := maxint;
if max > 0 then
begin
getintvec(8, @old8);
setintvec(8, @int8);
setintvec(5, @int5);
writeln('Stay resident, press <PrtScr> to transfer');
keep(0)
end
end.
|