qa.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
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* AddLong - Adds two double-word (long) integers.
;*
;* Shows:   Instructions - add     adc
;*
;* Params:  long1 - First integer
;*          long2 - Second integer
;*
;* Return:  Sum as long integer
 
AddLong PROC \
        long1:DWORD, long2:DWORD
 
        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
                                    -♦-