家庭香肠加工投资大吗:求救!哪位高手可以提供一个汇编程序!有重谢!

来源:百度文库 编辑:查人人中国名人网 时间:2024/04/29 20:49:32
用汇编语言编写一个程序:计算两个五位数的十进制加法。
要求:采用键盘输入两个五位十进制数,并把结果在屏幕上输出!

你是把整个骗程写什么来~ 还说一下如何编写~

8086:
data segment
var1 db ?
db 0
var2 db ?
db 0
result db ?
db '$'
data ends
code segment
assume cs:code,ds:data
start: mov ax,data
mov ds,ax
mov ah,0ah
lea dx,var1
int 21h
lea dx,var2
int 21h
mov bx,0
mov cx,6
mov ah,00h
lop1: mov al,var1[bx]
sub al,30h
sahf
adc al,var2[bx]
cmp al,3ah
jc mov_al
sub al,9
or ah,01h
mov_al: mov result[bx],al
add al,2
loop lop1
mov cx,6
lea dx,result
mov ah,09h
int 21h
mov ah,4ch
int 21h
code ends
end start

连单片机的类型都没给,指令集不一定呀
汇编语言不是只有x86那套

;;;;;======== x86 Assemble =============;;;;;;;;;;;;;;;;
;---------------------------------------------
CR equ 0dh
LF equ 0ah
Output MACRO pStr ; Output Massages
lea dx,pStr
mov ah,9
int 21h
ENDM
Input Macro pStr,inpt ; Input data
mov cx,5
mov di,offset pStr
inpt:
mov ah,1
int 21h
mov [di],al
inc di
dec cx
jnz inpt
CRLF
ENDM
CRLF Macro ; Return and Line
; Mov ah,1
; int 21h
mov dl,CR
mov ah,2
int 21h
mov dl,LF
mov ah,2
int 21h
ENDM
;------------------------------------------------
DATA segment
Msg1 DB 'Input two Integers (length: 5):',CR,LF,'$'
Msg2 DB 'The Result is:',CR,LF
Firsts DB 5 dup(?)
Msg3 DB ' + '
Seconds DB 5 dup(?)
Msg4 DB ' = '
Result DB 6 dup(?)
Msg5 DB ' .',CR,LF,'$'
DATA ends
;---------------------------------------------
CODE segment
ASSUME CS:CODE,DS:DATA
START:
mov ax,DATA
mov ds,ax
;------------------------ Codes below ---
Output Msg1
Input Firsts,inpt1
Input Seconds,inpt2
call AAAA
Output Msg2
Exit:
mov ah,4ch
int 21h

AAAA Proc near
mov di,offset Result+6
mov cx,5
xor ax,ax
AGAIN:
mov si,offset Firsts-1
add si,cx
mov al,[si]
mov si,offset Seconds-1
add si,cx
mov bl,[si]
sub al,30h
sub bl,30h
add al,ah
xor ah,ah
add al,bl
aaa
add al,30h
mov [di],al
dec di
dec cx
jnz AGAIN
test ah,0ffh
jz LAST
add ah,30h
mov [di],ah
LAST:
RET
AAAA EndP

CODE ends
end START ;End Program