Assembler






. 4.19 .
,
. ,
. ,
,
. ,
.
,
.
 
.4.20 ;
.
.
 
,
. .
, .
mod=r/m .
 
Ŀ Ŀ
Ŀ Ŀ Ŀ Ŀ
CY <Ĵ Š < > Š > CY

ROL ROR
 
Ŀ Ŀ
Ŀ Ŀ Ŀ Ŀ
Ĵ CY <Ĵ Š < > Š > CY

RCL RCR
 
 
Ŀ Ŀ Ŀ Ŀ
CY <Ĵ Š < 0 0 > Š > CY

SHL SHR
Ŀ

Ŀ Ŀ Ŀ Ŀ
CY <Ĵ Š < 0 > Š > CY

SAL SAR
 
. 4.20 .
 
, ..
, ;
.
- .
. ,
CL .
, CL,
. CL
0 255,
0 - 16. 0 ,
16 ,
.
 
-
. , ,
.
. ,
.
,
.
. 16
,
.
"" 16= ,
.

.
 
.4.20 -
. .

. ROL
ROR . ,
RCL
RCR .
ROL RCL .
RCL 9=,
. - , ROL
16 , RCL 17 .
 
.4.20
. ,
. , ,
. 0;
,
.
 
,
? ()
2.
, 10.
0 2.
,
.
, 0.
, 2.
, 2, ,
. , 3
8.
 
- 2.
- , - .
1, = , .
,
2. ,
,
, 2.
 
2
. 0
, .
SAR
.
, -
. ,
. =
SHL SAL
.
 
,
, .

,
,
. ,
, .. ,

.
 
. 4.21 .
.
9, 2.
,
8.
, , ,
9.
 
.
, - :
 
PUSH DX
MOV DX,9
IMUL DX
POP DX
 
, 9 16=
, 32=, IMUL.
 

. ,
- . IMUL ,
.
. 4.21, 25% .
, ,
9. 2
.
Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:01:21
. 4.21 Page 1-1
 
PAGE ,132
TITLE . 4.21
0000 CODE SEGMENT
ASSUME CS:CODE,DS:CODE
 
;--------------------------------------------------
; , AX
; 9
;--------------------------------------------------
 
0000 MUL9 PROC NEAR
 
0000 51 PUSH CX ; CX
0001 50 PUSH AX ; AX
0002 B1 03 MOV CL, 3 ; AX 3 ,
0004 D3 F8 SAR AX, CL ; 8
0006 8B C8 MOV CX, AX ; CX <- AX * 8
0008 58 POP AX ; AX
0009 03 C1 ADD AX, CX ; AX <- * 9
000B 59 POP CX ;
000C C3 RET
000D MUL9 ENDP
 
;--------------------------------------------------
;
; AX, CL
;--------------------------------------------------
 
000D 53 PUSH BX ; BX
000E BB 0001 MOV BX, 1 ; (1 0 BX)
0011 D3 C3 ROL BX, CL ;
0013 23 C3 AND AX, BX ;
0015 5B POP BX ; BX
0016 C3 RET
 
0017 CODE ENDS
END
 
. 4.21
 
. 4.21 ,
.
,
AX, CL , AX:
CL 8, AX
8. BX
CL , AND .
 
,
CL 0 - 15.
AND,
CL; AND CL, 0FH ,
CL 0 - 15. ,
.
16= , BX.