Assembly Language Help (alang.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
AddLong
 Map                                       Up Contents Index Back
────────────────────────────────────────────────────────────────────────────
 
;* AddLong - Adds two double-word (long) integers.
;*
;* Shows:   Instructions - add     adc
;*          Operator - PTR
;*
;* Params:  Long1 - First integer
;*          Long2 - Second integer
;*
;* Return:  Sum as long integer
 
AddLong PROC,
        Long1:SDWORD, Long2:SDWORD
 
        mov     ax, WORD PTR Long1[0]   ; AX = low word, long1
        mov     dx, WORD PTR Long1[2]   ; DX = high word, long1
        add     ax, WORD PTR Long2[0]   ; Add low word, long2
        adc     dx, WORD PTR Long2[2]   ; Add high word, long2
        ret                             ; Result returned as DX:AX
 
AddLong ENDP
                                    -♦-