,
,
. , .
,
, .
16= .
 
:
A * 2 + B * C
X = ------------------
D - 3
 
,
. 4.16.
. 8088
16= DX:AX,
BX:CX
. ,
.
32= ,
. DX:AX.
CX,
. AX
X. .

Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:01:10
. 4.16 Page 1-1
 
 
PAGE ,132
TITLE . 4.16
 
;-------------------------------------------------------------
;
;
; A * 2 + B * C
; X = -------------------
; D - 3
;
; - 16-
;-------------------------------------------------------------
 
. 4.16 ()
0000 CODE SEGMENT
ASSUME CS:CODE,DS:CODE
 
0000 ???? X DW ? ;
0002 ???? A DW ?
0004 ???? B DW ?
0006 ???? C DW ?
0008 ???? D DW ?
 
000A FIG4_16 PROC NEAR
 
000A B8 0002 MOV AX, 2 ;
000D F7 2E 0002 R IMUL A ; DX:AX = A * 2
0011 8B DA MOV BX, DX
0013 8B C8 MOV CX, AX ; BX:CX = A * 2
0015 A1 0004 R MOV AX, B
0018 F7 2E 0006 R IMUL C ; DX:AX = B * C
001C 03 C1 ADD AX, CX
001E 13 D3 ADC DX, BX ; DX:AX = A * 2 + B * C
0020 8B 0E 0008 R MOV CX, D
0024 83 E9 03 SUB CX, 3 ; CX = D - 3
0027 F7 F9 IDIV CX ; AX = (A*2 + B*C) / (D-3)
0029 A3 0000 R MOV X, AX ;
002C C3 RET
 
002D FIG4_16 ENDP
002D CODE ENDS
END
 
. 4.16 ()





- - - - - -