[Assembly] Cộng 2 số nguyên hệ thập phân

Để cộng được 2 số nguyên lớn thì trước tiên chúng ta cần nhập và xuất được 2 số nguyên lớn hệ thập phân đã. Các bạn có thể xem tại Nhập và xuất số nguyên.
Sau đây là code cộng 2 số nguyên hệ thập phân:

.model small
.stack 100
.data
    inputA db 'Nhap so A = $'
    inputB db 'Nhap so B = $'
    outputResult db 'Tong A + B = $'  
    CLRF db 13, 10, '$'
.code
    main proc
    mov ax, @data
    mov ds, ax
              
    mov ah, 9         ; hien thi "Nhap so A = "
    lea dx, inputA
    int 21h
    
    call inputDec     ; goi CTC nhap so thu nhat he 10
    push ax           ; luu ax da nhap lai
    call nextLine     ; xuong dong
    
    mov ah, 9         ; lam tuong tu voi so thu hai 
    lea dx, inputB
    int 21h
    
    call inputDec
    mov bl, al
    call nextLine              
    
    pop ax            ; goi ax tu Stack ra
    call sum          ; goi ham tinh tong 2 so (trong ax va bx)
    push ax           ; luu ax lai
                      
    mov ah, 9         ; hien thi KQ
    lea dx, outputResult
    int 21h
    
    pop ax
    call outputDec    ; goi CTC hien thi KQ
    
    mov ah, 4ch
    int 21h
    
    
    main endp
    
    sum proc          ; CTC con tinh tong 2 so
        add ax, bx
        ret
    sum endp 
                                                           
    nextLine proc     ; CTC xuong dong
        mov ah, 9
        lea dx, CLRF
        int 21h
        ret
    nextLine endp
    
    include includeinputDecProc.asm     ; tep chua CTC nhap so he 10
    include includeoutputDecProc.asm    ; tep chua CTC hien thi so he 10
end main

code link

các bạn dựa vào bài Nhập và xuất số nguyên hoặc có thể xem 2 file inputDecProc.asmoutputDecProc.asm