汇编求表达式(v-(x*y)+z-540)/v值

来源:百度知道 编辑:UC知道 时间:2024/05/16 11:15:53
变量均为八位带符号数
值由键盘输入。。。。
在线等答案,9点前回答可以加分
结果送至变量w输出

值由键盘输入,没太想好,下面的程序只能从键盘输入一位数字,有局限,有待改进。
data segment
msgx db 'input x:$'
msgy db 'input y:$'
msgz db 'input z:$'
msgv db 'input v:$'
w db ?
data ends
code segment
assume ds:data,cs:code
start:
mov ax,data
mov ds,ax

lea dx,msgx
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h
mov bl,al;输入的X存入BL中

lea dx,msgy
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h;输入的Y存入AL中

imul bl
mov bx,ax;X*Y存入BX中

lea dx,msgv
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h;输入的V存入AL中
mov cl,al;输入的V又存入CL中

cbw
sub ax,bx
mov bx,ax;V-(X*Y)的结果存入BX中

lea dx,msgz
mov ah,9
int 21h
mov ah,1
int 21h
sub al,30h;输入的z存入AL中

add bl,al
adc bh,0 ;V-(X*Y)+Z的结果存入BX中

sub bx,540;V-(X*Y)+Z-540的结果