ReC98/libs/BorlandC/N_PCMP.ASM

46 lines
1.4 KiB
NASM

; *Not* the original file, but an edit to turn it into an includable slice.
; Changes include:
; * removal of RULES.ASI to eliminate redundancy
; * removal of the 'CODE' segment declaration (for obvious reasons)
;[]-----------------------------------------------------------------[]
;| N_PCMP.ASM -- long pointer comparison |
;[]-----------------------------------------------------------------[]
;
; C/C++ Run Time Library - Version 5.0
;
; Copyright (c) 1987, 1992 by Borland International
; All Rights Reserved.
;
; calls to this routine are generated by the compiler to compare
; long pointers.
;
; PCMP@ - compares two pointers, sets the condition codes
;
; ax,dx left hand pointer
; bx,cx right hand pointer
public N_PCMP@
N_PCMP@ PROC NEAR
push cx
mov ch,al
mov cl,4
shr ax,cl
add dx,ax
mov al,ch
mov ah,bl
shr bx,cl
pop cx
add cx,bx ; right hand pointer segment
mov bl,ah
and ax,0fh
and bx,0fh
cmp dx,cx ; compare segments
jne PCMPend
cmp ax,bx ; compare offsets
PCMPend:
ret
N_PCMP@ ENDP