nicekin 发表于 2005-4-26 11:19:00

[分享]汇编实验二加法

data &nbsp; &nbsp;&nbsp; &nbsp;SEGMENT<br>
data1 &nbsp; &nbsp; DB'72355+'<br>
data2 &nbsp; &nbsp; DB'45664= '<br>
data3 &nbsp; &nbsp; DB 6 DUP(?),'$'<br>
data &nbsp; &nbsp;&nbsp; &nbsp;ENDS<br>
code &nbsp; &nbsp;&nbsp; SEGMENT<br>
ASSUME CS:code,DS:data<br>
start: &nbsp; &nbsp; MOV AX,data<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; MOV DS,AX<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; LEA SI,data1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; LEA DI,data2<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; LEA BX,data3<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; MOV CX,5<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; CLC<br>
l1: &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; MOV AL,<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADC AL,<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; AAA<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; PUSHF<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; ADD AL,30h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; POPF<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; MOV ,AL<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; DEC SI<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; DEC DI<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; DEC BX<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; LOOP l1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; JNC l21<br>
l2: &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; MOV ,31h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; JMP l22<br>
l21: &nbsp; &nbsp;&nbsp; &nbsp;MOV ,20h<br>
l22: &nbsp; &nbsp;&nbsp; &nbsp;MOV DX,OFFSET data1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; MOV AH,09h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; INT 21h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; MOV AH,4ch<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; INT 21h<br>
code &nbsp; &nbsp; ENDS<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp; END start <br>

nicekin 发表于 2005-4-26 11:20:00

附加题:<br>
data SEGMENT<br>
data1 DB ' 12345',10,13,'+'<br>
data2 DB '67890',10,13,'------',10,13,' '<br>
data3 DB 6 DUP(?),'$'<br>
data ENDS<br>
code SEGMENT<br>&nbsp; &nbsp; &nbsp;ASSUME CS:code,DS:data<br>
start: &nbsp;MOV AX,data<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;MOV DS,AX<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;LEA SI,data1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;LEA DI,data2<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;LEA BX,data3<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;CLC<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;MOV CX,5 &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; <br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; <br>
again1: MOV AL,<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;ADC AL,<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;AAA<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;PUSHF<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;ADD AL,30h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;POPF<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;MOV ,AL<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;DEC SI<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;DEC DI<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;DEC BX<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;LOOP again1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;JNC &nbsp;d1 &nbsp; &nbsp;&nbsp; &nbsp;<br>
d0: &nbsp; &nbsp; MOV &nbsp;,31h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;JMP &nbsp;d2 &nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;&nbsp; &nbsp;<br>
d1: &nbsp; &nbsp; MOV &nbsp;,20h<br>
d2: &nbsp; &nbsp; MOV &nbsp;DX,OFFSET data1<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;MOV &nbsp;AH,09h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;INT &nbsp;21h<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;MOV &nbsp;AH,4ch<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;INT &nbsp;21h<br>
code &nbsp; &nbsp;ENDS<br>&nbsp; &nbsp; &nbsp;&nbsp; &nbsp;END start<br>

大风吹 发表于 2005-4-26 17:52:00

晕死了

♂晖♀ 发表于 2005-4-26 18:02:00

流水剑客 发表于 2005-4-27 15:14:00

小胖哪弄的?
页: [1]
查看完整版本: [分享]汇编实验二加法