                       
                   (   )

                   .:[  ]:.

    :
  AX, BX, CX, DX -  Word (,  )
    Word ("")    0  65535.
      -   :
  *L  *H  (Lo ()  Hi () )
    "*"       .
     0  255.
  :
  DX -> DH, DL
  AX -> AH, AL

  :

  Assembler     :    Pascal

  mov a, b    .  MOVE -    a:=b
  add a, b    ADD -               a:=a+b
  sub a, b    SUB -                 a:=a-b

  : a - ; b -   .

  :

  mov  AX,  13h
  sub CX, 001010b
  add DX, 10d
  mov DX, BX

  h -   HEX. ,    
      : 0 1 2 3 4 5 6 7 8 9 A B C D E F
              :  F0h,    
        0  -  0F0h!         
      .
  b -   BINARY. ,    
      : 0 1
  d -   DEC. ,    
      : 0 1 2 3 4 5 6 7 8 9
  o -   OCT. ,    .
      : 0 1 2 3 4 5 6 7
   Pascal     , :
  mov DX, 15
     .    ...
      ...


                       .:[ ]:.

       CX  ,  
    .   ,   
"@",      ;   
LOOP  ()   .       CX 
    (    !!!    :
SUB CX, 1).  CX    -  .
  :

  mov cx, 100d
  @rep:
       - - -
     
       - - -
  Loop @rep

            CX  
.
  !     CX   !
        POP  PUSH (. ).


                      .:[ ]:.

   :
  and a, b
  or  a, b
  xor a, b
  not a
  a -    .
  b -   .
                     
 (  ,     ).

  :
     :

    : 7 6 5 4 3 2 1 0
     : 0 1 0 0 0 1 1 0
    : 70


                        .:[ ]:.

   :

  shl a, b \
             - sh  SHift (): l - Left (); r - Right ()
  shr a, b /

  a - 
  b -   !!!  CL !!!   - .


       :

    ,       .  ,
    128,    1.     
      ReadLn   WriteLn.  Assembler' 
Turbo Pascal     ASM  END. :

Var B: Byte;
Begin
  Write(' : ');
  ReadLn(B);
  Asm
    mov ax, {     : BX, CX, DX }
    { - - - }
    {     }
    { - - - }
    mov B, ax
  End;
  WriteLn(' : ', B);
  ReadLn;
End.  {       Register:  F10  
Debug->Register;      -             
   . }
    "5".   ,    (word).


       .:[; , ,   ]:.

   -   .
   -  .
  ~~~~

    16
   2   = 64Kb

   !!!  -      64Kb (65535 ) !!!

   20         1Mb.
   DS,  CS,  SS,  ES -  .    
                       .
   SI, DI, SP, BP, IP -  .  .
    -    16  (   ).

    Assembler':
   OffSet -     ().
   Seg -   ().

   (Seg*16)+OffSet -   .

   Seg:Ofs -  .

   :
   mov [ds:di], ax
   mov dx, [ds:di]
   mov [ds:di], cl

    ,          (*L
  *H),      / ,   (*X), 
 /   ().

    Assembler':
  mov ax, Seg Arry
  mov cx, OffSet Arry
  Arry - -  (  ;  - ?).


       :

          . 
 :
1 2 5 7 9 4 0 3 7 4
  :
4 7 3 0 4 9 7 5 2 1
  :
      DS     . 
      :
  mov cx, Seg Arry
  mov ds, cx
    :
  mov ds, Seg Arry
        .
       .   -   10
.

                        .:[ ]:.

   z (zero - ) = 1      0.
   :
   mov ax, 5h
   sub ax, 5h
     z   1.
   s (sign  -  ) =     ,  1
      1  0 .
   :
   mov ax, 5h
   sub ax, 8h
     s   1.
     s     0      
     .
   c  (carry  - ) =   ()  
    sh*


                 .:[  ]:.

  JMP @  (JMP  JuMP - ).
  :
  jmp @metka
  - - -
  @metka:


                  .:[  ]:.

  J* (J -   Jump).
  :  Jc,  Js,  Jz  -    ,   s, c  z
  ,  1.
  Jn* (n - not)
  : Jnz, Jns -   ,   0 (..  1).

  cmp a, b
  a - .
  b -   .
  cmp - CoMPare ()
         sub,   ,  
,       ,      . 
:
        
   z        1        a=b
   z        0            a<>b
   s        0            a>=b
   s        1            a<b

   test a, b
   a - .
   b -   .
   test - 
       and,    a,  .
 :
        
   z        1        (a and b)=1
   z        0            (a and b)=0

  :

  Pascal:         Assembler:

  If A<B Then     mov ax, A
    ...           cmp ax, B
                  Js @istina
                    - - -
                  @istina:
                    ...

  If A=B Then     mov ax, A
    ...           cmp ax, B
                  Jz @istina
                    - - -
                  @istina:
                    ...

  If A>B Then     mov ax, A
    ...           cmp ax, B
                  Js @loj     {   A>=B }
                  Jnz @istina {   A<>B }
                    - - -
                  @istina:
                    ...

     Loop:

  mov cx, 100h
  @rep:

   

  loop @rep

  :

  mov cx, 100h
  @rep2:

   

  sub cx, 1
  Jnz @rep2

          Register.

            :

    ,         
      .       
    Turbo Pascal.
    ,             N
    (         
 Turbo Pascal).
    "5".
          ""    .
    (    Turbo Pascal) , 
 ,  .
    .
   ,   :
    X   Byte   8    
  Y.  X      
 Y  :

  X = 00101010b, 01101110, .....
      |         /
  Y = .<------/

   :

  X = a7 a6 a5 a4 a3 a2 a1 a0   ,  b7 b6 b5 b4 b3 b2 b1 b0 , ...

  Y = a7 b7 c7 d7 e7 f7 g7 h7   ,  a6 b6 c6 d6 e6 f6 g6 h6 , ...

   a, b, c, d, e, f, g, h -   ;
  7, 6, 5, 4, 3, 2, 1, 0 -     .

              X  
     Y,     
X              Y    .. 
       Y (  ),  
             X, 
            X    ..   
:   !  X  
.

                       .:[ ]:.

  1) .
  2) .
  3) .

  1)  -   .
  CS -  .
  IP -  .
  CS:IP  -      ,   
. IP       .
  2)  (DATA) -  .
  DS -  .
  SI, DI - .
  DS  SI .
  [ds:si]=[si]
  [ds:di]=[di]
  3)  (STACK) -   .
  SS -  .
  SP - .

  SS  SP .
  [ss:sp]=[sp]

   Assembler':

  PUSH A -     A   SP  2.
  POP B -     B   SP  2.

  A -   .
  B - .

  PUSHA -  PUSH All:     .
  POPA -  POP All:     .


                  .:[  ]:.

                           :
                              /        \

                            .EXE     .COM     64Kb!

                +-------+                  +-------+<- CS, DS, SS
                |  PSP  |                  |  PSP  |
                +-------+<- DS             +-------+
                | CODE  |                  | CODE  |
                +-------+<- CS IP=0        | - - - |
                | DATA  |                  | DATA  | 1 
                +-------+<- SS             | - - - |
                | STACK |                  | STACK |
                +-------+<- SP (FFFE)      +-------+<- SP


                             .

    +-----------+           (Kb)   
    |  |        .
    +-----------+
      ^ ^ ^ ^ ^         0:0-0:03FF -  .
      | | | | |
                        4  - .
                        4  -  
                        ( (Word)      ).

                         256 .

  :

  INT .

  :

  INT 10h  (BIOS (Basic Input Output Sistem)   )
  (:      ;  
             
       .      : 
         ...)

  :

-   :
  ah = 0h (     AH)
  (mov ah, 0h;      !)

  al =  .

  :

  {   80x25 16  (): }
  mov ah, 0h
  mov al, 3h
  int 10h

  {   320x200 256  (  VGA ): }
  mov ah, 0h
  mov al, 13h
  int 10h

-  .
  ah = 2h
  dh =  (y)
  dl =  (x)
  bh = 

-    .
  ah = 9h
  bh =  
  cx =  
  al =  
  bl = 
     ,    .

-  .
  ah = 6h
  al =   
  ch/cl = / (y/x)     
  dh/dl = / (y/x)     
  bh =  
            
    .

-  .
  ah = 7h
      " ".

-   .
  ah = 0Eh
  al =  
         .

    DOS (Disk Operation System) - int 21h

-  .
  ah = 9h
  DS:DX -  .     "$".


                            .

  int 9h -   BIOS.
   :

  +---+---+     +---+---+     +---+---+     +---+---+
  |   |   |     |   |   |     |   |   |     |   |   |
  +---+---+     +---+---+     +---+---+ ... +---+---+
    ^   ^           ^                           ^
    |   |           |         ---->             |
    |   ASCII                           
           (  ) (  )

                 
 .

   int 16h - BIOS:   .

-     .
  ah = 0h
  :
  ah =  
  al = ASCII 
  :       (    ), 
   (  ReadKey  Turbo Pascal').

-    .
  ah = 1h
      .
  :        .
     -  ( ),   z=0,  1.

-   .
  ah = 2h

  :
  al =  :

  +---+---+---+---+---+---+---+---+
  | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 |
  +---+---+---+---+---+---+---+---+
    ^   ^   ^   ^   ^   ^   ^   ^
    |   |   |   |   |   |   |   Right Shift
    |   |   |   |   |   |   Left Shift
    |   |   |   |   |   CTRL
    |   |   |   |   ALT
    |   |   |   Scroll Lock
    |   |   Num Lock
    |   Caps Lock
    Insert

  :
  1 -  (* Lock; Insert)    ; 0 - .

    ()  ()        TEST (. ) 
 z.


                          .:[ ]:.

  :

  Int 21h - DOS

-    .
  ah = 0Ah
  ds:dx =   
                 ()
.
      :

  +---+---+---+---+---+---+---+---+---+---+
  | 8 | 6 |  |  |  |  |  |  |#13|   |
  +---+---+---+---+---+---+---+---+---+---+
    ^   ^                           ^
    |   |                            ENTER () <---------|
    |    Ĩ                              |
     - ,    +   |.

           MaxChar+3 .  
    ,          
  ,   ,    .


                    .:[ ]:.

  mul - .

  mul byte (     byte (*L  *H))

   :
  al*byte
     al   ,   .
  ax - .

  :
  mov al, 4
  mov cl, 2
  mul cl
   ax = 8.


  mul word (word - *X)
  ax*word
  dx_ax -  ( DX    !!!  
).
      dx;   ax.

  div - .

  div byte

  ax / byte
  al -  
  ah - 

  div word
      dx;   ax.
  dx_ax / word
  ax -  
  dx - 

            :
    ,           
. ESC - .
    -   Shift(!)+ESC.
    ,           
(),           .        
    Turbo Pascal'.
    "5".
                Assembler'.
     Turbo Pascal  ,  
 !
     .
        "5",      
        .


                      .:[ ]:.

    Turbo  Pascal         
 ( DOS):

  Procedure GetIntVec(IntNo: Byte; Var Vector: Pointer);  -   
 Vector     IntNo.
  Procedure SetIntVec(IntNo: Byte; Vector: Pointer);    -     
   IntNo    Vector.

      Turbo  Pascal,      ""    
       
INTERRUPT ().
  :
  Procedure NewHandler; Interrupt;
  Begin
    - - -
     .
    - - -
  End;

                        :

  1)     .
  2)     .
  3)     .

        60h-69h  -  .   Windows  
60h-66h .
    ,   ,   , 
 , .   :

  GetIntVec(VecNo, Vector);
  If Vector<>Nil Then WriteLn(' !')
  Else WriteLn(' .');

   Assembler':

  call  -  .

  pushf -   (pushf - PUSH Flags).

    :
  asm
    pushf
    call _. (Var _: Pointer).
  end;

  Keep(0);  -        ,   (0 - 
).

  ,     :
{$M $800,0,0}
           Turbo Pascal'!!! 
:  F10 -> Compile -> Destination Disk (   DISK, 
 MEMORY,   !  );
           F10 -> Compile -> Build
        DOS   NC/VC/DN    .EXE
 (      :
F10  ->  Options  ->  Directories...  -> EXE & TPU Directory ( 
,      , , , )).


            :

      ,         
    (  ).
    "5".
   ,         SHIFT,
CTRL, ALT   ,   .

    (,     ):

{$M $800,0,0}  {    }
Uses DOS, CRT;
Const B: Byte = 0;
Var OldVec: Pointer; {     }
Procedure Beep; Interrupt; {   }
Begin
  Asm           {    : }
    pushf
    call oldvec;
  End;  {       ESC.   - 
  (ESC       SHIFT').
  Mem[$0040:$0017]           ah = 2h
. }
 If (Mem[$0040:$0017] And 3<>0) And (Port[$60]=1) Then SetIntVec($09, OldVec);
 Asm {    ?... }
   mov b, 0
   mov ah, 1
   int 16h
   Jz @ext
   mov b, 1
   @ext:
 End;
 If B=1 Then { ...  -  }
   Begin
     Sound(2000);
     Delay(200);
     NoSound;
   End;
End;
Begin {   }
  GetIntVec($09, OldVec);{    }
  SetIntVec($09, @Beep); {   }
  Keep(0); {    }
End.


                       .:[ /]:.

     -   (Word).  ,    , 
0  65535.

   Assembler':

  in ,  -   .

  out ,  -   .

          0  255 (0..0FFh),   
  :
  in al, 50h
        DX:
  mov dx, 0f3dh
  in al, dx

     /   ,   al. 
  -  ax.        -    (Turbo  Pascal,
,   )!
  Turbo  Pascal      Port[ ]  ,
 PortW[ ]   (W - Word). :
  B:=Port[$3DA];
  Port[$0FA]:=B;


  3DAh -    .
    3  ( )     .  
       1.


                    
                            (20 )

  1)  : 3D4h
             : 3D5h
  2)     .

  -)   :

       ( 0Ch)
       ( 0dh)

     +80   

    .
   8h - .
   4 :
  +---------------+---+---+---+---+
  |               |   |   |   |   |
  +---------------+---+---+---+---+
                   \             /
                    \           /
                     \         /
         ,    

            :

     ,         
 .    ( )  Assebler' 
            . 
 Loop.
        .


                             .:[]:.

  cli - (CLose Interrupt)    .   
    .
  sti - (STore  Interrupt)             
 .
               
    (    ).

  rol a, b (Repeat Over Left)
  a - 
  b - cl  
     .   shl,   , 
 ("")     0-. :
    11001010
     rol:
    10010101
  ror a, b (Repeat Over Right)
  a - 
  b - cl  
    .   .
  !!! (   r   Repeat -  ...) !!!

   jmps  - (JuMP Short)  
       ,        81h
(129)  .    - jmp.     2 , 
 3  jmp.   ...

                                                           
                                                           -=CHE@TER=-
                                                 : 01-01-2004
                                                : 28-10-2004
                                web: http://CTPAX-CHEATER.losthost.org
                                               mailto: _CTPAX_@MAIL.RU
