汇编语言:编写程序,实现求Y=10 * X,X在0~255之间

周三之前就要,希望大佬帮帮忙;
DATAS SEGMENT
X DB ?
Y DW ?
DATAS ENDS

CODES SEGMENT
ASSUME CS:CODES,DS:DATAS

START:
MOV AX,DATAS
MOV DS,AX

;要在这里进行输入

MOV AL,X
MOV BL,10
MUL BL
MOV Y,AX

;要在这里进行输出

MOV AH,4CH
INT 21H
CODES ENDS
END START
最好给可以运行的代码

第1个回答  2018-12-03
datas segment
  x db ?
  y dw ?
datas ends

codes segment
assume cs:codes, ds:datas
start:
  mov ax, datas
  mov ds, ax

  ;inut codes here
  mov bl, 10
  mov x, 0
R0:
  mov ah,1
  int 21h
  cmp al, 0dh
  jz R1
  sub al, 30h
  xchg al, x
  mul bl
  add x, al
  jmp R0

R1:
  mov al, x
  mov bl, 10
  mul bl
  mov y, ax

; output codes here
  mov cx, 0
  mov bx, 10
  mov ax, y
O0:
  xor dx, dx
  div bx
  xor dx, 0e30h
  push dx
  inc cx
  cmp ax, 0
  jnz O0

O1:
  pop ax
  int 10h
  loop O1

  mov ah,4ch
  int 21h
codes ends
end start

本回答被提问者和网友采纳
相似回答
大家正在搜