从键盘中键入两个4位数,分别保存到BUF1和BUF2存储区中,进行求和,求和的结果送至变量SUM当中,并进行显示 用“汇编语言”的!!
比如输入1234
5678
得出结果是6912
比如输入9999
1111
得出结果是11110
这里要注意有进位和无进位
------解决方案--------------------
; multi-segment executable file template.
data segment
; add your data here!
;ARRAY DB 'ABCDEF'
MAXN EQU 100
A DB 100 DUP(0)
NA DW 0
SIGNA DW '+'
B DB 100 DUP(0)
NB DW 0
SIGNB DW '+'
bint DB 101 DUP(0)
NC DW 0
SIGNC DW '+'
OP DW '+'
MAXV DW 0
help db 'Do you want to continue? (y/n):$'
pkey db "press any key...$"
data ends
stack segment
dw 128 dup(0)
stack ends
code segment
assume cs:code,ds:data,ss:stack
start:
; set segment registers:
mov ax, data
mov ds, ax
mov es, ax
;输入A
RESTART:
MOV SI,OFFSET SIGNA
PUSH SI
MOV SI,OFFSET NA
PUSH SI
LEA SI,A
PUSH SI
CALL CINBINT
PUSH NA
LEA SI,A
PUSH SI
CALL REVERSE
;输入运算符
CALL CRLF ;回车
;输入B
MOV SI,OFFSET SIGNB
PUSH SI
MOV SI,OFFSET NB
PUSH SI
LEA SI,B
PUSH SI
CALL CINBINT
PUSH NB
LEA SI,B
PUSH SI
CALL REVERSE