书上的一个例子, 根据logic_rule的位,执行z = x +(-) y
datarea segment
x dw 1,2,3,4,5,6,7,8,9,10
y dw 1,2,3,4,5,6,7,8,9,10
z dw 10 dup (?)
logic_rule dw 0dch
datarea ends
prognam segment
main proc far
assume cs:prognam,ds:datarea
start:
mov ax,datarea
mov ds,ax
mov bx,0
mov cx,10
mov dx,logic_rule
next: mov ax,x[bx]
shr dx,1
jc subtract
add ax,y[bx]
jmp short result
subtract:
sub ax,y[bx]
result:
mov z[bx],ax
add bx,2
dec cx
jnz next
ret
main endp
prognam ends
end start