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.
SubLong
   Example  Back  Contents  Index
──────────────────────────────────────────────────────────────────────────────
 
;* SubLong - Subtracts a double-word (long) integer from another.
;*
;* Shows:   Instructions -  sub     sbb
;*
;* Params:  long1 - First integer
;*          long2 - Second integer
;*
;* Return:  Difference as long integer
 
SubLong 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
        sub     ax, WORD PTR long2[0]   ; Subtract low word, long2
        sbb     dx, WORD PTR long2[2]   ; Subtract high word, long2
        ret                             ; Result returned as DX:AX
 
SubLong ENDP
                                    -♦-