1. , . 2-, 3- 4- . F(A,B,C,D)=
. , ( ) ( ). 2n , n +m ( n+ m). : , .. , , = 2+1, = 4. - . . ( ), - , . . , IEC 848: , , , . . (AND:Ù, ;OR: Ú, +; NO:a`), . , . . . , .
A | B | C | D | F |
. CPU i8086 (far) . .
i8086 98 ( 3800 ): 19 , 38 , 24 17 . 7 . . , , . , Intel ( i8087), , , , Weitek, , Intel.
|
|
i8086 . REP (), - , , , .., 8086 REP 4-5 . , , Zilog Z80 , Motorola 68000 , .
i8086 . 6- . , . .
JMP. , . -128 - +127. , , - .
16- , 16- . -32768 - +32767 , JMP.
. :
JMP dispL -
JMP disp -
JMP mem/reg -
JMP addr -
JMP mem -
JMP #########################################################
### , IP (
NEAR) CS:IP ( FAR).
IP CS .
### .
### :
7 0
+-------------------------+ l = 2 +----------------+
JMP SHORT t = 15 11101011
+-------------------------+ ----------------
NEAR. dispL
-128 +127 . +----------------+
,
SHORT .
7 0
+-------------------------+ l = 3 +----------------+
JMP NEAR t = 15 11101001
+-------------------------+ ----------------
NEAR. dispL
-32768 +32767 ----------------
. dispH
|
|
+----------------+
7 0
+-------------------------+ l = 2-4 +----------------+
JMP t = 18+ 11111111
+-------------------------+ ----------------
+-------------------------+ l = 2 mod 100 r/m
JMP t = 11 ----------------
+-------------------------+ dispL
NEAR. +----------------
16- dispH
. +----------------+
7 0
+-------------------------+ l = 5 +----------------+
JMP FAR t = 15 11101010
+-------------------------+ ----------------
FAR: offL
off IP, ----------------
seg CS. offH
----------------
segL
----------------
segH
+----------------+
7 0
+-------------------------+ l = 2-4 +----------------+
JMP t = 24+ 11111111
+-------------------------+ ----------------
FAR: mod 101 r/m
IP, ----------------
- CS. dispL
+----------------
dispH
+----------------+
### CALL#########################################################
###
.
### .
### :
7 0
+-------------------------+ l = 3 +----------------+
CALL NEAR t = 19 11101000
+-------------------------+ ----------------
NEAR: dispL
SP 2, ----------------
IP, dispH
IP +----------------+
.
7 0
+-------------------------+ l = 2-4 +----------------+
CALL t = (21+EA) 11111111
+-------------------------+ ----------------
+-------------------------+ l = 2 mod 010 r/m
CALL t = 16 ----------------
+-------------------------+ dispL
NEAR: +----------------
* SP 2, dispH
* IP, +----------------+
* ,
IP.
7 0
+-------------------------+ l = 5 +----------------+
CALL FAR t = 28 10011010
+-------------------------+ ----------------
FAR: offL
* SP 2, ----------------
* CS, offH
* SP 2, ----------------
* IP, segL
* IP off, CS - seg. ----------------
segH
+----------------+
7 0
+-------------------------+ l = 2-4 +----------------+
CALL t = (37+EA) 11111111
+-------------------------+ ----------------
FAR: mod 011 r/m
SP 2, ----------------
CS, dispL
SP 2, +----------------
IP, dispH
, , +----------------+
IP,
- CS.
### RET############################################################
### . -
, .. .
- ,
, SP,
, .
### .
|
|
### :
7 0
+-------------------------+ l = 1 +----------------+
RET t = 8 0011010 w
+-------------------------+ +----------------+
NEAR:
IP,
SP 2
7 0
+-------------------------+ l = 1 +----------------+
RET t = 18 0011010 w
+-------------------------+ +----------------+
FAR:
IP,
SP 2
CS,
SP 2
7 0
+-------------------------+ l = 3 +----------------+
RET t = 12 0011010 w
+-------------------------+ ----------------
NEAR: dataL
IP, ----------------
SP 2 dataH
SP +----------------+
.
7 0
+-------------------------+ l = 3 +----------------+
RET t = 17 0011010 w
+-------------------------+ ----------------
FAR: dataL
IP, ----------------
SP 2 dataH
CS, +----------------+
SP 2
SP
.
near far. CALL near, NEAR, CALL FAR, - FAR. CALL near IP ( ); IP . CALL FAR CS CS , ; IP, IP - . near RETN, far - RETF
: | |
: | [:] CALL / |
: | : |11101000|disp-low|disp-high| : |11111111|mod 010 r/m| : |11111111|mod 011 r/m| : |10011010|offset-low|offset-high|seg-low|seg-high| |
3. . . , . , , . -, , .
, . , (, ).
, , . . , , , ( , ). , , . , , (, ), . , , .
|
|
, . , . , , , , ( ) . ( , , , LOOPEND LOOP ), (while true do ). for(;;) .
, , . , ( ). while, while-. Pascal :
while <> do
begin
< >
end;
++:
while(<>)
{
< >
}
, . , . repeat..until; dowhile.
Pascal ::
repeat
< >
until < >
:
do
{
< >
}
while(< >)