;[]-----------------------------------------------------------------[]
;|      H_PINA.ASM -- long pointer routines                          |
;[]-----------------------------------------------------------------[]

;
;       C/C++ Run Time Library - Version 6.0
; 
;       Copyright (c) 1987, 1993 by Borland International
;       All Rights Reserved.
; 

                INCLUDE RULES.ASI

; calls to these routines are generated by the compiler to perform
; arithmetic operations on long pointers.

_TEXT           SEGMENT BYTE PUBLIC 'CODE'
                ASSUME  CS:_TEXT

                public  PINA@
                public  F_PINA@
                public  N_PINA@

N_PINA@:
                pop     cx                      ;fix up far return
                push    cs
                push    cx
PINA@:
F_PINA@:
;
;               Pointer to memory cell to increment is in es:bx
;               Increment amount is ax
;               This routine trashes cl

                mov     cl,4
                add     ax,es:[bx]
                mov     dx,ax
                jc      inacarry
                shr     dx,cl
                add     dx,es:2[bx]
                and     ax,0fh
                xchg    es:[bx],ax
                xchg    es:2[bx],dx
                retf
inacarry:
                shr     dx,cl
                add     dx,es:2[bx]
                add     dx,1000H
                and     ax,0fh
                xchg    es:[bx],ax
                xchg    es:2[bx],dx
                retf

                public  PDEA@
                public  F_PDEA@
                public  N_PDEA@

N_PDEA@:
                pop     cx                      ;fix up far return
                push    cs
                push    cx
PDEA@:
F_PDEA@:
;
;               Pointer to memory cell to increment is in es:bx
;               Decrement amount is ax
;               This routine trashes cl

                mov     cl,4
                mov     dx,es:[bx]
                sub     dx,ax
                mov     ax,dx
                jc      deacarry
                shr     dx,cl
                add     dx,es:2[bx]
                and     ax,0fh
                xchg    es:[bx],ax
                xchg    es:2[bx],dx
                retf
deacarry:
                shr     dx,cl
                add     dx,es:2[bx]
                sub     dx,1000H
                and     ax,0fh
                xchg    es:[bx],ax
                xchg    es:2[bx],dx
                retf
_TEXT           ENDS
                END

