You are on page 1of 50

Advanced

Topics for DOS


C DOS



    !"#$ %& %'($#)  
* &+,&  &-$
 .   & !/01% 2
$-   0 ,1% "#! -!/ &% 
-32 2&   "#
 & 0
 $ *#- %   &4-$11 "
# &* 2
 & 
$*#-2#5 "#
 & 2") 2-$& 5 . % 

)  
+,1
* $!)6&  %
7  0) ,-)
8$))+$0)-$5)++-
) / 
9:;<=>?<@A<ABAC79AD7E;F7<E7GH



          !"#$%& 
'( )&*+,!-. /0&   1(".&22!3456%
7"!89)94:,;<=>?6@<A:BCA;<<DEA5 !- 0
  " & 0   .
  !""+FG;HA+<=;CA;I  

  
" 0  (
95 7 )7 !J)) )K9)4 "L
 0
& !& 742.5  0(     ".&0&) !& 74   !7
9  L5
/0&!-9 .5
 
  ..(.&  
95 9  5
0) ! 
   .K($       
0&  
0".5!& 95  . 1 )(

4 49)$4 )
#)7)K9)4
3&)KK4).7 
MNOPQRN



ST 7 *+,UB+,,;<V=H;W@DA=C;


PT6%BCA;<<DEAXYBCA;<<DEAX5 6%
MTZ,W6<@[<>\\=C[]  !"^_0
RT6%`;aF@><I*=<;HAbHH;XX
QT6%,;<=>?6@<A6<@[<>\\=C[Y .6%,;<=>?6@<A
cT+FG;HAY+<=;CA;I6<@[<>\\=C[DX=C[%dd
fTg;hi;>AD<;X=C%dd

S
R
SM
PM
MM
Me
RM



   




   




    


    "! #$%!& '()*+ ( ,+)*-.,+/0+#,!1%2,' 134-.,+)50+(&67%8-.,+ (,(4"9*,!-/!" ) 7--%:.-!/.,+ ; /!"40+<0
,+9"!"5+97--),+9+4,+$=5>9*'?5,+6!3,+6@+A'+BC)0"4"+'6D+)E%,FC
 #%8/*GH -.,+/0+#)50+(<& "0 4D+"4"+'B73",)*,!-1%2,'/0+#%840+'+,A+7$'0
/*$% D++)3H0+/0+#6+,I JK 134/
,+(4,<*+-.,+/0+#9!&67 D+134<* LMK  /!"40+@+N+
LO J,+<*D+B! PQGH)5!,,+ D++9'!,R'3 (/*,+(4,<*-.,+6+,,R
)*B*+LMK  9H& 2577-E,+ +D + /( * ,+134,+,D+)3)'+459 )*S?,/*
<0   )'+459 TU %8-.,+,(4 ",!-6@+A   )'+454 VVU %8-.,+,(4 ",!WL
%8/*GH 0+/0+#)50+(6& 7/**3?6+,?'0  ,+1%2,'W;))!B # ( ,(4 "
9*
,6+,,+,D+)30+)'+459   25*" 67/*,D+)3)'+459 M  L  3*"4 A+7
)H#67'(-.,+4044?0)5+4-.,+<0-.,+,(4",!-6@+A,R67%7,-3*"4M  L ,+
/!& WLJ2B3X5,+0+/D+2)0
L,+,D+)3/D+2)0
L%8/*,6+,(2& /057M  L
+6'(,+B0)!-0+7)"0+1%2,'257M  L <0,+,D+)3/D+2)0
L,R67/*-,3*"4"0+
/*,+)*
L$%4?0 )( 5!,2572S"3-6@+A%8/*0+/0+#)50+(6& 7/*,D+)3$"*(6B. /C
93!/!"40+,+,D+)3/D+2)0
L-6@+A?% (

  
 







TY

ZLK

0+ /( * ,D+)3





0+ 6( 7$3*!-




TT


LO[

     
 
 !"#$"




 


!
"#$%&'()% * %*%+ ,
%.$%"/ 0)
12
%3%+ 
4 567

8
%%*%+ *(0(,
%-*99:$0  (


,
%-;*
<=7
>?( #9:$9*,
%-.$%
@2
9
@A
0,
-*;
 
B CD
%9+ $# .-*;

%"/ 0)
1E
BD+)!-,+9(41%2,'134<*@+N+  LO J ,+,D+)30+/0+ # )*,!-(6.B/C!&
B+'+S<* \ L Z]^GH;M $"*;_I$3* 3!<0/!"40+1%2,' ( GH2B3)*)RSH,+
,D+)3/D+2)0
L)*4?0 2S" ( T257)5!, ( VT
#include <stdio.h>
#include <dos.h>
main()
{
union REGS regs;
regs.h.ah=02;
regs.h.dh=10;
regs.h.dl=30;
int86(0x10,&regs,&regs);
}

% &  '   ()*+,-./!0123$0  


 
 !"#$"
6+,1%2,' (  67)R".`,( +,D+)30+)*,-! (6B. /C134<*  L  Z]^ GH   L  (6& 7
B+'+S,D+)30+)*,!-(6.B/C$3* !&)'3a/!"3*"4,!bcdcdc257;c(6.B/C/0+#)50+(&67
%7,-$%3e"4H-257H50+40+57fgGH,+,D+)30+)*,!-(6.B/C)50+(&!&B+'+S D+$3*
B2--
! (6B. /C
,D+)30+)*,-

5( 7H  <0/!"40+1%2,' (  $3* +D ,+,D+)30+)*,!-(6B.


/C;cH -;I)*%8T257;cH 50+;h)*%8VT

! (6B. /C
,D+)30+)*,-

&! /!"GH 67*+SH(6B. /C134<*/"! i2 /!"U<0j


_i_ i,R67
%8,+*+SH(6.B/Cbc !&H-257H50+

9*B!,/E(,40+)H91%2,' (   ,+(4,<*+  M  L  !&67 D+,+B0


bJJ

9 L $%4!M  L ! 67/*B0 )'+4klm)*+ L B',6+,!& 


D+B!  PQTiTdlj
dlj
!& 67B0bJJ

9 L j
$%Y!& )/EX5,R bJJ

9
 L /!"2,67<*,+B00+$%4!M  L B0"bJJ

9 L /!" (B67 D+,+!-0+ ( M  L


B0,5!-'+-+M  L +6$'0'(,+B00+,5!-'+,R$3*
M  L -+/!"+6/*,+<*6( B. /C,)6+, '( (  L Z]^,R$3* GH ,F((&
67B+'+S<*
 Z]^9*+'+<0"4B.'GHZ]^(&67B+'+S*+SH(6.B/C$3* a/!"3*"4,!
]dd257;6+,Z]^(&%8
 3!!&6H$'0'(,+2-0(6.B/C)50+(&,%8
H-,!-H50+)' Z]^  M  L  (67/*<*''(,+,D+)30+ Z]^  PQi /!"
40+,+<*+<0 PQiTiYdlj
dlj
dl
j

,+<*+M  L !& '(%714<C'+,A+7<0"4)*,+9(41%2,'0+49H& ,6+,!&
4!B+'+SD+1%2,' (9(49H&$%<*,!- ('(1B*+@+4 (2/,/0+,!$3*(,3*"4 A+7SH2'*"0+
1B*+@+A9 67/0+,!2/0,+<*+  !& 674!)',!4?0 SH2'*"+0 ,+<*+
Y

M  L !& 670+4,R/+'2/0,'R 9( * B(4 B( +D !n4?,0 R  "+'R",+ +D +9M  L !&
09*+/D+S*+1%2,' (9(4!&/*,+"+'R",+ D++B?#,R67$'0)'+7 (67<*M  L

V

  

 

 

     

    
,+   !& ,R,+9!36!)"7,+ +D +%,/.9 \ A )*$% +D +40+ /+' (
 !& /*,+) ( +(4,"0+  ZL Z' +D ZBR625*"\,R67
,5!-$% +D +3.' ( +* $"*/0 )'$'0'( 7$,.39H& %,/.25*"  67<*   A )*%E ,FC
-9*+\)1%2,'B0"#B+'+S (679*+'+ D++2 ,,+ D++%,/.9\$3*13467
2-0 ,%8Y%7@

  


  <.3(& %8   ( ,.39H& 6+, E%,FC-9*+ \ !$3*2,0 o ;  /0+#
E%,FC)50+(6& 7<*   A A.' %7B. `.@+A,+ +D +9  A+7E%,FC)50+('& ,! 67
D++<*+,"0+ \ '+, 134,+<*   +67,2--)*E%,FC,50+(&/.3/0,!- \ '6D+%8
 +0 !&  !  67/.3/0pA+7"5+ A
( *'!-)B09*'?5 +0 !&  <0""5+ # \ 67%8.B7257
B+'+S D++#$3*
E%,FC)5+4# <.3B+'+S (67   \ $3* 134E%,FC2/057/!"67<* )'+459
  $( '0)',! A )* \ ?"* +0 E%,FC3%8/!" (   9*+'+ 2575, +D +$3*S,? /*
 67'()'+459 4?0 &! )'3q)'+459P)'+459BD+)!- cr2/0 
6+,\/7,?5cPQ67'(9+ 4?0 A(49+3(4"3!!& 67/*<* I JK A.sN9*+'+<0"4134
67<*U PYqtb L g L LOO/!"PYqt(&67B+'+S!- 9*+'+$3*P)'+4
59Tu13467B+'+S6!3 L g)*,-!  59/0+#$3* GH %,/.25*" T67'(  L gB?
BE3257 u67'( L g/D+ B( 3E
 4E/*#crPTPP67<*PYqtA(4/!"3(4"2/0 E0 )5!#br67<*Y/!"
A A.' 6D+ " 5!,NF7,+/0< 'PYqt$3*2B3$"*?% ( 

a






























    !" #$%&' ( ) *+,-.+,/ 012/,,342


6+,?% (  67)R$3*"+0    Y 9 PYqt /!"2,67S?,<*A"0 ,!- PYqt /!" ( Y +D )*'(
  ( <*$3* &! )'3q/!"TddVq675!,NF7,+/0(6& 7 +D )*  Pq'(  L gB?,"0+
 VuA+7'!/04?,0 -!  Y
)'+459   )50+(B& "0 )n067S?,6$"*<*+25*" 2/067)5$"*-+)'+459A )*+
D+$%<*,F( '( ,( +B0I JK A.' /.'9*+$% <0L J J)hbv J%8/*/+
+/0$%(2& B)*)R,+<*+ 9  "! #$%
Zw
T

Y
V
a
q
Q
u
P
t
T

Y
V
a
q

LMK  


TiTP
TiTt
TiTb
TiT
TiT
TiT;
TiT]
TiTy
TiuT
Tiu
TiuY
TiuV
Tiua
Tiuq
TiuQ
Tiuu

;
  L
g
[ [
xgfL J
 ML[
 L J
WY
W
yOLgJ
z
hr
Z O [ OL z

oY[L

LL 

L
I JJ
z

' ,.3 9H& PYqt &! B/!"67/"6B-3?"+0 '( 3 +D +4?)0 $'0S*+$'0''( ! ,R
67 \ ! 2( /0S+* '(  ,( +D 5! +D +4?'0 ! ,R67/"63?"+0  3'(  L gB?,"0+
q

S*+/!")'0 ( 9*+'+B?,"0+'!,R67 \ +/9*+'S*+ L g/D+ ,"0+'!,R67$'0 \


S*+)+,"0+PYqt/!3B.667 \'!,R67B0B!nn+Fvr$%4!\257B0)'+459LMK 
$%)* A )* \ +D +/+'Z ( )'+7B'/0$%+457(439LMK  67$3*
,50+"SH)!"9*S!3$%
+B+'+S 6( 79(41%2,' +D ,+ ;
fO   /!"3# ,R$3* 134,+0+o9(40+$%4!
[
zj
9PYqtGH 4?0 ( LTiY257TibBD+)!-PYqt/!" ( 257Y/+'5D+3!-2/057f 
L(6& 7<*2B3BS+79 "0+ fO)J
fO134T{] fOd{;
fO/!"40+
1%2,'@+N+/0$%(&67 D+,+ 35J
fO 9xgfL JGH67 D+)*+$'0B+'+SA.'AC
0+3#9*+$%$3*

Q

/*

This program shows an example of how we can disable Hardware


Interrupts. The 8259a PIC chip mask register is located at port
0x21. We can read or set values in this register.
In this example we mask, or disable, interrupt number 1, by
forcing the value of bit 1 to 1. Then, we test if we can still
type characters in by using bioskey function. If no key has been
pressed, which in this case we disabled it, it will print the
sentence "You are too slow". Else, it will print the character we
typed.
After testing we must restore the old mask value to port 0x21.
Unless you want to lock the machine :-)

*/
#include
#include
#include
#include

<stdio.h>
<conio.h>
<dos.h>
<bios.h>

void main()
{
char test;
long int i;
char OldMask;
clrscr();
OldMask = inportb(0x21); /* read the old mask value */
outportb(0x21,OldMask|2); /* disable keyboard interrupt */
printf("Enter a character: ");
for (i=0;i<100000;i++)
/* try to detect key stroke
{
if (bioskey(1) != 0 )
{
test = bioskey(0);
break;
}
}
if (i==100000)
printf("\nYou are too slow");
else
printf("\nYou typed %c",test);
outportb(0x21,OldMask);

*/

/* restore the old mask value */

% &   &%5 -67+89/ :;< /1+89/ *+,-.+,/ 012/,,3427

u

 !" 

 %7@ ('& ,! 67,.39H& 6+,1%2,'! 1%2,''C%8B! )*,.39H& LMK 


 ('& ,! 67<*' +/*,+9-.,+6+,<090+9*'?56+,zgfL J)5 /D+2)0

L-6@+A%8/*134%,/.25*"67'(LMK  4?0 Y%7@ 

# $% 
;L
'(-.,+/0+#)*,!-LMK 4?0'+,'+4$3*2,0
&'  ( %8 ;L
   ( <*+,!'+, B( 3E  13467'( M  L  404)*5,<*+4?'0 +,'+4
%7'+FTTM  L 1%2,''C675,<*+257!-B00+,!-M  L X0+j

9 
,6+,(2& 5*"4!'( vrYTIdYYIYuIdY]IdYyIdVVIdQTQuI2/067$'0,50+"SH ( &( 4,"*
 QTQuIGH %8  ( ;L
6$"*A )*1%2,''C+D $%<*+$3* )A?3(,40+,R
%8  "( +0 4?0 ! vrQuI67S?,<*S*+ !& '(,+<*]W; 

) )% 

- W  fL J 9   ,E /!"67'( ZW  4?0  ('& =
( | ,C<! ,+ +D +)*4?0
)5+4/!" ('(%714<C GH=|,C<!)50+(&67,(4"9*,!-,+"-E' U JK  73!- (/D+,"0+ ;L

 
".`,( +<*+    !& 67)',!-,+<* ;L
   ,E 40+ A(42/0"+0  ,+
+D +9'!679H& 4?,0 -! E0 2574() * 9!& #3!!& S*+)+,"0+ 9+<*  $( '0<0 
L[  fOTT},R+6'(,+ +D + 2( /,/0+,!$%$3*2/0134 "! $%25*" ,E E0  %|66E-!67'(
,+ +D + ( )'#,!)'3
 9!&$3*2,0vrqIdTbIdIdId;Id]I257yI
+457(43,+ D++9  !&)'3 (,50+"SH(&B+'+S*257sH,N+$3*6+,)!Bk"'
9*'?5BD+)!-1%2,''Cm134 '1~2,dW L
LM

))!B;L
Lj [[ j #

  *+! ',- . $% //!0 -0!


' ,.3 9H&  67/*)4E3,+ +D +%|66E-! 25*"$% +D +/+'Z9  (
9*+'+ 67 +-/D+2)09 Z )0"4"+'6D+$3*134,+ 3?/++ ((4,"0+    L
r fOr/++(6& 74-,"0+LMK  )'+459)H #'( Z4?0 ( W[Lg/D+2)03
3!/!"40+?% ( Y

P

  4
= 5#5 012/,,342
+ +-25*""0+1)'3,+ D++%,/.9;'!67')RW[LgA(4Wj fg 0+
!&  13467'(,+6!3,+ W[Lg (2& -- j[   L  2-0)0"4"+'6D+,%8 j[  2/057
j[ '(9+3Qaxfg25767)5',!-j[ ,0)*+4?0 Qfg +D )*'( j[  ( %8$%
$3* &! )'3Qaxj[ "5++67*+SH9*'?5 /( +D 2)03#[[Lg+67/*-,bJJ


?%9j[ MM
134 ( MM
/D+2)0@+4j[ !& #<0TTTTTTq67)'+4SHfg
( q
j[  ( )S*+2%5,'+%8Ug
O JJ

25*"67$3* +0 ,!-qU! ,+2-0


[[Lg2--
j[ (& +D )*+/*<* JJ

9+3afg,+*+SH9*'?5[[Lg
 !& LMK   ( %8$%$3* &! )'3'( YqQ)'+459TYqqB. ( r,R JJ

9ZGH 67<* afg/0)H  JJ

3!!& YqQ JJ

67<* &! )'3TYaaTTU


fg/++r(&67.'/* ( [[Lg/D+2)0TTTTTTTT3!!&TYafg2,9)0"4"+'6D+67
S?,<*%8r3!2B3?% ( V

t

TTTTTTTT
TTaTTTTT
TTqTTTTT

  Lr fO


;  b
; J; ; 

Z
J rZLj [

\
Lj [

bTTTTTTT
yTTTTTTT

\W
dZ
J[[Lg
ZW

  5: (5 >/?@,A >+4 #5 BCD 5 E


&D FG
6+,?%9e+/* W[Lg  Wfg 9  67S?,2-0,%8 Y B0")5!,#  L   L O
W[Lg)QaTxfg2,257\W[Lg)VPaxfg ()5)0"4"+'6D+QaTx!&+67
<*BD+)!-1)531%2,'<*+9
2/06+,?%+67)R$3*"0+-+B0"67S?,<*$%25*"$3*2,0
6,789::::::::2$::5:::;;<6  Lr fO! 
6 +,-. =>2> ?"@> 9::A::::: 2$ ::A:::;;< 6 %8A& (,R-0+,+ D++257 BS+79

6=-.>0B=@C31@="3C@"6; /0+# (
OL J9H&'+L M j_
g
'(9+3$'020
"' &! ;L

g
[3*"4 L[[ J_ L[d L_
g
d[
JL
_
g
GH 67,R-Z9;
 +$"*3"* 4
68.DE"$F">G#61%2,' ( 
OL J9H& '+257*+$"*[[Lg Li _f '(
9+3$'020
6H#@"E"$F">G6[[LgB0" ( )5)*,-! Lj [/0+#9X?* <*! 
BD+ )!-VPaxfg ( )5!& ,R672-0,%8YB0"
6HI+JD@#@"C@B9?::::::6K:::;;;;<[[LgB0"(&-+B0"67S?,6134U JK 
<0  JL J B0" ()5+6S?,<*134 g
[ Lj [ -+!& [[Lg B0"(&67
)5"0+4?0 +B+'+S 6( 7D++ ;  ;  ) rZ 9*+'+$"*$3* 134<*D+B!
; U jUdhL JU jU L M j_
g
257 Li _f /+'5D+3!-
6 D-I +,-. 9;::::::: 6 ;:::;;;;< [[Lg B0"BE3 +* 4(&  B0" ( ,R- Z 9 
 

1 234  56+ 7!6


6+,)!"9* 2( 5*"+ +-"0+' ,.3  9H&   67/*$% +D +/+'1%2,'9 Z
B' /!" Z (&+B+'+S D+,+9(41%2,'9H&'+2  ()%!-%E93.'$3* GH67 D+)*+
T

B+'+S"-E',+ D++9',.3   9H&$3*/+' (/*,+ )!"9*(&67,50+"SH)5!,,+


-& /*,+9(4Z2--0+4#
,0 +67/* +D "+'?6* ,! ,!-xgKLJ GH %8xgKLJ '( ( <*LO JorfL
/!"xgKLJ (B& +'+S<*,+%7,+s=|,C<! )*%8Z)%7,+sL  <( $&( %4!Z,R
$3*/!"40+,+%7,+s !&B2--'(3!(&
void interrupt NewKey(void); /* ISR Function */
void interrupt (*OldKey)(void); /* Pointer to ISR */

D+B! 2, ' +%7,+s=|,C<! )*%8 Z 25*"  ( &(  =|,C<!  vKxgL J +,R
B+'+S D+,+9(41%2,'=|,C<!!&$3*)'=|,C<!%,/.`'3+ !"$%
BD+)!-L  <( $&( %4!Z !& +67<*,+,R-/D+2)09 Z 3.'9  !&  #
257(4,<*=| ,C<! )50+!& ' 6D+ %8 134%,/.25*"+67.4' (4,<*+ Z 3.'97--,0 6( 7
+D +/+'Z)'0 ( 9(49H& '+
' +9(4 Z )'0BR625*"+,R67/* +D ,+%5(4 2%50+ r A )*'! <($& %4! Z
)'0 ( +9(49H& 134D+B! ( +67<*,+0+2579(40+9*+$%r!& $3*2,0j 257
 

1%2,' 2( B3/0$%(& %81%2,'Z/!"40+GH 2B3)*)RB0"%7,-BD+!n/0+# 6( 7
/*'(
#include <stdio.h>
#include <dos.h>
void interrupt (*OldKey)(void);
void interrupt NewKey(void);
void main(void)
{
OldKey = getvect(0x09);
setvect(0x09,NewKey);
}
/* An ISR for Interrupt 9 (Keyboard interrupt) */
void interrupt NewKey(void)
{
OldKey(); /* call old ISR */
/* our ISR program */
}

% & 4 &%5# 0HI


1%2,' ( Y(2& B3)*)RSH,+%5(4 2%50+  Lr fO134  (
<*%8/!"40+(&   )'+459tGH %8 9zgfL J1%2,'[ $3* +D ,+0+
0+ r 9  t 134<*=| ,C<!  j  257,R-X5 $( 3*GH /D+2)09 Z 3.' $"*
OJxg )5!6+,!& ,R +D ,+2,*$90+ r 134<*=| ,C<! 
  GH /!"40+,R%8,+,D+ )3
/D+2)09=|,C<!vKxg9*+$%/++r2  (0+3.'9'!GH+,R-BD+$"*25*"/!"2%
OJxgB0" ( )591%2,',RB0"9=|,C<! vKxgGH +D )*+ ( %8Z/!")'0 /!"40+


=|,C<! (6& 7 +D ,+(4, Z /!"3.')* +D +,0 )5!6+,!& 6H04 +D +/+' /( * ,+/0$%  X5 $( 3*
6+,1%2,'(&  ,E !& '( ,( +,3xgfL J=|,C<! vKxg67S?,(4,<*+
,+9(4Z!& '(9* 6D+,!34?A
0 B'"D+B! ( +67<* Z !& $'0B+'+S<*+D B! '( (
,+6)0"4"+'6D+2--;g [ $3*! <*+D B! [ OOL $'0$3*! 257 6+,'(+D B!  #(,
)5+4D+ B! '( ,( +<* [ OOL  +*'4?0 <0 Md
M257D+ B!  # ( ,(4 "9*,!-o6H$'0
B+'+S<*D+B!)50+!&$3*<0,!

Y


1 234 891:;<=>?@ A B?4 ?:C


   
    
  


1%2,'<*+/0+ # '( ( 4?0 &!  S*+2-0/+'5!,NF7,+ +D +257,+<*)0"4"+'6D+67


B+'+S2-0$3*%8B%7@ 3*"4,!2--2,1%2,' ($'0|/!")0"4"+'6D+GH%81%2,' (
?6* ,! 257<*+,!'+, B( 3E   1%2,'<.3(& ' 6-,+ +D +67$'0 &. /!"$"*)0"4"+'6D+ A )*
B+'+SD+ )0"4"+'6D+)50+!&$%<*,!-1%2,'#/0$%1%2,'2-- (B1%2,'|/!"
)0"4"+'6D+1%2,'%7@ (& ' S?,(4,<*+'!67*+/!"'!$"*)0"4"+'6D+25*"B0,+"-E'
,5!-$%)*,-!  ; 1%2,'<.3(6& 7 +D +,R/0 ' '(B. ,7/E* ,.39H&  <0 '(,+,3%E' )H %E' 3-
zgfL J),.3B!nn+F 9*+'+6+,E%,FC/"! 3/!")H %8/*1%2,'<.3(6& 76)0"4
"+'6D+-+B0"$"* +D )*1%2,' $'0B+'+S 6( 7<*)0"4"+'6D+)50+!& $3*
)5!,,+9(41%2,'2--|/!") rZ ($& '0$3*-! "+'B6'+,!,/2, ( +D ,+,
2--;A+7X?*,2--;/*,+)* ;%87--%:.-!/.,+ D++$3* (5740+) (57)H
+ +0 !& 3!!& 6H$'0$3*',( +`.-+4SH,+9(41%2,'<.3($& "*,B+9;2/0/0 '+;$3*
A!+'+,9H&257'(1%2,''C-+,5E0'$3**A-"+'B+'+S (67 D+)*1%2,'|/!"4?0)0"4
"+'6D+$3* +D )*,+9(41%2,'2--(& .' %8 ( 4. ',!'+,9H& 2/040+$,R/+'4!$'0''( +/+9".`(
,+9(41%2,'2--(& ,'+ )5!,,+ 6( 7<*/0 $%(6& H %8A(4".`,( + ( 4. '<*257< "0+'(1,+B,.3
%|n)+$3**4 B( 3E  +0 !&

.>1DE.9<FAG3C 1HI2JK C1891: ' 7


1%2,' rZ %81%2,' ( | !"4?0 )0"4"+'6D+ 257B+'+SS?,,7/E* )* +D +$3*
)5+4#".`( 2/0B"0 '+,67<*I JK  %8/!",7/E* <0134,+,3%E' )H %E' 3-zgfL J
)134
g
[ [%8/*GH9F7 ('!S?,,7/E*!&;+6,D+5!!1%2,'4?0,R%8$3*GH
1%2,' rZ 67 +D ,+   1%2,')50+!& )*)4E3,+ +D +9'!$"*<"! +"A )*/"! '!
B+'+S D++$3*'rZ D++BR61%2,' (S?,)4E3$"*6H67B+'+S D++/0$%$3*
6+,5!,NF7,+ D++3!,50+"91%2,'rZ+6 D+)*,.3%|n)+$3*-+1,+BA+7,+
+D +-+40+91%2,'67$'0B+'+S)4E3A!,<!" +"$3* <0S*+1%2,',D+5! +D +,(4 ",!- ;
z
o !$3*2,0,+B09*'?5$%'+7)"0+,!- I J J
z ) yOLg J
z S*+)+,"0+,+ D++(&S?,
 +6 +D )*,.39*X.3A5+3,+9(49*'?5$3*3!!& 1%2,'rZ" 6( 7 +D ,+/"6B-,0
B'"0+'!B+'+S +D ,+ 1%2,' ,( +D 5! +D +4?$0 3*)$'0 GH 09*+1<3( ( ;'( yO j
4?0/!")H (<*,+-,BS+7,+ D++9;GHB+'+SD+$%<*,+A.6+F+"0+9F7!&rZ
B+'+S $3*)$'0 2/0,R1<*+4 (+$'0B+'+S<0+9yO j(&$3*B'A+7-+!&yO j
(6& 7)*0+ $( '0S?,/* -+,F( (  "0+4?0 yO j (6& 7-,"0+ $'0"+0  <0 / (  4?0 (
V

; L[ %8/* 3!!&6H/*'(,+/"6B-40+A.'/.'(,6H67 +-20<!3"0+ rZ B+'+S


 $3*)$'0GH 67$3*,50+"SH/0$%
(,%|n)+)H ( +6,.39H& $3*,R   ,F( '( ( rZ '+,,"0+)H /!"|/!"4?0 )0"4"+'6D+ 
-+!& rZ)50+!& +6"-,",+ +D +9,!257,!<0%E' ( <*,+,7/E* ,+ +D +9rZ
+6GD+& ,! +D )*5,$'0$3*"+0 /*,+67<*+rZ/!"3%8/*

' 7 . 


 '(B"0 ,(4 "9*,!-,+9(41%2,'rZ%840+'+,A+71%2,'rZ,- &!
)'367S?,,D+)3)*.' +D +' ,.3   9H&  )A?3(,40+)H  +67<*   %8/!"
,7/E* )*rZ.' /* +D +
!&B+'+S,.3 9H&$3*6+,)5+4#)/E,+FC$3*2,0,+,3xgfL J,+
5.,%E' '+BC ,+,.39*X.3A5+3,+ +D +9  )2'*,7 ! S*++ &.  $"*p4 # ,R67'(
  (,.36+,+.,+@+49H&    2/057/!" (,.39H&(&67'()'+459   ($'0
)',! GH D+)*+B+'+S24,247$3*"0+   (,.39H&!&,.36+,7$ 257" (67/B !& 40+$GH ,+ +D +B0"3!,50+"'(+457(433!/0$%(&
 /7,?5PTPQ!& 67'()'+459  &! )'3YqQ)'+4593*"4,!TYqq+
(4,)'+459)50+("& +0   LJ   B+)/E '( ! '(< 40+!& ,RA+7"0+)'+459)50+(6& 7S?,<*
%8 L <( $&( %4!/D+2)0)0"4"+'6D+ ( ,R-/D+2)09  ZL ZGH %8
1%2,' ( <*,+/-B  ( ,.39H& ! ' ,.3 9H& ;673?"+0  !&
%8 )'+459325*"D+)'+459!&$%<*,+*)+/D+2)0)0"4"+'6D+ (,R-Z9
 !& #
; 676)0"4"+'6D+ TYax $- C 2,+$"*A ,R-/D+2)09 Z /0+ # 134'(
5!,NF7%8/++GH+(4,/++(&"0+  Lr fOr)'+459  (,.39H&67S?,
<*%83<(,+*/++(& <0S*+,.3   )'+459 t GH%8   6+, xgfL J 9H&
;,R67$%e/++/D+2)0 ( tA0+0+/D+2)0.'/*9Z)0"4"+'6D+GH67<*,+
6!3,+,!- )'+459t(& 3!2B3?% ( 

a

  /!"40+,+*+./D+2)09Z' ,.3 )'+459t9H&


6+,/!"40+?% (  (S& +* )+,"0++/*,+ 6( 79(41%2,' rZ S( ,? ,7/E* )* +D +134
,+,3%E' -xgfL J<0%E' y+67/* +D ,+9(4Z9H& '+)'025*"2,0+0 r/D+2)0 ( t
)*,R-/D+2)09Z/!")'0 ( 9(49H& (& ' +D <0(2& 5*" ,E !& ( ,.3,+,3xgfL J1%2,'Z
9+67S?, D++GH1%2,'Z(&,R67/* D+,+/"6B-"0+0+xg (,39*+'+<0y)$'0S*+$'0
<0,$R '0/*  +D 7$2/0S+* <*,R )* +D ,+(4,rZ9H& '+ +D +

A.>11 234 891: ' 7


,+9(41%2,'rZ!& 67%7,-$%3e"4VB0"
L'  30323>M3N@ 8.D 6 B0")n025*"B0"(,& R  =|,C<! [ 91%2,'!  134'!67/* +D
,+%5(4 0+ r)*)'+7B' <0 S*++,D+)3"0+)/E,+FC 6( 7,7/E*
rZ)* D++,+,3zgfL J+,R/*$%%5(4r9 t
)*<'&( + ( Z )'0 ( +9(49H&   )5!6+,%5(4 0+ r 25*",R676-,+
+D +134*+1%2,'$"*)0"4"+'6D+GH <*+D B! z
4L,.D,02@""!O2 ( )* P
*  8.D6$3*2,0 Z9xgfL J)r [%8/*
Z)50+(6& 7 +D )*+ /( "6 $9,+,7/E* rZ"0+%86.)$'0<0S*+
<*,+,3%E'  y %8)/E,+,7/E* )* rZ +D +  Z ( 9(4,R67%8
Z9 t257/*4/"6B-"0+%E' ,( 39*+'+!& <*y)$'0
q

5L'% &8.D6B0"(,& R  /!"1%2,' 6( 7<* +D +' rZS?,(4,9H& '+! 5!,NF7
91%2,'B0"(,& 6R 7)'1%2,' "! # $% 2/067/*$'0',( +6)0"4
"+'6D+2--Jg [  ! 67<*+D B!  [ OOL  $'0$3* 257 6+,'(+D B!
 #(,'+, '( ,( +(4,<* [ OOL  +*'<0 Md
M257D+B!
# ( D++,!-o6H D+)*$'0B+'+S<*D+B!)50+!&$3*<0,!3!!&+
( ,(4 "9*,!-o+6H'!,67/*<*"`. ( 9*+SHI JK 134/

1=?CL
LM??B2 $%
6+, ( 4,50+"$"*"+0 +67/*/"6B-"0+;"0+ 6( 7)*1%2,'rZ9+ +D +)$'0
,0 6( 7(4,1%2,'rZ9H& '++'(Y".`( 6( 7<*"-?,0 ! $%A /"6B-BS+79;

 - $! N-O P$% N-OQ


yO j(6& 7'(+0 %8' ;,D+5! +D +257'(+0 %8T' ;"0+yO j(6& 74?0 )0"4
"+'6D+/D+2)0 $( '020+67/*<* )'+459TiY=|,C<! ( TiVa,+0+0+/D+2)0
9 yO j (,& 0 25*"6H$%/"6B-0+9'! /!"40+9*+50+(& %8/!"40+91%2,'B0" ( <*0+
/D+2)09 ;yO j)0"4"+'6D+
/* read the In-Dos-Flag location by using func 0x34 of int 0x21 */
union REG regs;
struct REGS regs;
char far *InDosFlag;
regs.h.ah = 0x34;
int86x(0x21,&regs,&regs,&sregs);
InDosFlag = (char far *)MK_FP(sregs.es,regs.x.bx);

'+$3*/D+2)09JO;L
yO j25*",RB+'+SD+$%<*/"6B-$3*<0
if (*InDosFlag == 0)
PopUpTSR();

/!"40+9*+/*+ D+,+/"6B-0+9 ;L
yO j"0+%8T\"0+)$'0 S*+%8,R
)*(4,rZ9H& '+ +D +1341%2,'rZ+9(4$"*=|,C<! L\rZ
,+ 3B-0+ ;L
yO j(& D+)*+ +-"0+"5+3 ( ;"0+257"5+3 ( ;$'0"0+2/00+
B(43+4 (-+!& ;L
yO j67)*0+ (X.3,'+-+!&;67"0+2/0  ;L
yO j,!-'(0+%8
<0/ ( 4?0 ( ;L
L[3!!& +6H/*<*,( ".`)( H ,+/"6B-"-?,0 ! $%,+<* ;L
JO
hLL

Q

 $! - R!!


9F7 ( ;L
 ,D+5!!-   6+,X?* <*4?0 &! '!67 +D ,+ hLL $% 4# 6,"0+67$3*  
/+' '( ! /*,+B0")H 9OLL(6& 7'(,+(4,<*  TiYPGH ?6* ,! ,!< ;L
JO 
 6+, ;L
 67(4,<*   (9& F7 '( ! ,D+5!4?0 3!!& '!6H%8<0""5+ %( 53@!4 6( 7(4,
rZ9H& '+ +D +<0""5+(& +0  ;L
yO j'!,67%8 &! # (  $'0$3* +D +7$+67<*"+'?*
(&<0"4,+9(41%2,'rZ9+134+67 D+,+9(4Z9 TiYP(&9H&'+)'0 
Z)'0&( +,R2 ,B0" ( +D ,+/"6B- $9257(4,rZ)* +D +9*+$%9)*3?/"! 40+9*+50+
A )*)R@+A,+<*+ ('& +,9H&

891: ' 7 =>?4B


/0$%(6& 72B3/!"40+,+9(4 rZ 134 rZ (6& 7%8 rZ ( 4/"6B-,+,3%E' -
2%eA.'ACS*+)+,"0+X?* <*,3%E' y,R67A.'AC+D "0+L[] j  jW\9H& '+-6S*+X?* <*,3%E'
yY,R67 +D ,+\ OL J/!",6+,)0"4"+'6D+
1%2,'(&67<*/!"2% (<"0+xg,+7-E"0+'(,+,3%E'y)yY)$'03!(&
Key = 0
$'0',( +,3%E' y)yY
Key = 1
'(,+,3%E' y
Key = 2
'(,+,3%E' yY
B0" 6( 7,D+)30+)*,!-/!"2%xg(,& R  Z9 t 2%eA.'ACGH 9(4
9H& '+=|,C<! <(  "0+vKxg' 0+9xgS?,,D+)325*"+67'(1%2,'(,YB0" '( +0+0+
xg25*" +D +/+'%E' ,( 39*+'+1%2,'YB0" ,( 50+"SH(& 
L83G@",.D61%2,'B0"(&=|,C<! (<vKr [6+,r [967 D+,+
  \ 4?/0 53"5+ %7'+F P !& /0".+ (  3!!& +67<*   (& ,+
/"63?0+xg"0+'(,+,3%E' y)yY)$'0 S*+'(,6R 7/"63?"+0  ;L
yO j%8T;L

"0+)$'0S*+%8,R67 D+,+,7/E*rZ)* D++134,+(4,=|,C<! ()'+7B'9H&'+


4L=$#6,B@MQ$$O,.D61%2,'B0"(&=|,C<! (<vK;L
JO40+ ($3*,50+"$%25*""0+
;L
67(4,<*  (&9F7 ('!,D+5! 4?0 GHS"0+\"0+257B+'+S(4,
rZ 9+9H& '+ +D +$3* 2/0  ;L
yO j '!,67'(0+%8  3!!& +679(4 Z9H& '+
BD+)!- (&2572 ,B0" (/"6B-0+xg9*+$%

u


  


 
 
 
   










 
 





 
 



 

  4U ,+ +D +91%2,'


/!"1%2,'
/*

This program is an example of how to write a TSR program under dos.


The main() function initializes all the values in the IVT needed,
and make the program stay resident. Other functions are the ISR to
make the TSR work for us.

*/
#include <stdio.h>
#include <dos.h>
#include <stdlib.h>
#define STK_SIZE
void
void
void
void
void
void

interrupt
interrupt
interrupt
interrupt
interrupt
interrupt

0x2000

/* Stack size */

(*OldTimer)(void);
/* pointer to old timer ISR */
NewTimer(void);
/* New timer ISR function */
(*OldKey)(void);
/* pointer to old keyboard ISR */
NewKey(void);
/* new keyboard ISR function */
(*OldDosIdel)(void); /* pointer to old Idel loop */
NewDosIdel(void);
/* new Idel loop function */

P

void interrupt (*OldInt64)(void);


void PopUp(void);
void Unload(void);

/* pointer to old Int64, value */


/* is mostly 0 */
/* function that works when you press the hot key.*/
/* function to unload the TSR */

char far *InDosFlag; /* pointer to the Idel Dos Flag */


char far *Scrptr = (char far *)0xb8000000; /* Screen Pointer */
char text[8] = {"Computer Engineering CMU"}; /* array that holds the text to be
printed */
int i; /* general counters */
unsigned char stack[STK_SIZE]; /* array to use as a stack buffer */
unsigned int sp,ss; /* variables to hold old values of SP and SS */
int Key=0; /* Hot-key-pressed flag */
/* * * * * * * * * * * * * *

M A I N * * * * * * * * * * * * * * */

/* the main function initializes the tsr */


void main(void)
{
union REGS regs;
struct SREGS sregs;
/* check if the TSR is already loaded or not. */
OldInt64 = getvect(0x64);
if (OldInt64 != 0)
{
printf("TSR already loaded");
exit(0);
}
else
setvect(0x64,NewTimer);
/* read the In-Dos-Flag location by using function 0x34 of int 0x21 */
regs.h.ah = 0x34;
int86x(0x21,&regs,&regs,&sregs);
InDosFlag = (char far *)MK_FP(sregs.es,regs.x.bx);
/* save IVT for int 0x08,0x09 and 0x28 */
OldTimer
= getvect(0x08);
OldKey
= getvect(0x09);
OldDosIdel = getvect(0x28);
setvect(0x08,NewTimer);
setvect(0x09,NewKey);
setvect(0x28,NewDosIdel);
printf("TSR loaded, press F1 to activate or F2 to unload");
keep(0,_SS+(_SP/16)+1-_psp);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void interrupt NewKey(void)
{
char far *Head = (char far *) 0x41a;
char far *Tail = (char far *) 0x41c;
char far *CurKey; /* Pointer to the character in the buffer */
(*OldKey)();
if (*Head != *Tail ) /* if buffer not empty */
{
CurKey = (char far *)0x400 + *Head + 1;
if (*CurKey == 59 ) /* if F1 key */
{
Key = 1;
/* mark that the hot key has been pressed */
*Tail = *Head; /* clear keyboard buffer */
}
if (*CurKey == 60) /* if F2 key */
{
Key = 2;
/* mark that the hot key (F2) has been
pressed */
*Tail = *Head; /* clear keyboard buffer */
}
}
}

t

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void interrupt NewTimer(void)
{
(*OldTimer)();
/* if Key != 0 means that F1 or F2 key has been pressed */
/* if InDosFlag = 0 it is safe to interrupt
*/
if ( (Key != 0) && (*InDosFlag == 0) )
{
if (Key == 1)
{
Key = 0 ; PopUp();
/* call PopUp function */
}
else if (Key == 2)
{
Key = 0 ; Unload(); /* call Unload function */
}
}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void interrupt NewDosIdel(void)
{
(*OldDosIdel)(); /* Call old Dos Idel ISR */
/* if Key != 0
if
{

means that F1 or F2 key has been pressed */

(Key != 0)
if (Key == 1)
{
Key = 0 ; PopUp(); /* call the PopUp function */
}
else if (Key == 2)
{
Key = 0 ; Unload(); /* call unload function */
}

}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void PopUp(void)
{
/* set the STACK buffer */
/* ss,sp and stack[] are variables declared at the beginning */
/*
of the program
*/
disable(); /* disable interrupts */
ss = _SS;
sp = _SP;
_SS = _DS;
_SP = (unsigned) &stack[STK_SIZE-2];
enable();
/* enable interrupts */
/* print the string "Hello !" on to the screen */
i=0;
while (text[i] != 0)
{ *Scrptr = text[i++];
Scrptr+=2;
}
/* reset the STACK */
disable();
_SP = sp;
_SS = ss;
enable();
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
void Unload (void)
{
setvect(0x08,OldTimer);
setvect(0x09,OldKey);
setvect(0x28,OldDosIdel);
setvect(0x64,0);
freemem(_psp); /* free memory */
}

D+ B! /0+# ( <*1%2,'B0")n0%8D+ B! ( ,(4 ",!-  ZL dI JK 
;   b 

 GHB+'+SsH,N+$3*6+,)!B bJ J  Lj [[ j !"$% 2/0,R'(-+D+B! (67


,50+"SH ( &(
YT

1. keep(0, (_SS+(_SP/16)+1-_psp));

D+B! (& %8D+B! ( +D )*1%2,'6-,+ +D +257,5!-,$% ( ;L


L[2/067*+1%2,'
$"*)0"4"+'6D+)A?30+4# +D )*1%2,',5+4%8rZ! B. BD+!n /( * B0$%)*=| ,C<!
z (&   9+39)0"4"+'6D+ 6( 7*+$"* 0+(& B0%8/!"599*+$%,R$3* 2/0%,/.25*"+'!,/*,+)*
9+3)0"4"+'6D+ (67*+$"*'(9+3 0+,!-1%2,' rZ 9+ S*++6$"*)n0,.$%,R67B.&%5
)0"4"+'6D+$%%5+#2/0S+* 6*4,.$%,R+6 +D )*7--)4E3,+ +D +$3*
+B+'+S D+,+D+"F)+9+391%2,'9+$3*134<*/!"2%7--9 LO JorfL
 !$3*2,0 d  257 
 /!"2%)50+(& L[ O 67B*+9H& '+ ,E !& ( +   1%2,'
134 "! $%"5+1%2,'S?,1)539*+$%)0"4"+'6D+'!67'(1B*+3!(&
6E3.'/*91%2,'



\
Lj [



Lj [ z

6E3B.&BE391%2,'
6E3.' /*9 z

6E3B.&BE39 z
  52B35!,NF791%2,')0"4"+'6D+

1%2,' ,E 1%2,' S( ,? 1)539*+$%)0"4"+'6D+67'()0"4"+'6D+ z/0 +* 44?0 B'


A <*,+,R-9*'?55!,NF7hyh
 y 
GH S"0+%8B0")H 91%2,'3!!& 9+3
9)0"4"+'6D+ &! )'3 6( 7/*6$"*)*rZ9+391%2,'9+39 z
6+,?%+67)R$3*"+0  
 67<($& % /( +D 2)0)0"4"+'6D+ ( %86E3.' /*91%2,' B0"
67<($& %4!6E3.' /*9 zGH 674?/0 0 +* 41%2,'25767-,6D+"fg ( <*%8
 z
3!!&+B+'+SD+0+)50+(&'+<*,+D+"F)+9+391%2,'$3*  6+, 
 257  67
-,0+j[ GH + +-4?20 5*""0+2/057j[ 674?)0 +0 ,!Qfg
3!!& 
67 +0
,!-9+391%2,'134)0"4'(0+ 0+,!-Qfg
B0"67,R-0+LMM
9/D+2)0BE3 *+4

 z)0"4,R'( +0  +0 ,!-fg3!!& oQj[  ( 4?0 6( 3E B.& BE39 z
257oQ
,R9+391%2,'"',!-
 z134)0"4 0+,!-Qfg
-!.n
9( +3)0"4"+'6D+ /( * %e)*+D B! z'()0"4/,!A3( )0"4 +0 ,!-Qfg
+6H<*
oQ
2 9+391%2,'$3*54

  L>G3 134?1>
+S
ss = _SS;
sp = _SP;
_SS = _DS;
_SP = (unsigned) &stack[STK_SIZE-2];

Y

D+ B! 9*+/*(6& 7 +D ,+%5(4 A& ( )0"4"+'6D+ 6( 7<*%8  z B+)/E ( +/* +D 40+(&
A+7 A& (# 1%2,' rZ 9+6$"*<*%8  z !&'(9+35R,,.$% "5++9(4 rZ (
+D +G!-G*+6 +D )*  z /R'$3* GH 67 +D )* rZ 9+ +D +$'0S,? /*)+6 +D )*7--)4E3
,+ D++$%54,R$3*
6+,%|n)+9*+/*+6H/*B*+A& ( )'0B+D )!-<*%8  z 1341%2,'/!"40++ +D ,+
B*+b g< 
 z9H& '+'(9+3rx]25*"6H-,)*1%2,'9+'+<*A& ( &( %8 z134
,+<*/!"2%7--V/!"
6R..9.2>1S.@FG@02<6%8/!"2% (,R-0+ zj[ !'!67%8/!"-,1%2,'
"0+ z 6( 7<*4?0 ( j[ 3
6 R.E 9.2>1S E$302@"< 6 %8/!"2% (<(&$%4!0+-BE39  z rL LM  z GH67%8
/D+2)0MM
6+,(, )( H
6 R=. 9=>2> .@FG@02< 6 %8/!"2% <( $&( %4! j[  ( <*,R-9*'?591%2,' /!"2%
/0+# ( +%7,+s9H& '+1%2,'674?0 j[ (&
9!& / ( <*1%2,'
 +67 D+,+,R-0+d,0+$"*/!"2% (B*+9H&<

d
A"0+)5!6+,rZ9+
+D +BR625*",R67$3*0+,0+)*,-! d$3*
& ,R +D ,+,D+)30+)*<$&( %4!;A+7b g9+674?0 j[ (&
 )5!6+,!
&   2/0 6+,  z 67<*)0"4"+'6D+
 +* 4BE3,R,D+)3)* <($& %4! b g ( +B*+9H
6+,9*+)5!,5!-9H& '+9*+)*+ 3!!& +6H/*,D+)3)*  .' /*<($& %4!/D+2)0BE3 +* 4
9b g
_SP = (unsigned) &stack[STK_SIZE-2];

6+,D+ B! 9*+/* +<*/+D 2)0 rx]Y 2 /D+ 2)0BE3 +* 49 b g /D+ 2)0.' /*
9 z2  (67%8rx]A+7b g
 z9+%8b gLMU  2/057<0 0+
,!-fg2/00+ (1%2,'67B09*+$% z+6%89*'?59+3)Yfg,R$3*3!!&,+ (+<*
rx]Y!& ,R%8,+X $"*"+0 9*'?5/!"2, 6( 7S?,,R-9*+
 z%89*'?59+3Yfg

YY

 
 $6+ #++

   
    
  


,+9(41%2,'%,/. !"$%+'!,67/.3/0,!-2%eA.'AC'+/*,+!-9*"+')/!"
!,N9*+'+6+,X?*<* 134@+N+,R'(=|,C<!)*5,<*+4?0AB'"2/0-+!&++6/*,+"E',+ +D +92%eA.'AC)*'+,,"0+%,/. <0/"6B-,+,3%E' Of z)ObO;O%8/*
,F(&( +67/* +D ,+/.3/0,!-2%eA.'AC134,+9*+SH U JK  134/ GH 67/*+s!4"+'9*+6
)5!,,+ +D +9'!AB'"

 !
S*+)+,"0++/*,+0+0+ (zgfL J!-9*+'+%|66E-!+B+'+S D+$3*1340+0+6+,L
)'+459 TiQT 0+ ( +0 '+$3*6&( 7$'0<0+0  b 9%E' X( *? <*,3 2/067%80+
 LJ 9%E' !& #
GH 0+
 LJ(6& 72/,/0+,!$%BD+)!-zgfL J2/057E0 257%8)*+ 9(  6( 7 +D ,+2%5
59
 LJ)*%8bGH 67 +D ' ,.3 92%eA.'AC9&H  t
/++ (2B30+
 LJ92%eA.'ACB+'+S3?$3*@+X",

T0,! )""
2%eA.'AC967'(fMM (B+'+S!-,+,32%eA.'AC$3*50")*+ !&)'3Q/!"2/057
/!"!,N67<*A& ( Yfg3!!& 9+39fMM6H +0 ,!-VYfg
134674?0 )0"4"+'6D+/D+2)0
TTaTTT]TiaSHTTaTTTV;TiaVJ
B+)/E /( * <*& ( Yfg
,+,R-0+/!"!,N/!",RA )*B+'+S/"6B-$3*+0 4"0+%E' (
,39*+'+!& %8%E' `'3+)%8%E' A.sN %E' `'3+!& $3*2,0 bd Tt B0"%E' A.sN$3*2,0 yyYd
j\dj; d%E'5?,s%8/*+67A.6+F+0+ (,R-Yfg(&3!(&
S*+fg2,'(0+ +0 ,!-T2B3"0+%E' ,( 3%8%E' A.sN257 LJ9%E' !& 674?0 fg ( Y
S*+fg2,$'0%8T2B3"0+%8%E' `'3+257 LJ9%E' !& ,R0+6+,fg2,($& 3*54
 6+,9*'?5 ( -! 9*+'+6+,zgfL J679*+$%4!fMMGH '(4?S0 H Q/D+2)0134676!3,+
9*'?52--yyy 
 y 
3!!& 6H/*'( L  -( ,/D+2)09/!"!,NfMM"0+4?0 (
3-*+ ( 6&( 7<*L 4?0 Y/!"3*"4,!I J,!-r O

  !6
L (6& 74?0 )0"4"+'6D+/D+2)0TTaTTTbTia 67 +D )*+ <( $&( %4!/!"!,N ( 4?0 
/D+2)0)!"." ),50+"(,40+)H '!67<($& %4!/!"!,N ( 4?0  fMM '++ B( 3E  GH 67%8/!" (
1%2,'/0+#670+$%<*3!!& S*++/*,+0+0+6+,fMM+670+/!" ( I JL (<& &( 4?0

YV

 '6- !6
L (6& 74?0 )0"4"+'6D+/D+2)0TTaTTTTia %8L  6( 7<($& %4!/D+2)0 (
"0+S!3$% 6( 7<*,R-/!"!,N ( +6!-9*+'+ +2%eA.'AC L  (6& 7%5(4 0+ ,E !& '( ,( +,3%E' -
2%eA.'AC)' ,.3 t9H& ! 
0+ S( ,? ,R-4?0 L  &! B6.#25*"%80+ Ji6+,/D+2)0TiaTT3!!& S*+67D+$%<*
6.67/*-", TiaTT 9*+$%, <0S*+0+ I J L  %8 Ti] 2B3"0+/D+2)0 '( ! <(& 4?0 
TiaTTTi]{Tia]
MM 92%eA.'AC6&( 7S?,6!3,+2--   O  w ' ,R-9*'?56BE3%5+43*+)H
9fMM JJ

TiaVJ,R67",5!-'+,R- %( 5+4(,3*+)H  JJ

Tia
S*+0+9I JL {r OL 2B3"0+MM"0+257S*+0+9I JL *4
,"0+r OL 4?0 Yfg)S*+I J{Tia257r O{TiaVJ2B3"0+'!!-/!"!,N$3*(,/!"
3(4"fMM,R67/R'
 
 

   


 ##
!







  

"


















  : (5 >/?@,A 9+A@32 #5 J/A8@+,- 3KK/,


?% ( $3*2B3)*)R"0+xgfL JMM 4?040+$ W[Lg "' !&2B3/!"40+,+,R9*'?5fMM134/!"40+(B& ''E/". +0 '(9* '?54?0 fMMV/!"/!"!,NdY257VGH S?,A.'AC
9*+$%(4/+'5D+3!- 67)R$3*"+0  I J 67<(& /( "! !,N  GH %8/!"!,N/!"/0$% 6( 7S?,0+134 

Lj [B0" O67<(& /( +D 2)0fMMS!3$% 6( 7B0/"! !,N)+,S?,A.'AC9*+'+

Ya

1 234 891: ?


U:9V WH:WX
1%2,'"-E'2%eA.'AC!&+'!,679(49*+$% ( Z 9   t GH D+)*+B+'+S
/"6B-%E' /0+# S( ,? %e9*+'+$3*"' &! B+'+S2,*$90+/0+#fMM$3*134 t(6& 7,.3
9H& Y!& /0,+,3%E' -2%eA.'AC !& !& 2,67,.3/ ( +,3%E' 5$%B0"!& B( 67,.3/ (
+%54%E'9H&'+ S*+<*9*'?56+,/++/0+# @+X",  ,R67 D+)*+B+'+S/"6B-BS+79
2%eA.'AC$3*,- &! )'3
1%2,'/0$%(&%81%2,' (672B3,+ D++9 zgfL J fMM 134672 ,,+ D++
9   t ' 35   1%2,' /!"1%2,'67)4E34)*+,3%E' -2%eA.'AC%8"5+ q ".+ (
25*"672B30+%E' ( +%e9*+$%,'+ 9F7 ( +,3%E' !&    t 67 +D + GH  Z )'09+67
A.'AC+0 9I Jdr O2570+6+,xgfL JI JK L,'+1340+674?0 ?%9/!"!,N+
/*0+0+6+,/++)!Bb(, ()HA2%5,'+%8/!"59
/*

This is an example of how you can read and set data from and to
the keyboard buffer.

*/
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void interrupt (*old)(void); /* pointer to old keyboard ISR */
void interrupt newkey(void); /* our new keyboard ISR */
char far *scrptr = (char far *)0xb8000000 +138;
char far *head = (char far *)0x41a;
char far *tail = (char far *)0x41c;

/* Screen pointer */

/* pointer to head of buffer */


/* pointer to tail of buffer */

char far *key; /* used to point to the tail location in the buffer */
void main()
{
int i;
clrscr();
/* initialize the IVT */
old = getvect (0x09);
setvect(0x09,newkey);
/*

give time to let you type in characters and see how they go
in to the buffer */
delay(5000);
/* read characters in the buffer and print them to the screen
*/
for (i=0;i<10;i++)
getche();
/* restore old value int the IVT */
setvect(0x09,old);
}

Yq

/* our new keyboard ISR */


void interrupt newkey(void)
{
/* if you call old ISR here the character will be put in to the
buffer before your code. You can call the old ISR after your
code so that your code executes first */
(*old)();
/* print out information about the contents in the buffer */
/* the format will be like this: H=x T=y C=z */
/* where x and y are the value from the buffer and z is from
keyboard hardware port (scan code) */
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
*scrptr
/* port
*scrptr

= 'H'; scrptr+=2;
= '='; scrptr+=2;
= *head; scrptr+=2;
= ' '; scrptr+=2;
= 'T'; scrptr+=2;
= '='; scrptr+=2;
= *tail; scrptr+=2;
= ' '; scrptr+=2;
= 'C'; scrptr+=2;
= '='; scrptr+=2;
0x60 is where the keyboard scan code is kept. */
= inportb(0x60); scrptr+=140;

/* uncomment the next line to let you code execute before the old ISR
*/
/*
}

(*old)(); */

1%2,'/0$%(&%8(,/!"40+)H9,+9(41%2,'"-E'2%eA.'AC 13467 D+,+/"6


B-,+,3%E' ObO;OGH %,/.67%8,+Z
 S*+)+,A-"0+X?* <*,3%E' &! B+'A*',!+67
%e,!$'0)*  +D ,+Z
1342,*BS+79%E' O)*)'"0+$'0$3*S?,,34?0
/* This is an example of how you can detect the reboot sequence,
Ctrl-Alt-Del */
#include <stdio.h>
#include <conio.h>
#include <dos.h>
void interrupt (*old)(void); /* pointer to old keyboard ISR */
void interrupt newkey(void); /* our new keyboard ISR */
char far *scrptr = (char far *)0xb8000000 +138;

/* Screen pointer */

char far *head = (char far *)0x41a; /* pointer to head of buffer */


char far *tail = (char far *)0x41c; /* pointer to tail of buffer */
char far *keyflag = (char far *)0x417; /* point to the Keyboard flag
*/
void main()
{
int i;
clrscr();
/* initialize the IVT */
old = getvect (0x09);
setvect(0x09,newkey);

YQ

/* give time to let you press the Ctrl-Alt-Del buttons */


delay(10000);
/* restore old value int the IVT */
setvect(0x09,old);
}
/* our new keyboard ISR */
void interrupt newkey(void)
{
/* if Ctrl+Alt+Del is pressed */
/* if scancode = deletekey and Ctrl and Alt buttons are pressed
*/
if ( (inportb(0x60)==0x53) && ( *keyflag & 0x04)
&& (*keyflag & 0x08) )
{
*scrptr = 'x';
*keyflag = *keyflag & (0xfb);
/* make the Ctrl flag=0 to make
the machine think that the
Ctrl button is not pressed. */
}
else
*scrptr = ' ';
/* Call old ISR. Note that values in the keyflag will be
updated by
this ISR. So, if you check the falg before calling this ISR
the
flags might not be true.
*/
(*old)();
/* if the Ctrl Button is down, show status on the screen */
if (*keyflag & 0x04)
*(scrptr+10) = 'C';
else
*(scrptr+10) = ' ';
/* if the Alt Button is down, show status on the screen */
if (*keyflag & 0x08)
*(scrptr+14) = 'A';
else
*(scrptr+14) = ' ';
}

Yu

M Y ?1
==BZ G3 134?2[1>
9V WH:WX
T@UV$>"B;M>F+U2@ JML[[[LgOL  L TTaTTTu
u
Q
q
a
V


   
hL z v[hL z  LOOhL z bOJLK

Y
OJLK


hMU M

T
Z jUU M

I$"@T@UV$>"B;M>F+U2@ JML[[[LgOL  L TTaTTTP


u
Q
q
a
V


 
hL z v[hL z  LOOhL z  









Y
g
Z



hMbO


T
hMO


/++/0$%(&2B30+
 LJ92%eA.'AC2--ToTYzgGH%82%eA.'AC2-- (A-'+, (BE3
%|66E-!

 


Ii LJ
Yt
TY
TV
Ta
Tq
TQ
Tu
TP
Tt
Tb
T
T
T;
T]
Ty
T

Y
V
a
q
Q
u
P





Y
V
a
q
Q
u
P
t
T

{
 z
 
r f

K



g


L

YP

\





 z
 
 zr f
w

]
Z
r

\



Ii LJ
t
b

Y
Vb
]
y
YT
Y
YY
YV
Ya
Yq
YQ
Yu
YP

Yb
Y
Y;
Y;
Yy
VT
V
VY
VV
Va
Vq
VQ
;
VP
Vt
]TdVP
]Td;
]TdqY
]TdqV
]Tda
]Tdau
]Tday
]TdaP
]TdqT
]Tdat
]Tdq
]Tda;
aqdq






 
hL z


J

J
M
j
U

z
O

] 
hMU M


J

i


f

[
d
_
o
Z jU M


J
hMO


J
hMbO


J
 f 
Z jUbO


J
Z jUO


J


JO
hMbLK
IL[
] J
\bLK
;LK bLK
j\
j;
Z jUbLK
v[hL z


J

Yt

\





J
b

;
y
^
I

x
h

k
] 


J

c



v
W



J


J


J


J


J


J



J

Ii LJ
au
a
ay
]TdVq
aP
a
qT
qY
]TdVu
at
a;
q
qV
ab
a]
]Td
T
V
V
V;
V]
Vy
aT
a
aY
aV
aa
;t
;b
YbdVu
aQ
;d]Tdaqd]Tdqdt;




xg Ju
xg Ja
xg J
xg Jo
xg JP
xg Jq
xg JY
xg JT
xg J
xg Jt
xg JQ
xg JV
xg J_
xg J
xg J
xg J] 
]

y
yY
yV
ya
yq
yQ
yu
yP
yt
yT
y
yY
  
 LOOhL z
 


VT

\

IL[
hMbLK
] J
xg Jo
\bLK
;LK bLK


xg J
 j\
Z jUbLK
 j;LK
;O
xg J
xg J
xg J] 
]

!  !"

V

#  $ 



L@12613/-M

VY

 % 

W*&XE .@"3>ME$"2

+! C B()CA. ,! NC,(4/.


@+".<+".s",''A."/C')+". 4+5!4<(4)'0

,+!-B09*'?57)"0+'A."/C,!-E%,FC # !&%8B. (BD+!n'+,,+D+'A."/C


$%<*,-! +"-E'/0+ # 134,+B09*'?5)50+(S& +* %8   67.4'B0X0+   OOO L 257
 OLBD+)!-  OOOL!& 67'("+'R",+!-B09*'?5B?,"0+ OL'+,2/0%E ,FC (
<*67'(++2A,"0+257-+!&+ (<*,R$'06D+%8/*'(,+B09*'?53*"4"+'R"B?'+,!,,+B09*'?5
+  O L !&     67<*'+/+ ZYVYo_Ya GH %8'+/+ ( <*,-! ,+B09*'?5
tQTTf
257747 +$'0,.q[B0"U  (<*"-E',+ D++!&.4'<*PYqT\bZr


 !& '(-.,+,(4 ",!-,+B09*'?5 +  O L 4?0 aq y  L  13467<*  
)'+459a-.,+/0+#!& $3*2,0


  


-.,+(6& 7<*,+/!& 0+/0+#9L /( * ,+<*







TT

0+ /( * ,D+)3


L[[  [

L[[L [f

0+ 6( 7$3*!-






T{Wd{WYd


h  


WLJ[ 

  
L[[  ['(Pf GH 2/057-. '("+')'+43!(&
+32Y!GV@"
Z [ \ A 5 4  :
=@#1"3O23$0
?MM$]>VM@7>M!@#
i i i
 J 
TT{YTTdT{YaTTdT{aPTTd
{tQTT 
 L J
i i
  g
TT{vL  gdT{JJd{]
i
L 

T{
Lf d{Y
Lf 

i i LJO jU
T{uf 
d{Pf 

  4
VV

6+,/++ (YS*+)+,"0+/*,+  O W)* J {tQTTf


dvL  gf 
d
Lf 257Pf 
KLJO jU67/*<*L[[  [{TT]VU
B0"WLJ[257h  
!& 2/057-. ,R'( "+')'+43!(&



+32Y!GV@"
T

Y
V
a
q
Q
u



+32Y!GV@"
T

Y
V
a
q
Q
u

Y>G@
;O  O L
 J
;O J  
 Jg
r O jJj jJ L
;O   O 
j OJ 
O L
 J
;  
 Jg
Z j J L
Z  JO 
j OJ 
  5
Y>G@
;   Jg
 L
  gL
y [ jL
 zJ 
r
[ ULOJ jj
[g
r
[ 
U Mj
[g
r [L

=@#1"3O23$0
' BS+79r'(,+%5(4 2%5
' BS+79;Z'(,+%5(4 2%5
' Z%5(4 6+,hLKI jU
' BS+79;'(,+%5(4 2%5
-,BS+7%|66E-! 9r
-,BS+7%|66E-! 9;Z
-,BS+7%|66E-! 9Z
-,BS+7%|66E-! 9;

=@#1"3O23$0
T{vLJ  d{'(9* '?5A*'0+$3*
T{vLLd{]L
T{vLLd{]L
T{vLLd{]L
T{vL zd{ z
' r
[ fMM"0+
' B09*'?5BR6

9F7 (MM"0+!&PYqT+6,D+5!B09*'?54?0,R$3*U Mj


$'0"0+

  A

HS*+-. (u9h  


S?,
0+9-. /D+2)0#67 JM J!+6%8
0+7$,R$3*
0+/0+#h 257WLJ[ 
67S?,
 ,E !& '( ! S?,0+0+

Va

  








T

0+ /( * ,D+)3


U  

L[[L [f
T{Wd{WYd

0+ 6( 7$3*!-







h  


U  

  \

    







TY

0+ /( * ,D+)3

0+ 6( 7$3*!-



L[[L [f
T{Wd{WYd







h  


U  

  [

    







TV

0+ /( * ,D+)3



L[[L [f
T{Wd{WYd

0+ 6( 7$3*!-







h  


WLJ[ 

  Z

,+9(41%2,'134<*  (6& 7/*9(41%2,'5!,NF7 ( %8 LMK  LOO 
1%2,'67/*4/"6BS+79B+4B09*'?54?0B' # A (67B+'+S/"6B-$3*"0+'(9*'?5)'0
9*+'+),.39*X.3A5+3,+B09*'?5)$'0

Vq

 !"
(,".`,( +)H 6( 7 +D ,+B09*'?5, + OL,+9*+B! +PYqT\bZr134/GH
B+'+S D+$3*134,+B00+/0+#$%4!L LOLJZj
9PYqT
L[[  L LWL2/0257L67'(6( B. /C ( ,(4 "9*4?30 "* 4,!u/!"13467
B+'+S9*+SH(6.B/C)50+(&$3*134,+<*D+B!  ) L 9 LO JorfL  B0" bJJ

9(6B. /C&! 679H& 4?,0 -! L134W67'( bJJ

{TiVMPB0"WY{TiYMP0+)50+(6& 7<*
%8
bJJ

,+9*+SH(6B. /C &! u/!"


,+<*+PYqT134/(6& 7 +D )*,+ +D +!& R"9H& 2/0,R'1( ,+B,.39*X.3A5+3$3*+0 49H& <0
3(4",!,+<*+PYqT!& 67'(4?30 "* 4,!B".`3( "* 4,!,+<* LMK LOO257,+<*  
".`(,+2,!&%8".`(3(4",!- (<*,F((4,<*-.,+6+,9(41%2,')*4/"6BS+79
B+44?0 B' # B0"".`,( +<*+   !& 67'( 9 I JK    9*+'+,(4 "9* GH (6B.
/C/"! ( Y ,!- V %8/!" ( <*,+,D+ )30+/0+ # /( * ,+ ,+<*+   (6& 7$'0,50+"SH
,B+(&
(6B. /C/"! ( Q257u67,R-0+9h  
257WLJ[ 
/+'5D+3!-GH S*+0+0+6+
,(6B. /C,&( 6R 7$3*X5)',!-,+(4,<*M  L  ( a,6+,f  ( u9h  
GH 0+ (
$3*67%8TB'
!"#$% & 
+457(43,+ D++9".`(,+ ;   b 

 134<*)5!,,+9(41%2,'2-- LMK 
LOO !& 675*+4 # ,!-,+(4,<*  2/0B. 6( 7$3*A.' 9H& '+,R "+'R",+ +D + "' &! 4!
B+'+S,D+)30+"+'R",+B09*'?5$3*'+,,"0+tQTTf
(,3*"413467'(+457(433!(&
(6B. /C/"! (  ,!- Y !& 67 +D )*+ $( 3*B40+3*"4,! !  +D +%8 Z  
fMMo
[  ULOJ j j
 BD+)!-.6B. /C/"! (  257%8    fO j
 BD+)!-(6B.
/C/"! ( Y,6+,!& '!4!67S?,<*%8(6B. /C ,( +D )3 JZ 9,+B09*'?5(,3*"4134f 
( u9(6B. /C/"! ( ah  L LOj
67%8/!",D+)3"0+(6B. /C/"! ( ,!-Y!& 67 +D )*+ (
7$S*+67<*,D+)3 JZ /*)*f ('& ( +0 %8
0+/0+# (B+'+S67B0$%A,D+)3 JZ !&'(3!(&
+>!BD>2@
VTT
YTT
YaTT
tQTT
tYTT
qYTT

7>M!@
VPa
tQ
aP
Y
Q

  ^
0+/0+#/+++6D+"F$3*6+,B?/
  
3!!& S*+/*,+,D+)3"+'R",+B09*'?5%8tQTTf
,R67/* +D /+'9!& /3!/0$%(&
VQ


,D+)30+)*f  ( u9(6B. /C/"! ( a%8

B00+Y257T$%4!(6B. /C/"! ( 257Y/+'5D+3!
0+3.'f  ( u9(6B. /C/"! ( a

Vu



   

&'

 
+! CB()CA. !,NC,(4/.



G3:2 %,\+(%6 !O//6O


 9<FAG3 1HI@ !+- -OO
( 1C>I11>
$#'# @ 891:CG ]I[41 :891::32 I@AFB
' 1%2,' ( +9(4.' '(9+3)n0 %|n)+,(4 ",!-,+6!3,+ ;brb 67.' ,.39H&  /!"2% (
<*67'('+,9H& '+,9H&  4#/!"2% ( %8^OLf O'!,67%8/!" '( %( n
| )+'+, B( 3E A+71%2,'B0"
)n067/*<*/"! 2%%7@ (& ,R-9*'?5)5!,91%2,'A )*=| ,C<! /0+ # B+'+S9*+SH2576!3
,+'!$3*%|n)+ 6( 7,.39H& 
 '.1,+BB?

(=|,C<!3=|,C<!)H+6 D+"+'B(4)+4)*,!-0+ (/!"2%!&,R-134$'0$3*/!&6


 6+, ,E =|,C<! '(B. `. 6( 72,*$90+9/!"2%!& $3* GH "+'B(4)+4!& +6,.36+,,+
9(41%2,' X( 3. A5+3)+!& '(,+%5(4 1%2,''C)'0 GH $'09*+6)*+ 9( /!"
2%!& 6.#6H<*+'!X.3A5+3

 6+,'()5+4=|,C<!
 

( <*+ ;brb /!")H  #  3!!& S*+/*,+ 6( 7%5(4 2%5?%2-9;brb!& 1%2,''C67/*$%2,*$9=|,C<! ,E #=|,C<! ( <*+'!S*+=|,C<! )50+
!& 4S? ,/"6B-"+'S? ,/* '+25* " ,R 6 7 D+ )* /*B( 4 "5+/"6B-"+'S?,/*9
=|,C<! )50+!& )'0(,!& )H

( 9>
9U8 L[2MD]:B]I[
@+N+ !" # $%+$'0B+'+S (67%!-%E2,*$9 1B*+9@+N+!& # $3* <0
<.399*'?5 ;   rg
 @+N+/0+ # 134 "! $%'!,67'(9* '?5  j d yOL  j L d
U   d  jd LLO  '+)* 2/0S+* +/*,+/!"2%<.3A.sN <0 S*++/*,+<*
L[Oiv[f)/*,+,.-A.,3!  cd 7+-B'./. +67B*+/!"2%pA+7 ( +D ,+
,R-0+)50+(&$'0$3* +$'0B+'+SD+0+)50+(&'+ D+,+D+"F/0+ # 134/$3* <0 +$'0
B+'+SJM /!"2%L
 L dL
 L Y257 j 9H& '+25*" +D ,+D+"F134<*
 
  

VP

B. (67/* D+<*<.39*'?5A&+'+"',!<0<*  25*""5+67 D+,+D+"F,R67


/* +D X0+=|,C<! ( 9(49H& '+%8A.sN

 .>1DE IB 2 %,\+(%6 !O//6O


 !&B+'+S,R-;brb257=|,C<!

( <*+,!-;brb!&#$"*3*"4,!%8)0"43(4",!
(4,"0+  $3* GH,+"' ;brb ,!-=|,C<! (&+(4,"0+ 
   ,6+,!&
25*"+67B+'+SG0;brb ( 4?0 f A %e,!$'0)*=| ,C<! 6+, (  '+ +D "+'B(4)+4)*
,!-;brb!&,+G0;brb6+,1%2,'B0"#2--(&+(4,"0+  

 +B+'+S

D+,+,D+)3<.399*'?5)'0 #/+' (+/*,+$3* 2574!B+'+S (67 D+


,+A.' /.')*+ ,( + +D +9 L/0+# '( ( 4?0 3.'$3* <0B*+/!"2% ( ,R-/D+2)0cd
7+-B'./. 25*"B+'+S<*)'+4 km ,+-",0+/!"2%<.3(&9*+3*"4,! 5!,NF7,+
A.' )*+ ,( + +D +)*,-!  L2--(& +(4,"0+   

=>?4B11

891:

!+- .

%%
B''E/". +0 /*,+9(41%2,' ( +D ,+"+3 JLK 9H& '+-6)5+4 # JLK 1342/057
JLK67'(9+3 +0 ,!257%+,:9H& '+F/D+2)03-6,R$3*' "+3BR625*")*5- JLK)50+
(& &. 134D+ +p+,)5!,3.',0 6( 79(4 JLK'+%3 -! A )*)*+63?)'3.'

 891:

!+=>?9G3=[@^[ 
 ,R-)*+63.'
 MM A
)*+/0+ 6( 7"+3

( 4?)0 5! JLK 6( 7"+3 %8 b g 9+3 +0 6D+"

 /D+2)0'E'-G*+49 JLK
  Ji

"( +3%8b g9+3 +0 6D+")*+/0+ 6( 7"+3

( <*7-E"+0 ,D+5! +D +4?,0 -!  JLK3

_<1X^> G3=[@^[]I[1B
 9(4 JLK
 ; KA
 5- JLK
 ;OA

Vt

 891:

%%
67,2--)*2/057 JLK%8f 
@ =B. %,\+ C 1`
=>?9I> 3K
MM,R-)*+63.' ( 4?)0 5! JLK!& #
/D+2)0'E'-G*+49 JLK
1C1 >K @ %,\+ C:3_<1X^> A.B 3K4aBI[?4
; KA 9(4 JLK
;OA 5- JLK
?%/$%(2& B3)*)RSH"+'2/,/0+7)"0+,+9(41%2,'134<*"`. ( &! Y9*+/*

aT

-
 %8B0"

( <*;M /*2--9f 5*+4,!-,+;M  

 O

%7,-3*"4YB0")5!,

B0" (%7,+s/!"2% (/*,+)*'(f 


 B0" %( 7,+s=|,C<! /( * ,+)*'(  f  GH '()*+ ( ,+6!3,+,!-/!"2%
f !&
& '+(,
 +67<*O

%8/!"%7,+s)B*+f 9H

)( H

b6+
 %8EFB'-!/.9

( +D )*B+'+SD+1%2,' (9(4$"*25*"O

/0+#'+<*+$3*
(,134$'0/* D+,+2,*$9 LJ ,0+ GHS*+%(4- (4-,!-L J O O j j 25*",R5*+4
,!-,+D++=|,C<! 6+,1%2,')H $%<*(,1%2,')H ! 

 ,+D++ O

 $%<*+!& +B+'+S

$'0/* 9*+$%2,*$9LJ9O

3.'54

(67 D+,+A.'/.'"+'B+'+S)*,!-'!$3* 134

 BE%O

(  U '+6+,O

67'(EFB'-!/.)',!-O

 (%8   E,
40+2/0+6'("+'B+'+SA.' /.'9H& '+$3*

$ '0
+B+'+S (67 D+,+B*+;  g/+' (/*,+$3* <0++6B*+J  g (
,R-A.,!3cdB'./.$"*$3*,6+,!&+4!B+'+SD+'!$%<*,!-,+D+"F2--%,/. !"$%
$3*<0
 
  

!-0/!b6/ c %5-!6O
 /!"40+,+D+"F)!"9*

(25*")'+4{257$'0$3* D++5!,NF7%,/. ('!S?,


,2--'+2/0 +D +?%2-- S( ,? Lj [[,D+ )3

 "+'B+'+S,+<* L)=|,C<!2--(&+(4,"0+

  '!B+'+S

+D + 2( /,/0+,!$3* &!  # ( %8 )'+4)=|,C<! 3(4",! 134'!67A.6+F+6+,
 J)  ["0+'!"+'67 +D +40+$<0
 

 

a

6+,/!"40+  )'+4  D+ B! 2,67-",596D+ "/R'B/!"9*+3*"4,!  B0" 


)'+4D+B! (B67 D+,+-",0+A.,!3cdB0+9*+3*"4,!1%2,'67?*"0+/* D++
40+$134A.6+F+  J &! B9*+"0+%86D+"/R')%8A.,3!   ,+,D+)3"+'
B+'+S)'0#)*,!- L!&+(4,"0+   
! ,RB+'+S<*F
E B'-!/. LOg[LU
[$3*<03(4",!4,/!"40+<0B+'=|,C<! /0$%
 =|,C<
(& %8=|,C<! ( +D ,+"+3B*/-6@+A?%2--/0+#++6<*V=|,C<! 3!(&


 
 

=|,C<! 2,67 +D ,+"!B*/134<*/"! !,974+"PT/!"!,N


=|,C<! B( 67)'=|,C<! 2,2/067<* U"+32 
=|,C<! B( +'67B+'+S,D+ )3"+'4+"9B* /( * ,+$3*
+B+'+S (67<*=|,C<! (<)',!$3*

 
 

1%2,'67?"* +0 /*<*=| ,C<! 31343?6+,6D+"   [ B( 0 )*,-! =|,C<! (& ,+9(4
=|,C<! ?%2--(& +(4,"0+   

aY



   

()  




    



%
<FF
%*%+ .- G/ 0/$":#
H
. # $*;%I99;;
 .G"$
"%.+ -,
$;$$":#
H
#%+ # J%
$#,
K%0(;#% / L?M%I99;;
0#.

  
!& "5++/*,+9(4L[[ +67/*<*%? 2--3!(& 2/0
 !& $3*,+D )3".`,( +)'0,+9(4 L[[  134<*  D+)*+ L[[  /( * ,+ 134
1%2,'67S"0+9*"+' &! )'3 ( 4?)0 5!$%66-- !3%8L[[ 

 !"#"$ !%&'()#"
+67/* +D ,+%7,+s/!"2% &! )'3 6( 7<*$"* B( "0 /*91%2,')M  L 2/0
+B+'+S 6( 7%7,+s/!"2%F/D+2)031%2,',R$3*<0

  !" 
#$

* !"+,-  ).$ 


'+ OJ L
 [_U+67B+'+S<* d L,+!-)2B39*'?5$3*<0

 "
%!!&'% &!!
%!!&( )'% *
++

,+<* LS*++/*,+9H&- !3)'0+67<* JO<0


%!!&,) -%..*!!/

aV

,F( /( * ,+,D+ )3"+',"*+9 LO[  6( 7A.'AC9* "+')*<*


K <0
%!!) !!&,*

67 D+)*1%2,'6<0,"*+T/!"!,N-625*"A.'ACD+"0+IOOL,'+<.39"+

/ 01  2  3 0    01 


/ 01  2 
ZM bj[ 
%8".`(,+B0A++'./C$%4!=|,C<!13467%8,+

fgM 
! S*+=|,C<! !& +D ,+2,*$90+/!"2%3!,50+",R67 +D )*0+9/!"2%/*p-!-%5(4 2%5$%3e"4GH 67
5*+4# ,!-".`,( +B0 L  9/!"2%$%4!=|,C<!  2/040+$,R/+'".`,( +($& '0$3*,(4 "9*7$,!-/!"
2%L 
,+ (+B+'+SB0A++'./C2--(&$3*134$'0/*<*L  D+)*1%2,'!&9(4$3*0+49H&3?
$'0G-! G*257531,+B 6( 7,.39*X.3A5+31%2,' 6+,,+<*L X.3".`( ,+B0A++'./C
2-- ZM  (&1%2,'9+672 -$'0'(7$%5(42%5$%6+,1%2,' (B0A++'./C2--%,/.
B0" /( +0 ,!B0"9,+%7,+s=|,C<!  +0 !& 3!/!"40+
'///01-
'/
#
 "2 3
//2
4 & 5/2 5/*2
$
'///01-
#

- 0 -
0 

X55!A`C 6( 7$3*6+,1%2,'(& 


 "2 

67)R$3*"+0 /!"2%g=|,C<!  JJ,R /!"2%=|,C<! [ ! 2/0/"! 2%i,!-!&


%857/!",!1%2,'/!"40+9*+/*+<*)'+4l,+7-EB0" (%7,+s=|,C<!A)*
1%2,' +-"0+/!"2%3 ( +/*,+)* 

 fg M  B0"".`,( +B0)<*+A++'./C&! 67


$'0'( 7$2/,/0+$%6+,".`,( +%,/.54

/ 0    01 


"+'B+'+S(& %8"+'B+'+S)'0 ( +6 +D )*$3*5R,*4 257+6674!H,%714<C9'!
$'0, 2/040+$,R/+'+6D+%8/*sH,N+$"* A+7+67/*<*'!/ (+sH,N+  L
OL J jf   JLj [[ j
aa

1%2,'/0$%(& %81%2,' 2( B3)*)RSH".`,( +<*+=|,C<! 134B00+,5!-2-- Z j


fgZM 
0
10
'/
#

0 

4 &0 5/*0
$
10
#

% 0

X55!A`C $( 3*6+,1%2,'(& 


0 

' A.6+F+X55!A`C $( 3*25*"+66709*+B!-B134 "! $%25*"=|,C<! /0+#67 0+ (


,5!-'+<0
- 6 0

g67'(0+ +0 ,!-0+ =
( | ,C<! 
 B0,5!-'+ ! +67'=|,C<! %80+ )( 0+/!"59 2/0
 +,5!-,!=|,C<! ( Z fgZM 67S?,'%8/!"2%'!67 +D /!")'%8/!"2% '( !
 ,5!-'+<0/!"40+=|,C<! 
i,R67 +D /!")'%8/!"2%i +D )*' +,D+)3
i{
TT/!"2%i,R'( +0 %8TT/+'$%3e"4

4 5 2
  "5++676)0"4"+'6D++'!,<*=| ,C<!  [ OOL   25767<*=|,C<!  M  ' 67
%54)0"4"+'6D+!& 2,07--2/0!& 67'( xgKLJ)'0 ( <* +D )*+ ( &( 4?0 pA+7!  K
257JO1%2,'/0$%(& %8/!"40+".`,( +<*+zgKLJ &! B(&

#
 %7 %4 
 -
0
4  )7 %
- ) 8"9
0 )

aq


/4 
/89-
/0
$

6+,1%2,'/!"40+67)R"0+".`,( +<* K  K /+'3*"4<.39/!"2% /( * ,+6


)0"4"+'6D+ S*+)+,"0+%8
 j ,R)*B0"5R-7-E"+'4+"3*"4 B0"JO !& ,R<* JO/+'3*"4
L  <( $&( %4!)0"4"+'6D+ /( * ,+67%549)*B! ,/3*"4"0+S*+/*,+JO
 j+67/*B0
"5R-/+' +* 4JO3*"4

aQ

You might also like