>_<:低位相加:
1 ; multi-segment executable file template. 2 3 data segment 4 datax dw 0148H,2316H 5 datay dw 0237H,4052H 6 ends 7 8 stack segment 9 dw 128 dup(0)10 ends11 12 code segment13 start:14 ; set segment registers: 15 mov ax,data16 mov ds,ax17 mov es,ax18 19 ; add your code here20 mov ax, datax21 add datay, ax 22 ; wait for any key.... 23 mov dl, 03H24 mov ah, 225 int 21h 26 27 mov dl, 7FH28 mov ah, 229 int 21h 30 mov ah, 131 int 21h32 33 mov ax, 4c00h ; exit to operating system.34 int 21h 35 ends36 37 end start ; set entry point and stop the assembler.
>_<:带进位2位相加
; multi-segment executable file template.data segment datax dw 0148H,2316H datay dw 0237H,4052H endsstack segment dw 128 dup(0)endscode segmentstart:; set segment registers: mov ax,data mov ds,ax mov es,ax ; add your code here mov ax, datax add datay, ax mov ax,datax+2 adc datay+2,ax ; wait for any key.... mov dl, 03H mov ah, 2 int 21h mov dl, 7FH mov ah, 2 int 21h mov ah, 1 int 21h mov ax, 4c00h ; exit to operating system. int 21h endsend start ; set entry point and stop the assembler.
本文转自beautifulzzzz博客园博客,原文链接:http://www.cnblogs.com/zjutlitao/p/3643010.html,如需转载请自行联系原作者