[分享]汇编实验二加法
data SEGMENT<br>data1 DB'72355+'<br>
data2 DB'45664= '<br>
data3 DB 6 DUP(?),'$'<br>
data ENDS<br>
code SEGMENT<br>
ASSUME CS:code,DS:data<br>
start: MOV AX,data<br> MOV DS,AX<br> LEA SI,data1<br> LEA DI,data2<br> LEA BX,data3<br> MOV CX,5<br> CLC<br>
l1: MOV AL,<br> ADC AL,<br> AAA<br> PUSHF<br> ADD AL,30h<br> POPF<br> MOV ,AL<br> DEC SI<br> DEC DI<br> DEC BX<br> LOOP l1<br> JNC l21<br>
l2: MOV ,31h<br> JMP l22<br>
l21: MOV ,20h<br>
l22: MOV DX,OFFSET data1<br> MOV AH,09h<br> INT 21h<br> MOV AH,4ch<br> INT 21h<br>
code ENDS<br> END start <br>
附加题:<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> ASSUME CS:code,DS:data<br>
start: MOV AX,data<br> MOV DS,AX<br> LEA SI,data1<br> LEA DI,data2<br> LEA BX,data3<br> CLC<br> MOV CX,5 <br> <br>
again1: MOV AL,<br> ADC AL,<br> AAA<br> PUSHF<br> ADD AL,30h<br> POPF<br> MOV ,AL<br> DEC SI<br> DEC DI<br> DEC BX<br> LOOP again1<br> JNC d1 <br>
d0: MOV ,31h<br> JMP d2 <br>
d1: MOV ,20h<br>
d2: MOV DX,OFFSET data1<br> MOV AH,09h<br> INT 21h<br> MOV AH,4ch<br> INT 21h<br>
code ENDS<br> END start<br>
晕死了 小胖哪弄的?
页:
[1]